I came up with below for my glm analysis but I need to calculate R-squared to cite in the paper? anyone can help me with this please?



glm(formula = cbind(CumNumberTakeOff, CumNumberNOTakeOff) ~ Sex + 
    PlantQuality + Minlog + Temperature + Temperaturetm + +Temperature:Sex + 
    Temperature:PlantQuality + Sex:PlantQuality + Minlog:PlantQuality, 
    family = binomial, data = expdataNo20)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.3724  -0.6914  -0.2577  -0.0168   3.1202  


                             Estimate Std. Error z value Pr(>|z|)    
(Intercept)                 -38.04288    2.22259 -17.116  < 2e-16 ***
SexMale                      10.20370    1.78445   5.718 1.08e-08 ***
PlantQualityF/W              19.99712    1.84748  10.824  < 2e-16 ***
Minlog                        1.01936    0.04873  20.918  < 2e-16 ***
Temperature                   1.21796    0.08583  14.191  < 2e-16 ***
Temperaturetm                -0.52639    0.02479 -21.235  < 2e-16 ***
SexMale:Temperature          -0.35374    0.06807  -5.197 2.03e-07 ***
PlantQualityF/W:Temperature  -0.68000    0.07118  -9.553  < 2e-16 ***
SexMale:PlantQualityF/W      -1.13717    0.17008  -6.686 2.29e-11 ***
PlantQualityF/W:Minlog       -0.38413    0.06478  -5.930 3.03e-09 ***
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)


3 Answers 3


Zheng, B. and A. Agresti. 2000. Summarizing the predictive power of a generalized linear model. Statistics in Medicine 19: 1771–1781 gave guarded recommendation of the square of the correlation between observed and predicted responses as a measure that can be applied to generalized linear model results. You need to read the paper before you can fairly dismiss it.

For example, consider a logit or logistic regression. The observed outcome is a (0, 1) indicator variable. The predicted outcomes are probabilities between 0 and 1. So, we can calculate the correlation between observed and predicted outcomes and square it. An advantage for many researchers (and their readers) is that they are already familiar with ideas of correlation and $R^2$. A disadvantage is that this measure doesn't correspond to figures of merit (e.g. likelihood) used by typical logit routines in fitting or reporting fits. But so long as the $R^2$ measure is treated as mostly descriptive or heuristic, no great harm is done.

Watch out: for every statistical person who thinks this measure might be of some use or interest, there is likely to be another statistical person who thinks it is bogus, misconceived, and the work of the devil. The other answers are all firm, not to say dogmatic, that there is little or no use for such a measure, but here is a paper in a well-regarded journal saying the opposite.

There would perhaps be wider agreement that taking $R^2$ beyond classical linear regression is fraught with various analytical and practical perils. In fact, using $R^2$ within classical linear regression is fraught with perils -- as sometimes useless models enshrining banal or nearly tautological results show high $R^2$ and sometimes interesting or helpful models show low $R^2$. In many fields of social or medical science, for example, high $R^2$ would be suspect as pointing to a very silly question, a ridiculously over-fitted model, or at worst faked data.

  • $\begingroup$ I give examples here (look at the images) showing the danger of doing this, though, in the hands of a user who understands these limitations, I can see such a squared correlation as being a reasonable and interpretable measure of discrimination, somewhat analogous to area under the ROC curve. $\endgroup$
    – Dave
    Nov 23, 2023 at 19:46

There is no R-squared for GLMs.

Closest thing are so-called "pseudo-R-squared" statistics derived from the deviance and/or likelihood.


  • 1
    $\begingroup$ This answer is over-simplified and even wrong, but I will let my answer state the case. My edits are cosmetic only. $\endgroup$
    – Nick Cox
    Nov 24, 2023 at 9:52

As @Analyst noted, there is no R-Squared for logistic regression. While there are several 'pseudo-R-squared' options available, I would advise against using them - there are simply too many and none of them properly get at the issue you are trying to solve. Remember that the purpose of logistic regression is different from OLS regression. In the latter, you minimize the squared error, and the R^2 is conceptually straightforward - the total % variance accounted for by the model. In contrast, logistic regression seeks classification accuracy. This can be assessed numerically in several ways, using such metrics as AUC (area under the ROC curve), confusion matrices, positive predictive value (PPV), etc, etc. For AUC/ROC, I suggest you look into R package 'pROC'. For confusion matrices, PPV, etc., try R package 'caret'.


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