[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: -by- in ML
Thanks for the quick reply. I should probably elaborate.
The data is already sorted by "us_id". The ML command actually does not give me
any error. What happens is that it tells me the log likelihood is always 0.
Thus, I know there's a problem.
Thanks in advance.
Quoting "Wallace, John" <John_Wallace@affymetrix.com>:
> Your example doesn't explictly contain a -sort- command for your
> variable "us_id", which might be the problem. -By:- needs to have the
> dataset sorted, you can do this on the fly by replacing it with
> -bysort:-. To get more information from Stata, you might try using the
> -capture- command to trap the error code that would have been returned
> in interactive mode.
> Hope this helps
> -John W
> -----Original Message-----
> From: email@example.com
> [mailto:firstname.lastname@example.org] On Behalf Of
> Sent: Monday, June 06, 2005 2:31 PM
> To: email@example.com
> Subject: st: -by- in ML
> Here is my code:
> program mylogit2
> version 8.0
> args todo b lnf
> tempvar theta1 a c group_sum last
> mleval `theta1' = `b', eq(1)
> quietly gen double `a' = exp(`theta1')/(1+exp(`theta1'))
> quietly gen double `c' = 1/(1+exp(`theta1'))
> by us_id: gen double `group_sum' = sum(ln(`a'^($ML_y1) *
> by us_id: gen double `last' = (_n==_N)
> mlsum `lnf' = `group_sum' if `last'
> ml model d0 mylogit2 (y = x1 x2)
> ml check
> ml search
> ml maximize
> * 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/
* For searches and help try: