简体   繁体   English

R 中 function 的时间固定效应

[英]Time fixed-effects with felm function in R

I'm using the felm function in R for time-fixed effects but I'm having trouble specifying my model.我在 R 中使用felm function 来实现时间固定效果,但我在指定 model 时遇到了问题。

I tried the following two but they result into completely different outputs.我尝试了以下两个,但它们导致了完全不同的输出。 Could you explain what does the 0 stand for?你能解释一下0代表什么吗? Which of the following models would be correct for my analysis?以下哪个模型适合我的分析? My sample consists of 400 observations (40 countries over 10 years).我的样本包含 400 个观察结果(40 个国家超过 10 年)。

model_1 <- felm(y ~ x1 + x2 + x3 | year | 0 | year, data = df)

model_2 <- felm(y ~ x1 + x2 + x3 | year, data = df)

I would really appreciate some advice on this, thank you!我真的很感激对此的一些建议,谢谢!

In lfe::felm we may specify fixed effects, instruments, and cluster, eglfe::felm中,我们可以指定固定效果、乐器和集群,例如

y ~ x1 + x2 | f1 + f2 | (Q|W ~ x3+x4) | clu1 + clu2 

The 0 indicates that you do not want to specify anything. 0表示您不想指定任何内容。

So in所以在

model_1 <- felm(y ~ x1 + x2 + x3 | year | 0 | year, data = df)

you specified year fixed effects and standard errors clustered by year,您指定了按年份聚集的年份固定效应和标准误差,

whereas in而在

model_2 <- felm(y ~ x1 + x2 + x3 | year, data = df)

you specified just the year fixed effects.您只指定了年份固定效应。

Note: Read Details section in ?lfe::felm .注意:阅读?lfe::felm中的详细信息部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM