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
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
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/
Opinions expressed are those of the author, not of the institution.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Thomas M Holbrook
Sent: 26 June 2009 18:09
To: [email protected]
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???
-Tom
Thomas M. Holbrook
Wilder Crane Professor of Government
Department of Political Science
University of Wisconsin-Milwaukee
3210 North Maryland Avenue
Milwaukee, WI 53211
www.uwm.edu/~holbroot
www.election08data.blogspot.com
414-229-6468
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/