help r2c-------------------------------------------------------------------------------TitleComputes several goodness of fit measures for count data models

Syntax

r2c[,NODpNOOffsetadjNOSummarize]

Description

r2cgenerates 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 thedevr2command forglm; findit devr2).r2calso 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. Ther2ccommand is specific to count data models but covers most built-in count data commands. At current,r2cworks only with the built-in commandspoisson,tpoisson,zip,nbreg,tnbreg,gnbreg,zinb, andglm(withglm,r2cworks only for count-based variance functionsfamily(poisson)andfamily(nbinomial)and assumes the defaultlink(log)).

r2cadjusts fit statistics automatically for sample weights (see[R]weight) as well as offset and exposure variables (see estimation options).r2calso does not currently accept thesvyormiprefixes. Probability weighted models must use thecommand depvar indepvars[pw=weight] syntax.

nodpsuppresses 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 withtnbregand zero-inflation withzinb.

nooffsetadjoverrides the default constant-only model adjustment for the inclusion of an offset or exposure variable.

nosummarizeoverrides the default display of the summarize command with detail option for the dependent variable before r-squared results.

Saved results

r2csaves the following results inr():Scalars

r(dev_r2)Deviance-based R2r(dev_r2)Bias-adjusted Deviance-based R2r(pear_r2)Pearson deviance-based R2r(corr_r2)Squared correlation between observed and predicted valuesr(exp_r2)Ratio of sums of squared differences between predicted vs. mean observed values over observed vs. mean observed valuesr(modeldev)Deviance based on full modelr(constdev)Deviance based on constant only modelr(modelpear)Pearson deviance based on full modelr(constpear)Pearson deviance based on constant only modelr(expvar)Predicted value variancer(dp_r2)Ratio of the deviance for a fitted negative binomial model over the deviance for a constant-only Poisson modelr(modeldp)DP deviance based on full model compared to saturated Poissonr(constdp)DP deviance based on constant only model compared to saturated Poisson

Introductory examplesTo illustrate how

r2cworks 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

ReferencesCameron, 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.ComputationalStatistics & Data Analysis, 44(1-2), 253-271.

AuthorJoseph 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.