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

Duncan Murdoch murdoch.duncan at gmail.com
Thu May 11 17:23:37 CEST 2017


On 11/05/2017 9:37 AM, Tobias Christoph wrote:
> Hey,
>
> I just have trouble adding a object specific time trend with the
> plm-package. I recieve the following error:
> *
> **"Error in model.frame.default(terms(formula, lhs = lhs, rhs = rhs,
> data = data,  : invalid type for the variable 'time' "*
>
> I used the formula:
>
> / FE_trend<- plm(log(revenue) ~ log(supply)+ city*time,
> data=R_Test_log_Neu, model="within", effect = "twoways") //
> /
> Do you have an idea how to fix it?

I don't know that package and you didn't supply a reproducible example, 
so there are at least these two possibilities:

1.  Your dataframe R_Test_log_Neu contains no column named "time". 
(Remember that "Time" and "time" are different.)  Fix:  use the correct 
column name.

2.  The plm package isn't doing lookup of symbols from the formula first 
in your dataframe.  This would need to be fixed in the package.  A 
workaround might be to name the columns with unique names that won't be 
found anywhere else, e.g. name your column "NeuTime" instead of "time".

Duncan Murdoch



More information about the R-help mailing list