Dear all,

I am trying to account for sample selection into the selection of female and male wealth. I do that in a two step model. In the first step, I run a probit model and compute the inverse Mills ratio. In the step I incorporate that ratio in my regression. However, I want to bootstrap the aforementioned process in order to have correct estimates. The problem is that I have multiply imputed data (5 times) and even with reps(2) the whole estimation takes age.

I have written the following code and I would like to know if you think it is correctly coded or if you could provide me with some better suggestions on how to approach such problem.

capture program drop qr11a
program define qr11a, rclass
mi estimate, saving(miest,replace) post dots vceok: svy: probit prob1 gender Dage Dage1 Dchild Rown RownI childI /*
*/ Dmar DmarI DmarII marI marII marIII ageI ageII earningsD earningsI if ra0300<61
drop xb_mi phi PHI lambda
mi predict xb_mi using miest
* To calculate the standard normal pdf
g phi=normalden(xb_mi)
* To calculate the standard normal cdf
g PHI=normal(xb_mi)
* and to calculate lambda
g lambda=phi/PHI
mi estimate, post dots vceok: svy: reg nwealtht gender lambda if partner==0 & ra0300<61
return scalar b_g = el(e(b_mi),1,1)
return scalar b_l = el(e(b_mi),1,2)
end
bootstrap b_gender=r(b_g) b_lambda=r(b_l), reps(2) : qr11a

vceok is a command that takes into account the replicate weights of the survey.

Thank you for your help.

Ilias