Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Hendrik M <hendrik.m@hotmail.be> |
To | Statalist <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: Simultaneous Ordered Probit and Linear Equation Model, Unbalanced Data, ML Programming |
Date | Wed, 21 Sep 2011 16:52:12 +0200 |
Hi Maarten, hi all I agree and hope, that Stata does not invent any values... And yes, the 200 obs, in which y2 isn't available are missing values. I think this isn't the problem. if I programme: args lnf bx1 theta1 theta2 theta3 bx2 sigmaR sigmaE sigmaER replace `lnf' = ln(1-normal((`theta1'-x1-`bx1')/`sigmaE')) if $ML_y1==0 replace `lnf' = -ln(`sigmaR')+ln(normalden(($ML_y2-`bx2')/`sigmaR')) + ln(normal((-`bx1'-x1+`thetaE2'-`sigmaER'/`sigmaR'^2*($ML_y2-`bx2'))/sqrt(`sigmaE'^2-`sigmaER'^2/`sigmaR'^2))-normal((-`bx1'-x1+`thetaE1'-`sigmaER'/`sigmaR'^2*($ML_y2-`bx2'))/sqrt(`sigmaE'^2-`sigmaER'^2/`sigmaR'^2))) if $ML_y1==1 replace `lnf' = -ln(`sigmaR')+ln(normalden(($ML_y2-`bx2')/`sigmaR')) + ln(normal((-`bx1'-x1+`thetaE3'-`sigmaER'/`sigmaR'^2*($ML_y2-`bx2'))/sqrt(`sigmaE'^2-`sigmaER'^2/`sigmaR'^2))-normal((-`bx1'-x1+`thetaE2'-`sigmaER'/`sigmaR'^2*($ML_y2-`bx2'))/sqrt(`sigmaE'^2-`sigmaER'^2/`sigmaR'^2))) if $ML_y1==2 replace `lnf' = -ln(`sigmaR')+ln(normalden(($ML_y2-`bx2')/`sigmaR')) + ln(1-normal((-`bx1'-x1+`thetaE3'-`sigmaER'/`sigmaR'^2*($ML_y2-`bx2'))/sqrt(`sigmaE'^2-`sigmaER'^2/`sigmaR'^2))) if $ML_y1==3 Then the ML function calls all observations because all 1000 obs are available and there are no missing values for y1. It only "replaces"/uses the observations of y2 if y1={1,2,3}. the first line should be untouched by the fact whether y2 is missing or not. So, in fact y2 does not appear in the first "replace 'lnf'"-line, but Stata treats my ML function as this line would not exist. I hope I did not misunderstand you. Or do you want to add i.e. "if $ML_y2!=." for the cases/obs where y2 is available ("replace"-lines 2-4)? Happy to discuss Hendrik ---------------------------------------- > Date: Wed, 21 Sep 2011 16:26:42 +0200 > Subject: Re: st: Simultaneous Ordered Probit and Linear Equation Model, Unbalanced Data, ML Programming > From: maartenlbuis@gmail.com > To: statalist@hsphsun2.harvard.edu > > On Wed, Sep 21, 2011 at 3:54 PM, Hendrik M wrote: > > If I programme the function, Stata keeps on refusing to use all 1000 > > observations. It only uses 800 (all obs for which also y2 is availbale). > > Your likelihood (the linear part) needs y2. So what is Stata supposed > to use for y2 in those 200 observations where you told it that you > don't know what y2 is (i.e. assigned a missing value)? It is a good > thing that Stata refuses to "invent" data for you. > > Hope this helps, > Maarten > > -------------------------- > Maarten L. Buis > Institut fuer Soziologie > Universitaet Tuebingen > Wilhelmstrasse 36 > 72074 Tuebingen > Germany > > > http://www.maartenbuis.nl > -------------------------- > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/