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]

st: RE: ML for logit/ologit


From   "David Radwin" <[email protected]>
To   <[email protected]>
Subject   st: RE: ML for logit/ologit
Date   Tue, 15 Nov 2011 08:51:38 -0800 (PST)

I don't know if this is causing the problem or not, but in your first
program, you are using a straight single quotation mark (') at the
beginning of each macro, but instead you should use a backtick (`). The
second program uses the correct character for macros.

See also: http://www.stata.com/statalist/archive/2008-02/msg01065.html

David
--
David Radwin
Research Associate
MPR Associates, Inc.
2150 Shattuck Ave., Suite 800
Berkeley, CA 94704
Phone: 510-849-4942
Fax: 510-849-0794

www.mprinc.com


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Thomas Murray (Department
of
> Economics)
> Sent: Tuesday, November 15, 2011 8:28 AM
> To: [email protected]
> Subject: st: ML for logit/ologit
>
> Dear Statalisters,
>
> I need to use the ML function to create a program for an ordered logit
> log likelihood function.  Before writing the code for the ologit model
> I've been trying to practice with a computationally simpler logit
> regression.  This is what I've written so far:
>
>
> program define logittest
> version 12.0
> args lnf xb
> tempvar lng
> qui {
> gen double 'lng' = ln(invlogit( 'xb')) if $ML_y1 == 1
> replace 'lng' = ln(invlogit(-'xb')) if $ML_y1 == 0
> replace 'lnf' = 'lng'
> }
> end
>
> However, the model I wish to estimate is not simply y = a + bx.
>
> I want to estimate the following: y = a + b((x^(1-ρ)-1)/(1-ρ))
>
> where ρ is a parameter to be determined.
>
> I have been trying to incorporate this into the logit code above (by
> replacing the xb function) along the lines of:
>
> program drop logittest
> program define logittest
> version 12.0
> args lnf b1 x rho
> tempvar lng
> qui {
> gen double `lng' = ln(invlogit(`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if
> $ML_y1==1
> replace `lng' =  ln(invlogit(-`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if
> $ML_y1==0
> replace `lnf' = `lng'
> }
> end
>
> ml model lf logittest ( y = x)
> ml max
>
> However I get the error 'unknown function ^()' - it doesn't like my
> attempted manipulation of x using powers.
>
> My question - is it possible to impose this particular form of x into a
> logit (or ordered logit) function?  Am I just making a computational
> mistake in my programming language?
>
> Many thanks in advance of any help offered.
>
> Tom Murray,
> University of Birmingham

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