[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Michael Blasnik" <michael.blasnik@verizon.net> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: fweights + ml d0 |

Date |
Mon, 14 Jun 2004 15:01:01 -0400 |

I would suggest that you either adjust the value of `F' for the observations that you don't want in the sum or else don't use mlsum but instead perform the calculation yourself. I think the first suggestion might be easier. How about inserting the line replace `F'=log(F)*`last' just before the mlsum and change the mlsum line to read mlsum `lnf' = `F' That is, take the logs yourself but count observation not flagged with `last' as zero. Michael Blasnik michael.blasnik@verizon.net ----- Original Message ----- From: "Alfonso Miranda Caso Luengo" <Alfonso.Miranda-Caso-Luengo@warwick.ac.uk> To: <statalist@hsphsun2.harvard.edu> Sent: Monday, June 14, 2004 11:47 AM Subject: Re: st: fweights + ml d0 > Dear all, > > Here is an example of the problems I found with fw and ml d0. This code estimates a sequential probit. A dummy dependent variable is observed for each individual in various periods. The model predicts the probability of observing a given sequence. For each individual draws are iid. However, observations in the data set are not independent as each individual contributes a group of observations. Hence, the ml linear-form restriction is not met in this case. > > Here is the example. Can anyone see the error? > > Many thanks in advance, > > Alfonso. > > <snip> > . capture program drop mycode2_ll > > . program define mycode2_ll > 1. args todo b lnf > 2. > . local y "$ML_y1" > 3. local i "$S_ivar" > 4. > . tempvar xb F last > 5. > . mleval `xb' = `b' > 6. > . qui { > 7. by `i' : gen `last' = cond(_n==_N,1,0) > 8. > . gen double `F' = . in 1 if $ML_samp > 9. > . #delimit ; > delimiter now ; > . by `i': replace `F' = > > cond(_n==1, > > cond(`y',normprob(`xb'),normprob(-`xb')), > > cond(`y', > > normprob(`xb'),normprob(-`xb'))*`F'[_n-1] ) if $ML_samp; > 10. #delimit cr > delimiter now cr > . > . mlsum `lnf' = log(`F') if `last' > 11. > . } > 12. end > <snip> > Alfonso Miranda > PhD Student > > Economics Department > University of Warwick * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: fweights + ml d0***From:*"Alfonso Miranda Caso Luengo" <Alfonso.Miranda-Caso-Luengo@warwick.ac.uk>

- Prev by Date:
**RE: st: fweights + ml d0** - Next by Date:
**st: Summer Stata Movies** - Previous by thread:
**Re: st: fweights + ml d0** - Next by thread:
**RE: st: fweights + ml d0** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |