Statalist


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

RE: st: predictions from ML program


From   marcel spijkerman <marcel_spijkerman@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: predictions from ML program
Date   Mon, 9 Jun 2008 12:26:39 +0000

Thanks Maarten for your suggestions. Let me explain what I mean by 'efficiently'; I am a GAUSS user but now I am 'forced' to use STATA. For example; to calculate the quantity b'X where b' is a vector of estimated parameters, I do know how to call these parameters (e(b)) but to compute b'X I do not know other than:


b0 + b1*x1 + b2*x2 ........

So every time I change the specification I have to adjust these lines. It would be handy to know of some procedure that automates this to some extent and I do not know where to look in Stata (I tried something with 'foreach'????).


Regards,

Marcel





> Date: Fri, 6 Jun 2008 12:38:38 +0100
> From: maartenbuis@yahoo.co.uk
> Subject: Re: st: predictions from ML program
> To: statalist@hsphsun2.harvard.edu
>
> --- marcel spijkerman  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/

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
*
*   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/



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