# Re: st: -fitstat- after nlogit

 From Maarten buis 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,            ///

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

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