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

Rui Barradas ruipbarradas at sapo.pt
Thu May 11 22:36:09 CEST 2017


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.



More information about the R-help mailing list