Dear statalist:
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.
My thesis is about the estimation of wage equation.It's obvious that those without work can't be observed so as to result "selction bias". My wage equation is a finite mixture model,and my consideration is that the first stage is a probit which estiamate people work or not and second stage is a fmm about wage.
Thank you for your patience and I'm looking forward to your help.
Zhang Bing
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
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.
My thesis is about the estimation of wage equation.It's obvious that those without work can't be observed so as to result "selction bias". My wage equation is a finite mixture model,and my consideration is that the first stage is a probit which estiamate people work or not and second stage is a fmm about wage.
Thank you for your patience and I'm looking forward to your help.
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

Comment