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]

st: programming maximum likelihood estimation for specific logistic function


From   Miriam Dietrich <miri.dietrich@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: programming maximum likelihood estimation for specific logistic function
Date   Wed, 8 Aug 2012 20:24:23 +0100

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/


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