【发布时间】:2018-03-27 13:54:11
【问题描述】:
是否有机会指定完整模型一次,然后一个接一个地删除回归器,并用它生成一个漂亮的观星表,而不必一次又一次地编写每条回归线?
data <- datasets::airquality
# Treating Month and Day as crosssectional and time fixed effects
re1 <- plm(data = data, Ozone~Solar.R+Wind+Temp,
index=c("Month", "Day"), model="within", effect="twoways") # full model
# this is the only regression line I actually want to write.
# The other regressors should be automatically dropped one by one in subsequent regressions.
re2 <- plm(data = data, Ozone~Wind+Temp,
index=c("Month", "Day"), model="within", effect="twoways") # first regressor dropped
re3 <- plm(data = data, Ozone~Solar.R+Temp,
index=c("Month", "Day"), model="within", effect="twoways") # second regressor dropped
re4 <- plm(data = data, Ozone~Solar.R+Wind,
index=c("Month", "Day"), model="within", effect="twoways") # third regressor dropped
stargazer(re1, re2, re3, re4,
type = "html",
title = "Dropped after one another",
out="HopeThisWorks.html")
我已经研究了 step() 函数,但这并没有太大帮助,因为我的目标不是根据重要性或其他任何东西下降。
【问题讨论】:
-
如果不是按显着性或 AIC,您想如何选择要删除的回归量?逐步回归已经足够狡猾了,你想要一个更不可靠的版本吗?
-
或者你想要每个组合?如果是这样,那么this is a duplicate。
-
我只想一次删除一个变量,以证明我感兴趣的解释变量的重要性和符号不依赖于包含或排除的任何其他变量。在我看来,这是一个透明度问题。这与决定保留或不保留哪些变量无关!
-
您有一个非常具体且不常见的用例。我认为您不会找到现成的解决方案。我建议使用
combn获取您想要的变量组合,使用paste构建公式,然后将模型放在一个列表中。
标签: r regression stargazer