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

From |
Maarten buis <maartenbuis@yahoo.co.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: predictions from ML program |

Date |
Fri, 6 Jun 2008 12:38:38 +0100 (BST) |

--- marcel spijkerman <marcel_spijkerman@hotmail.com> wrote: > I am estimating by ML a likelihood of the form: > > L = ln(p1*L1 + p2*L2 + p3*L3 + p4*L4) > > where the p's are mixture probabilities and the L's are likelihood > contributions of a survival density. now I want to estimate the > parameters of this likelihood by the EM - algorithm, and therefore I > need to compute the likelihood contribution for each individual and > each term given de data and current parameter estimates. My question > is how I can do this effeciently, thus given e(b) from a previous > step, computing the likelihood contributions for each term, use these > to upfdate the p's and estimate the parameters again? There is no nicely packaged suite of commands that will help you do a EM, so you'll have to do it yourself. Given that, your first concern should be to get it working correctly. Once you've done that you can start worrying about efficiency. Basically you'll want a -while- loop. Call the parameters of L1, L2, etc, b, than below will give you a rough sketch of such a program. Hope this helps, Maarten *----------------- begin sketch ----------------- local `i' = 1 while `critll' > `emltolerance' & /// `critb' > `emtolerance' & /// `i' < `emiterate'{ scalar `old_ll' = r(new_ll) matrix `old_b' = r(init) Ls `varlist' `wgt' if `touse', other options Ps `varlist' `wgt' if `touse', other options scalar `critll' = reldif(r(new_ll),`old_ll') scalar `critb' = mreldif(r(init),`old_b') local ++i } program define Ps, rclass maximize likelihood with respect to b, while fixing p end program define Ps, rclass maximize likelihood with respect to p1, p2, etc while fixing bs end *----------------- end sketch ----------------- ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room Z434 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- __________________________________________________________ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html * * 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/

**Follow-Ups**:**RE: st: predictions from ML program***From:*marcel spijkerman <marcel_spijkerman@hotmail.com>

**References**:**st: predictions from ML program***From:*marcel spijkerman <marcel_spijkerman@hotmail.com>

- Prev by Date:
**st: -estimates post- followed by post-estimation processing** - Next by Date:
**st: -estimates post- followed by post-estimation processing** - Previous by thread:
**st: predictions from ML program** - Next by thread:
**RE: st: predictions from ML program** - Index(es):

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