Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Ado file for multinomial logit model


From   John Hendrickx <[email protected]>
To   [email protected]
Subject   Re: st: Ado file for multinomial logit model
Date   Mon, 26 Aug 2002 03:26:13 -0700 (PDT)

Hello Thitima,

You might want to check out -mcl- available at SSC. It uses the
conditional logit model to estimate a multinomial logit model. This
gives you more flexibility, it might be enough for your purposes.

If not, here's an example of how to estimate a multinomial logit
model using -ml-. I've tried several variations, I'm not sure if this
is the most elegant or most efficient. In any case, it might help you
along. The -logan- dataset is available as part of the -mcl- package.

-----------------------------------------------
*et rmsg on
use logan

program define mlr
  args lnf eta2 eta3 eta4 eta5
  tempvar pi1 pi2 pi3 pi4 pi5
  quietly {
    gen double
`pi1'=1/(1+exp(`eta2')+exp(`eta3')+exp(`eta4')+exp(`eta5'))
    gen double `pi2'=exp(`eta2')*`pi1'
    gen double `pi3'=exp(`eta3')*`pi1'
    gen double `pi4'=exp(`eta4')*`pi1'
    gen double `pi5'=exp(`eta5')*`pi1'
    replace `lnf'=($ML_y1==1)*ln(`pi1')+ /*
               */ ($ML_y1==2)*ln(`pi2')+ /*
               */ ($ML_y1==3)*ln(`pi3')+ /*
               */ ($ML_y1==4)*ln(`pi4')+ /*
               */ ($ML_y1==5)*ln(`pi5')
  }
end

ml model lf mlr (occ2: educ black) /*
*/ (occ3: educ black) (occ4: educ black) (occ5: occ=educ black)
ml maximize 
-----------------------------------------------

Hope this helps,
John Hendrickx


--- PUTTITANUN  THITIMA <[email protected]> wrote:
> Dear Statalists,
>     I'm trying to find ado file for multinomial logit model so that
> I can
> modify it to fit my research. I know that there is a built-in
> command for
> the multinomial logit model and wondering if anyone has written ado
> file
> for it? Or if anyone know where I can look up so I can try to
> replicate
> the work before I modify it?
> 
> Thank you very much in advance,
> Thitima Puttitanun
> 
> *
> *   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/


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index