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

Re: st: -fitstat- after nlogit

From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: -fitstat- after nlogit
Date   Wed, 12 Sep 2007 18:38:55 +0100 (BST)

--- Isaak Bergmann <[email protected]> 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 <[email protected]> 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:

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 )

Hope this helps,

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

Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today* 
*   For searches and help try:

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