Hi,
I'm trying to use mlexp to replicate the results obtained with the command heckoprobit.
I was able to use mlexp and to replicate the results obtained with the command oprobit and goprobit but I'm struggling in adding the selection.
Here is my code:
Can anyone help me out with this?
Thank you very much!
I'm trying to use mlexp to replicate the results obtained with the command heckoprobit.
I was able to use mlexp and to replicate the results obtained with the command oprobit and goprobit but I'm struggling in adding the selection.
Here is my code:
Code:
* Oprobit by hand clear set obs 200 set seed 1 gen yy=1 if _n>=20 replace yy=2 if _n>=20 & _n<=50 replace yy=3 if _n>=150 gen y=100*rnormal() gen s=(_n>=180) replace y=. if s==0 gen x=30*rnormal() replace x=x+3 if _n>=150 su gen y1=(yy==1) gen y2=(yy==2) gen y3=(yy==3) mlexp (ln(normal(-{b1}*x+{mu1}))*y1+ln(normal(-{b1}*x+{mu2})-normal(-{b1}*x+{mu1}))*y2+ln(1-normal( -{b1}*x+{mu2}))*y3), from(b1=0.02 mu1=0.03 mu2=0.05) oprobit yy x *Goprobit by hand mlexp (ln(normal(-{b1}*x+{mu1}))*y1+ln(normal(-{b2}*x+{mu2})-normal(-{b1}*x+{mu1}))*y2+ln(1-normal( -{b2}*x+{mu2}))*y3), from(b1=0.002 mu1=0.03 mu2=0.5) goprobit yy x
Thank you very much!
Comment