我尝试使用 plm 包在 R 中进行一些第一次差异估计。如标题中所述,我想知道如何将我的 POSIX 日期(如“2002-10-01”)转换为 plm 时间索引可以理解的值。我猜这意味着使用整数值?
这是我到目前为止所尝试的:
panel.fd <- plm(y~X,index=c("datefield","id"),model="fd",data=z)
# returns
Error in pdim.default(index[[1]], index[[2]]) :
# when I convert my datefield to a factor, I get the same error...
z$t_idx <-as.factor(z$datefield)