Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: programming maximum likelihood estimation for specific logistic function


From   Matthew Baker <matthew.baker@hunter.cuny.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: programming maximum likelihood estimation for specific logistic function
Date   Wed, 8 Aug 2012 19:23:20 -0400

Miriam --

It looks to me like you just need to specify a second variable in the
"model" statement. That is:

ml model lf mylogit ( bserved= titfortat) ()

instead of

ml model lf mylogit ( bserved= titfortat)

Best,

Matt Baker

On Wed, Aug 8, 2012 at 3:24 PM, Miriam Dietrich <miri.dietrich@gmail.com> wrote:
> Hello,
>
> I want to run a maximum likelihood estimation of the following
> logistic function:
>
> L=ππ(1/(1+e^(-x/variance) ))^y (1/(1+e^(x/variance) ))^(1-y)
>
> And this is what I wrote in Stata:
>
> program define mylogit
> 1.
> . args lnf mu sigma
> 2.
> . quietly replace `lnf' = -ln(1+exp(-`mu'/`sigma')) if $ML_y1==1
> 3.
> . quietly replace `lnf' =-ln(1+exp(`mu'/`sigma')) if $ML_y1==0
> 4.
> . end
> . ml model lf mylogit ( bserved= titfortat)
> . ml maximize
>
> The problem is that Stata gives me an error message saying invalid name.
>
> I have also tried a couple of variations to understand what the
> problem might be. It works if I use:
> quietly replace `lnf' = -ln(1+exp(-`Xb')) if $ML_y1==1
> but if i use quietly replace `lnf' = -ln(1+exp(-`Xb'/`sigma')) if
> $ML_y1==1 it says unknown function.
>
> Does anyone has any ideas?
>
> Thank you very much for your help in advanced.
>
> Miriam
>
> *
> *   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/



-- 
Dr. Matthew J. Baker
Department of Economics
Hunter College and the Graduate Center, CUNY

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index