Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -fitstat- after nlogit


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -fitstat- after nlogit
Date   Wed, 12 Sep 2007 18:38:55 +0100 (BST)

--- Isaak Bergmann <Isaak_Bergmann@web.de> wrote:
> > I would like to get some scalar measures of fit, like the McFadden
> > Rsquared, after nlogit. Fitstat does not work after nlogit, at
> > least in STATA 10. 
 

--- Maarten buis <maartenbuis@yahoo.co.uk> wrote: 
> Some measures of fit can be obtained using -estimates stat- after
> -nlogit-.

You can get the pseudo r-squares if you can define a model with
constants only by applying the formulas in:
http://www.ats.ucla.edu/stat/mult_pkg/faq/general/Psuedo_RSquareds.htm

Defining this null model can sometimes be a bit tricky in these types
of models and I haven't thought it through enough to be entirely sure
(and I won't, so it is up to you to verify that my suggestion makes
sense) but the example below seems to implement these formulas:

*---------------------- begin example --------------------
webuse restaurant, clear

nlogitgen type = restaurant(fast: Freebirds | MamasPizza, ///
family: CafeEccell | LosNortenos | WingsNmore,            ///
fancy: Christophers | MadCows)

nlogittree restaurant type, choice(chosen)

nlogit chosen cost distance rating ||                     ///
type: income kids, base(family)  ||                       ///
restaurant:,  case(family_id) noconst
local ll_full = e(ll)
local K = e(rank)
local N = e(N)

nlogit chosen ||                                          ///
type: , base(family) ||                                   ///
restaurant:, case(family_id)
local ll_0 = e(ll)

di as txt "McFadden's pseudo R2: "                        ///
as result %9.3f 1-`ll_full'/`ll_0'
di as txt "adjusted  McFadden's pseudo R2: "              ///
as result %9.3f 1-(`ll_full'-`K')/`ll_0'
di as text "Cox Snell pseudo R2: "                        ///
as result %9.3f 1 - (exp(`ll_0')/exp(`ll_full'))^(2/`N')
di as text "Nagelkerke Cragg & Uhler's pseudo R2: "       ///
as result %9.3f (1 - (exp(`ll_0')/exp(`ll_full'))^(2/`N')) ///
/ (1-exp(`ll_0')^(2/`N'))
*------------------------- end example -------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index