R: plm — year fixed effects — year and quarter data

守給你的承諾、 提交于 2019-12-04 04:08:28

In a panel setting, you usually don't have some duplicate value for each couple id-year.

In your quaterly data it will be difficult to compute a year fixed effect models without aggregating your data to make them yearly.

Check the examples here to see how your data should be formatted for panel data modeling.

Here is oneway to do that :

require(plyr)
yeardata  <- ddply(data, .(year, id), summarize, y = mean(y),
                                                 x = mean(x))


require(plm)
reg1 <- plm(y ~ x, data = yeardata, index = c("id", "year"), model = "within", effect = "time")
fixef(reg1)

##      1999      2000 
## 0.2641997 0.0041193
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!