## Can I get r-square in proc GLM with log link and Poisson distribution?

Occasional Learner
Posts: 1

# Can I get r-square in proc GLM with log link and Poisson distribution?

I can get r-square when processing OLS model. But...can I get r-square in proc GLM with log link and Poisson distribution? Here is SAS my code.

proc genmod data=;
model  =  / dist= poisson link=log;

Thank you.

PROC Star
Posts: 188

## Re: Can I get r-square in proc GLM with log link and Poisson distribution?

https://communities.sas.com/t5/SAS-Statistical-Procedures/Calculate-R2-for-mixed-models-Nakagawa-and...

which include links to papers and R code. I would think that code to compute R^2 for a GLMM would also work for a GLM, but I've not tried it. I don't know whether SAS code is available; Steve Denham provides a rough outline of a SAS approach in one of his responses, but no code per se.

Good luck!

Susan

Valued Guide
Posts: 684

## Re: Can I get r-square in proc GLM with log link and Poisson distribution?

Several versions of pseudo-R2 statistics have been proposed for generalized linear models (GLMs). Here is one developed in the 1990s by Cameron and WIndmeijer and by Waldhor. You need to run the procedure twice, once with the covariates (predictor variables, factors) and once without any covariates. Get the Deviance for each model fit (it is printed). Then,

pseduo-R2 = 1 - [Dev_full / Dev_red]

where Dev_full is the deviance for the full model (with all the predictors), and Dev_red is the deviance with no predictors. The argument for this R2 comes from the equivalence of deviances and sums of squares for linear models. You can read more about other approaches in Heinzl and Mittbock (2003; Computational Statistics and Data Analysis 44, pages 253-271).

Discussion stats
• 2 replies
• 305 views
• 2 likes
• 3 in conversation