I found a formula for pseudo $R^2$ in the book Extending the Linear Model with R, Julian J. Faraway (p. 59).


Is this a common formula for pseudo $R^2$ for GLMs?


4 Answers 4


There are a large number of pseudo-$R^2$s for GLiMs. The excellent UCLA statistics help site has a comprehensive overview of them here. The one you list is called McFadden's pseudo-$R^2$. Relative to UCLA's typology, it is like $R^2$ in the sense that it indexes the improvement of the fitted model over the null model. Some statistical software, notably SPSS, if I recall correctly, print out McFadden's pseudo-$R^2$ by default with the results from some analyses like logistic regression, so I suspect it is quite common, although the Cox & Snell and Nagelkerke pseudo-$R^2$s may be even more so. However, McFadden's pseudo-$R^2$ does not have all of the properties of $R^2$ (no pseudo-$R^2$ does). If someone is interested in using a pseudo-$R^2$ to understand a model, I strongly recommend reading this excellent CV thread: Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? (For what it's worth, $R^2$ itself is slipperier than people realize, a great demonstration of which can be seen in @whuber's answer here: Is $R^2$ useful or dangerous?)

  • 1
    $\begingroup$ I wonder if all these pseudo-R2s have been designed specifically for logistic regression only? Or do they generalize also for poisson and gamma-glms? I found different R2-formula for each possible GLM in Colin Cameron, A., & Windmeijer, F. A. (1997). An R-squared measure of goodness of fit for some common nonlinear regression models. Journal of Econometrics, 77(2), 329-342. $\endgroup$
    – Jens
    Nov 4, 2014 at 11:30
  • $\begingroup$ @Jens, some of them certainly seem LR specific, but other use the deviance, which you could get from any GLiM. $\endgroup$ Nov 4, 2014 at 14:22
  • 1
    $\begingroup$ Note that McFadden's $R^2$ is often defined in terms of the log-likelihood, which is only defined up to an additive constant, and not the deviance as in the OP's question. Without a specification of the additive constant, McFadden's $R^2$ is not well defined. The deviance is one unique choice of the additive constant, which in my mind is the most appropriate choice, if the generalisation should be comparable with $R^2$ from linear models. $\endgroup$
    – NRH
    Feb 26, 2016 at 7:57
  • $\begingroup$ Given that GLMs are fit using iteratively reweighted least squares, as in bwlewis.github.io/GLM, what would be the objection actually of calculating a weighted R2 on the GLM link scale, using 1/variance weights as weights (which glm gives back in the slot weights in a glm fit)? $\endgroup$ Jun 11, 2019 at 13:16
  • 1
    $\begingroup$ @gung I put a reproducible example as a separate question here so you can see what I mean : stats.stackexchange.com/questions/412580/… $\endgroup$ Jun 11, 2019 at 22:10

R gives null and residual deviance in the output to glm so that you can make exactly this sort of comparison (see the last two lines below).

> x = log(1:10)

> y = 1:10

> glm(y ~ x, family = poisson)

>Call:  glm(formula = y ~ x, family = poisson)

(Intercept)            x  
  5.564e-13    1.000e+00  

Degrees of Freedom: 9 Total (i.e. Null);  8 Residual
Null Deviance:      16.64 
Residual Deviance: 2.887e-15    AIC: 37.97

You can also pull these values out of the object with model$null.deviance and model$deviance

  • $\begingroup$ Ah, okay. I was just answering the question as written. I'd have added more, but I'm not 100% sure how the null deviance is calculated myself (it has something to do with a saturated model's log likelihood, but I don't remember enough of the details about saturation to be confident that I could give good intuitions) $\endgroup$ Jun 8, 2011 at 20:20
  • $\begingroup$ I don't have it in the glm output (family possion or quasipoisson). $\endgroup$
    – Tomas
    Dec 10, 2013 at 9:03
  • $\begingroup$ @Tomas see my edits. I don't know if I was mistaken 2 years ago or if the default output has changed since then. $\endgroup$ Dec 10, 2013 at 21:07
  • $\begingroup$ Tomas the information is produced by summary.glm. As for whether that definition of an $R^2$ is common would require some kind of survey. I would say it's not especially rare, in that I've seen it before, but not something that is necessarily widely used. $\endgroup$
    – Glen_b
    Dec 10, 2013 at 22:09
  • 1
    $\begingroup$ Read the question. Do you think you answer it? The question was not "where can I get the components of the formula?". $\endgroup$
    – Tomas
    Jan 22, 2014 at 21:24

The formula you proposed have been proposed by Maddala (1983) and Magee (1990) to estimate R squared on logistic model. Therefore I don't think it's applicable to all glm model (see the book Modern Regression Methods by Thomas P. Ryan on page 266).

If you make a fake data set, you will see that it's underestimate the R squared...for gaussian glm per example.

I think for a gaussian glm you can use the basic (lm) R squared formula...

R2gauss<- function(y,model){
    N<- length(y)
    SSres<- sum((y-predict(model))^2)

And for the logistic (or binomial family in r ) I would use the formula you proposed...

    R2logit<- function(y,model){
    R2<- 1-(model$deviance/model$null.deviance)

So far for poisson glm I have used the equation from this post.


There is also a great article on pseudo R2 available on researchs gates...here is the link:


I hope this help.

  • $\begingroup$ Just fit a GLM model with family=gaussian(link=identity) and check the value of 1-summary(GLM)$deviance/summary(GLM)$null.deviance and you will see that the R2 does match the R2 value of a regular OLS regression, so the above answer is correct! See also my post here - stats.stackexchange.com/questions/412580/… $\endgroup$ Jun 16, 2019 at 6:07

The R package modEvA calculates D-Squared as 1 - (mod$deviance/mod$null.deviance) as mentioned by David J. Harris

data <- data.frame(y=rpois(n=10, lambda=exp(1 + 0.2 * x)), x=runif(n=10, min=0, max=1.5))

mod <- glm(y~x,data,family = poisson)

1- (mod$deviance/mod$null.deviance)
[1] 0.01133757
[1] 0.01133757

The D-Squared or explained Deviance of the model is introduced in (Guisan & Zimmermann 2000) https://doi.org/10.1016/S0304-3800(00)00354-9


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.