Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: MLE for each day


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: MLE for each day
Date   Thu, 21 Oct 2010 11:30:38 +0100

I strongly support Maarten's stance here. People who post unanswerable questions are, in the first instance, wasting their own time and delaying the receipt of good advice. 

On a matter of detail, note that -levels- leaves in its wake r(levels), not r(varlist). Thus the recipe should be 

levelsof day
foreach day in `r(levels)' {
    ml model lf my_prog_lf (y=x) (x2) ... if day == `day', maximize
}

Nick 
[email protected] 

Maarten buis

--- On Thu, 21/10/10, Beatrice Crozza wrote:
> I wrote a maximum likelihood with the lf method.
> 
> Now, I want to tell Stata to do the maximum likelihood for
> each day in my sample (each day is divided in time intervals).
> 
> How can I do this?
> 
> I tried foreach at the beginning of the program but doesn'
> t work.

Doesn't work is not informative enough, we need to know 
exactly what you typed, what you expected Stata to return, 
and what Stata actually did return.

Given what you told us I can only give you this pseudo-code
that you might or might not be able to adjust to your 
problem

levelsof day
foreach day in `r(varlist)' {
    ml model lf my_prog_lf (y=x) (x2) ... if day == `day', maximize
}


*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index