问题描述
使用 lfe
包的 felm()
计算具有多个固定效果的面板数据回归时,摘要结果中不会生成常数/截距.
When calculating a panel data regression with multiple fixed effects using the felm()
(of the lfe
package), no constant / intercept is generated in the summary results.
如何生成常量/截距?
例如,使用Stata( xtreg
, fe
)时,默认情况下会生成拦截.
When using Stata (xtreg
, fe
), for example, an intercept is generated by default.
(由于未提供可复制的示例,我事先表示歉意...)
(I apologize in advance for not providing a reproducible example...)
此处摘录自Simen Gaure在The R Journal(2013年12月,第5/2卷)中的文章摘录 https://journal.r-project.org/archive/2013/RJ-2013-031/RJ-2013-031.pdf
Here is an excerpt from Simen Gaure's article in The R Journal (Vol. 5/2, December 2013) https://journal.r-project.org/archive/2013/RJ-2013-031/RJ-2013-031.pdf
细心的读者已经注意到,在包含截距"的情况下,"felm"对象相对于自由度和R2的summary()行为与"lm"对象上的行为相同.felm()的结果中没有显式的截距,但是因子结构隐式包括一个截距."
"The careful reader has noticed that the behaviour of summary() on a ’felm’ object with respect to degrees of freedom and R2 is the same as that of on an ’lm’ object when including an intercept. There is no explicit intercept in the result of felm(), but the factor structure includes one implicitly."
如果我想要拦截,该怎么办?如何在结果中生成它?
What if I want the intercept?? How would I generate it in the results?
谢谢!
推荐答案
如果您仅使用具有一个或两个固定效果的 felm
,我相信您可以使用检索拦截项getfe
函数,ef
选项设置为 'zm2'
.例如.使用称为结果"的估计 felm
对象,我们可以恢复固定效果的固定值
If you are using felm
with only one or two fixed effects, I believe you can retrieve an intercept term using the getfe
function with ef
option set to 'zm2'
. E.g. using an estimated felm
object called "result", we can recover the fixed the values of the fixed effects
df = getfe(result, ef='zm2')
然后,截距包含在标记为"icpt"或"icpt.1"的 df
行中.
Then the intercept is contained in the row of df
labeled "icpt" or "icpt.1".
这篇关于R中使用LFE(FELM)的固定效果回归常数/截距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!