Computes several goodness of fit measures for count data models
Syntax
r2c [, NODp NOOffsetadj NOSummarize]
Description
r2c generates r-squared fit statistics based on deviance, pearson deviance, squared correlation, and predicted value sums of squares. Cameron and Windmeijer (1996) recommend the use of the deviance-based R2 (which produces identical results to the devr2 command for glm; findit devr2). r2c also produces an adjusted deviance-based r-squared metric based on Heinzl and Mittlböck (2003). The negative binomial adjustment is based on an overdispersed Poisson model. The r2c command is specific to count data models but covers most built-in count data commands. At current, r2c works only with the built-in commands poisson, tpoisson, zip, nbreg, tnbreg, gnbreg, zinb, and glm (with glm, r2c works only for count-based variance functions family(poisson) and family(nbinomial) and assumes the default link(log)).
r2c adjusts fit statistics automatically for sample weights (see [R] weight) as well as offset and exposure variables (see estimation options). r2c also does not currently accept the svy or mi prefixes. Probability weighted models must use the command depvar indepvars [pw= weight] syntax.
nodp suppresses the scaled deviance-based R2 measure comparing a the fitted negative binomial model with Poisson model specification. The DP R2 is a ratio of the deviance of the full negative binomial model being fitted from a saturated Poisson model over the deviance of the constant-only Poisson from a saturated Poisson. The DP R2 then allows for a direct comparison between negative binomial and Poisson models (see Cameron and Windmeijer, 1996; for details). As Cameron and Windmeijer note, a large DP R2 would be expected in cases where there is a substantial alpha (NB2; dispersion(mean)) or delta (NB1; dispersion(constant)) value, as large alpha/delta values represent substantial overdispersion. It is worth noting that the DP R2 baseline poisson model is adjusted for truncation with tnbreg and zero-inflation with zinb.
nooffsetadj overrides the default constant-only model adjustment for the inclusion of an offset or exposure variable.
nosummarize overrides the default display of the summarize command with detail option for the dependent variable before r-squared results.
Saved results
r2c saves the following results in r():
Scalars r(dev_r2) Deviance-based R2 r(dev_r2) Bias-adjusted Deviance-based R2 r(pear_r2) Pearson deviance-based R2 r(corr_r2) Squared correlation between observed and predicted values r(exp_r2) Ratio of sums of squared differences between predicted vs. mean observed values over observed vs. mean observed values r(modeldev) Deviance based on full model r(constdev) Deviance based on constant only model r(modelpear) Pearson deviance based on full model r(constpear) Pearson deviance based on constant only model r(expvar) Predicted value variance r(dp_r2) Ratio of the deviance for a fitted negative binomial model over the deviance for a constant-only Poisson model r(modeldp) DP deviance based on full model compared to saturated Poisson r(constdp) DP deviance based on constant only model compared to saturated Poisson
Introductory examples
To illustrate how r2c works click on colored text below:
. webuse auto
* r2c following traditional Poisson regression.
. poisson price mpg rep78 headroom
. r2c
* r2c following negative binomial (NB1 or constant dispersion method)
. nbreg price mpg rep78 headroom, dispersion(constant)
. r2c, nosummarize
References
Cameron, A. C. & Windmeijer, F. A. G. (1996). R-squared measures for count data regression models with applications to health-care utilization. Journal of Business & Economic Statistics, 14(2), 209-220. Heinzl, H. & Mittlböck, M. (2003). Pseudo R-squared measures for Poisson regression models with over- or under-dispersion. Computational Statistics & Data Analysis, 44(1-2), 253-271.
Author
Joseph N. Luchman Senior Research Associate Fors Marsh Group LLC Arlington, VA jluchman@forsmarshgroup.com
Also see
[R] poisson, [R] zip, [R] tpoisson, [R] nbreg, [R] gnbreg, [R] tnbreg, [R] zinb, [R] glm.