# Pseudo-R-squared

Pseudo-R-squared values are used when the outcome variable is nominal or ordinal such that the coefficient of determination R$^2$ cannot be applied as a measure for goodness of fit and when a likelihood function is used to fit a model.
In linear regression, the squared multiple correlation, R$^2$ is used to assess goodness of fit as it represents the proportion of variance in the criterion that is explained by the predictors. In logistic regression analysis, there is no agreed upon analogous measure, but there are several competing measures each with limitations.
Four of the most commonly used indices and one less commonly used one are examined in this article:
* Likelihood ratio R$^2$$_L$
* Cox and Snell R$^2$$_{CS}$
* Nagelkerke R$^2$$_N$
* McFadden R$^2$$_{McF}$
* Tjur R$^2$$_T$

## R$^2$$_L$ by Cohen

R$^2$$_L$ is given by Cohen:
       $R_{\text{L}}^{2}={\frac {D_{\text{null}}-D_{\text{fitted}}}{D_{\text{null}}}}.$
This is the most analogous index to the squared multiple correlations in linear regression. It represents the proportional reduction in the deviance wherein the deviance is treated as a measure of variation analogous but not identical to the variance in linear regression analysis. One limitation of the likelihood ratio R$^2$ is that it is not monotonically related to the odds ratio, meaning that it does not necessarily increase as the odds ratio increases and does not necessarily decrease as the odds ratio decreases.

## R$^2$$_{CS}$ by Cox and Snell

R$^2$$_{CS}$ is an alternative index of goodness of fit related to the R$^2$ value from linear regression. It is given by:
       ${\begin{aligned}R_{\text{CS}}^{2}&=1-\left({\frac {L_{0}}{L_{M}}}\right)^{2/n}\\[5pt]&=1-\exp \left({\frac {2}{n}}(\ln(L_{0})-\ln(L_{M}))\right)\end{aligned}}$
where L$_M$ and L$_0$ are the likelihoods for the model being fitted and the null model, respectively. The Cox and Snell index corresponds to the standard R$^2$ in case of a linear model with normal error. In certain situations, R$^2$$_{CS}$ may be problematic as its maximum value is $1-L_{0}^{2/n}$. For example, for logistic regression, the upper bound is $R_{\text{CS}}^{2}\leq 0.75$ for a symmetric marginal distribution of events and decreases further for an asymmetric distribution of events.

## R$^2$$_N$ by Nagelkerke

R$^2$$_N$, proposed by Nico Nagelkerke in a highly cited Biometrika paper, provides a correction to the Cox and Snell R$^2$ so that the maximum value is equal to 1. Nevertheless, the Cox and Snell and likelihood ratio R$^2$s show greater agreement with each other than either does with the Nagelkerke R$^2$. Of course, this might not be the case for values exceeding 0.75 as the Cox and Snell index is capped at this value. The likelihood ratio R$^2$ is often preferred to the alternatives as it is most analogous to R$^2$ in linear regression, is independent of the base rate (both Cox and Snell and Nagelkerke R$^2$s increase as the proportion of cases increase from 0 to 0.5) and varies between 0 and 1.

## R$^2$$_{McF}$ by McFadden

The pseudo R$^2$ by McFadden (sometimes called likelihood ratio index) is defined as
       $R_{\text{McF}}^{2}=1-{\frac {\ln(L_{M})}{\ln(L_{0})}},$
and is preferred over R$^2$$_{CS}$ by Allison. The two expressions R$^2$$_{McF}$ and R$^2$$_{CS}$ are then related respectively by,
       ${\begin{matrix}R_{\text{CS}}^{2}=1-\left({\dfrac {1}{L_{0}}}\right)^{\frac {2(R_{\text{McF}}^{2})}{n}}\\[1.5em]R_{\text{McF}}^{2}=-{\dfrac {n}{2}}\cdot {\dfrac {\ln(1-R_{\text{CS}}^{2})}{\ln L_{0}}}\end{matrix}}$

## R$^2$$_T$ by Tjur

Allison prefers R$^2$$_T$ which is a relatively new measure developed by Tjur. It can be calculated in two steps:
* For each level of the dependent variable, find the mean of the predicted probabilities of an event.
* Take the absolute value of the difference between these means

## Interpretation

A word of caution is in order when interpreting pseudo-R$^2$ statistics. The reason these indices of fit are referred to as pseudo R$^2$ is that they do not represent the proportionate reduction in error as the R$^2$ in linear regression does. Linear regression assumes homoscedasticity, that the error variance is the same for all values of the criterion. Logistic regression will always be heteroscedastic – the error variances differ for each value of the predicted score. For each value of the predicted score there would be a different value of the proportionate reduction in error. Therefore, it is inappropriate to think of R$^2$ as a proportionate reduction in error in a universal sense in logistic regression.