Any idea on how to run the Heckman correction on a complex survey data in R?
I've tried doing it manually, but no success so far...
For the first stage I ran the svyglm()
function from the survey package which works well and I was able to estimate the probit model . However, for the second stage I'm having trouble including the predicted inverse Mills ratio (λ) in the svyglm()
function.
You can try something similar:
# my probit model - First stage
pb = svyglm(sel ~ x + y + z, # generic variables
design = my_design,
family = binomial(link = 'probit'))
# update my design
my_design <- update( my_design , mills = dnorm(predict(pb))/pnorm(predict(pb)))
# Heckman model - Second stage
heck = svyglm(log_wage ~ k + l + x
mills,
design = my_design,
weights = V)