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: programming maximum likelihood estimation for specific logistic function
From
Miriam Dietrich <[email protected]>
To
[email protected]
Subject
Re: st: programming maximum likelihood estimation for specific logistic function
Date
Thu, 9 Aug 2012 21:12:48 +0100
Hi Matt,
Thank you very much for your reply. It did work.
Best wishes,
Miriam
2012/8/9 Matthew Baker <[email protected]>:
> 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 <[email protected]> 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/
*
* 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/