【问题标题】:Heckman selection model in R manuallyR中的Heckman选择模型手动
【发布时间】: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


    【解决方案1】:
    myprobit    <- probit(lfp ~ age + I(age^2) + faminc + kids + educ - 1, x = TRUE, 
                               iterlim = 30, data=Mroz87)
    
    imrData     <- invMillsRatio(myprobit) # same as yours in this particular case
    Mroz87$IMR1 <- imrData$IMR1
    
    outeqn1     <- lm(wage ~ -1 + exper + I(exper^2) + educ + city + IMR1, 
                      data=Mroz87, subset=(lfp==1))
    

    主要是你使用拦截模型而不是不拦截。

    【讨论】:

    • 谢谢,但现在我似乎不仅得到了不同的标准误差,而且得到了不同的估计值..?
    • @research111 我会更多地研究 SE 问题。我得到了与包相同的结果,但我使用heckit2fit() 作为比较的基础。
    • @research111 如果不出意外,也许我们可以联系包作者进行澄清,并向他发送此线程的链接。 otoomet@ut.ee
    • 谢谢,在这种情况下,我也会得到相同的结果。似乎有必要纠正标准错误,因为这是一个两步过程。我在 Stata here 中找到了代码,但在 R 中还没有
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-24
    • 2015-10-10
    • 2015-05-21
    • 2018-10-25
    • 2020-06-03
    • 2018-05-07
    相关资源
    最近更新 更多