[R] Error: invalid type (closure) for the variable 'time' - object specific trend

David L Carlson dcarlson at tamu.edu
Thu May 11 23:17:18 CEST 2017


What Rui said, but as important, you have four columns in your data called "town", "year", "revenue", and "supply". You do not have a column called "time". 

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Rui Barradas
Sent: Thursday, May 11, 2017 3:36 PM
To: Tobias Christoph <s3tochri at uni-bayreuth.de>; Duncan Murdoch <murdoch.duncan at gmail.com>; r-help at r-project.org
Subject: Re: [R] Error: invalid type (closure) for the variable 'time' - object specific trend

Hello,

A closure is, like you say, a function.
At an R prompt try:

 > typeof(time)
[1] "closure"

So like Duncan suggested rename 'time', for instance capitalize it 
'Time'. That should do it.

Hope this helps,

Rui Barradas



Em 11-05-2017 21:20, Tobias Christoph escreveu:
> Hey Duncan,
>
> thank you very much for your quick reply.
>
> _My data used:_
>
> 1st column(town):1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,...........,11
>
> 2nd column(year):1,2,3,4,5,6,7,8,9,10,11,12,1,2,3.......,12
>
> 3rd column (revenue):
>
> 4th colum (supply):
>
> I have now renamed my colums and did the regression again. Now there is
> a problem with R-squared, as it is the sum of 1 now with no given std.
> error and t-value. This is probably due to the fact, that I try to
> estimate more parameters than data.
>
> To add a linear trend I found the following formular:*lm(y ~ x1 +
> factor(ccode)*time, data=df)*
>
> I try to I decode it for and use it for my regression: *plm(log(revenue)
> ~ log(supply) + factor(town)*time, data=R_Test_log_Neu)*
>
> When I do this regression I will get the original error: "invalid type
> (closure) for the variable 'time' - object specific trend"
>
> With the notation"time" not my colum is meant, but probably the command
> "time" in R.
>
> Can you follow my thoughts?
>
> Tobi
>
>
>
>
>
>
> Am 11.05.2017 um 17:23 schrieb Duncan Murdoch:
>> Duncan Murdoch
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list