【发布时间】:2016-12-28 09:33:03
【问题描述】:
我想在 R 中手动计算 Heckman 选择模型。 我的问题是标准误差是有偏差的。有没有办法手动更正这些?
在我来自 sampleSelection 模型的(示例)代码(正确的 SE)和手动代码(正确的估计,错误的 SE)下方
require(sampleSelection)
data( Mroz87 )
Mroz87$kids <- ( Mroz87$kids5 + Mroz87$kids618 > 0 )
使用 sampleSelection
heckman <- selection(selection = lfp ~ age + I(age^2) + faminc + kids + educ, outcome = wage ~ exper + I(exper^2) + educ + city,
data = Mroz87, method = "2step")
summary(heckman)
手动
seleqn1 <- glm(lfp ~ age + I(age^2) + faminc + kids + educ, family=binomial(link="probit"), data=Mroz87)
summary(seleqn1)
# Calculate inverse Mills ratio by hand ##
Mroz87$IMR <- dnorm(seleqn1$linear.predictors)/pnorm(seleqn1$linear.predictors)
# Outcome equation correcting for selection ## ==> correct estimates, wrong SEs
outeqn1 <- lm(wage ~ exper + I(exper^2) + educ + city + IMR, data=Mroz87, subset=(lfp==1))
summary(outeqn1)
【问题讨论】:
标签: r standard-error