[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: R2 stats using statsby or parmby???

From   "Newson, Roger B" <>
To   "''" <>
Subject   st: RE: R2 stats using statsby or parmby???
Date   Fri, 26 Jun 2009 20:07:28 +0100

You do not specify what goodness-of-fit statistic you want, or which program you are using to do your logistic regression (O prefer -glm-, but many other people prefer -logit- or -logistic-). However, if the goodness-of-fit statistic is saved in e(), then either -statsby- or -parmby- can save it. In the case of -parmby-, you use the -escal()- option to save extra scalar results. As in

parmby "glm y x, link(logit) family(bin) eform robust", eform norestore by(group) escal(aic bic chi2 dispers_p)

which should save -e(aic)-, -e(bic)-, -e(chi2)- and -e(dispers_p)- in scalar variables named -es_1-, -es_2-, -es_3-, and -es_4-, respectively. You can give them more informative names using the -rename()- option. Similarly, the -logit- and -logistic- commands save the pseudo-R-squared in -e(r2_p)-.

I hope this helps.

Best wishes


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: [] On Behalf Of Thomas M Holbrook
Sent: 26 June 2009 18:09
Subject: st: R2 stats using statsby or parmby???

I'm trying to find a way the generate goodness-of-fit stats for logit models run separately over subgroups of my my data (I'm running a vote model using individual-level data and I want to generate fit stats by day of the campaign).  I can get the slopes and standard errors using "statsby" or "parmby" but I don't set a way of generating the fit stats.  Any ideas???


Thomas M. Holbrook

Wilder Crane Professor of Government
Department of Political Science
University of Wisconsin-Milwaukee
3210 North Maryland Avenue
Milwaukee, WI  53211

*   For searches and help try:

*   For searches and help try:

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