fixed effects in R: plm vs lm + factor()

浪尽此生 提交于 2019-12-04 16:04:00
Rodrigo Remedio

That error is saying you have repeated id-time pairs formed by variables C and D.

Let's say you have a third variable F which jointly with C keep individuals distinct from other one (or your first dimension, whatever it is). Then with dplyr you can create a unique indice, say id :

data.frame$id <- data.frame %>% group_indices(C, F) 

The the index argument in plm becomes index = c(id, D).

The lm + factor() is a solution just in case you have distinct observations. If this is not the case, it will not properly weights the result within each id, that is, the fixed effect is not properly identified.

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