I want to do a heckman seclection model whose second stage is a fmm by joint maximum likelihood estimation.But I don't how to do it.
As you see,I have got the key to do heckman whose second stage is a ols.So I am looking forward to your further help.
Thank you for your patience.
Zhang Bing
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
program myheckman
args lnf xb1 g lns1 zg1
qui {
* Selection equation*
tempvar lnf1 lnf2
gen double `lnf2'=ln(normal(`zg1')) if $ML_y2==1
replace `lnf2'=ln(1-normal(`zg1')) if $ML_y2==0
* Outcome Equation*
gen double `lnf1'=ln(normalden($ML_y1,`xb1'+`g'*normalden(`zg1')/normal(`zg1'),exp(`lns1')))
replace `lnf1'=0 if $ML_y2==0
* Adding all Loglikelihoods*
replace `lnf'=`lnf1'+`lnf2'
}
end
webuse nlswork
gen age2=age*age
gen age3=age*age2
gen age4=age2*age2
gen employment=( wks_ue==0 )
ml model lf myheckman (xb1:ln_wage=age age2 age3 age4 collgrad) (g:) (lns1:) (zg1:employment=age age2 age3 age4 collgrad)
ml search
ml max
end
0 Response to How to write a heckman selection model whose second stage is a finite mixture model
Post a Comment