\(R^2\) is the most commonly used measure of overall model fit in OLS regression, providing a single-number summary that might be used to talk about:
whether the overall fit is better or worse than one might expect from the literature.
whether it fits better in one sample versus another.
whether it fits better for one group versus another.
how much fit improves when new variable(s) are added.
For models that are fit using maximum likelihood and not OLS, \(R^2\) no longer applies. Yet the appetite for a 0-to-1 summary of overall model fit has produced many “pseudo-\(R^2\)” measures for maximum-likelihood models.
The biggest point about pseudo-\(R^2\) measures is that there are various different kinds and in practice their values are NOT similar to one another.
For this reason, simply having a row at the bottom of your table labeled “Pseudo-\(R^2\)” is not good practice, but instead you want to say which pseudo-\(R^2\) you are referring to.
McFadden’s pseudo-\(R^2\)
Stata will provide McFadden’s pseudo-\(R^2\) as part of the main output for models fit using maximum likelihood. I assume it is because it is the simplest pseudo-\(R^2\) to calculate, which is not necessarily the same as endorsing it as the best.
The formula is: \[
\textrm{McFadden pseudo-}R^2 = 1 - \frac{\textrm{log-likelihood of model}}{\textrm{log-likelihood of intercept-only model}}
\]
Among different pseudo-\(R^2\) measures, McFadden’s tends to be on the low side—often lower than what one would observe as the \(R^2\) of a similarly motivated OLS model (or, for example, a linear probability model with the same predictors), especially when fit is not great. The Nagelkerke (pseudo-)\(R^2\), which one sees often in SPSS and R, is typically (much) higher. One cannot simply apply intuitions about \(R^2\) when interpreting pseudo-\(R^2\), and with McFadden’s in particular one will sometimes see values that would seem like very low \(R^2\).
Supplemental: Formula for the Nagelkerke pseudo-\(R^2\). The Nagelkerke pseudo-\(R^2\) is related to the simpler Cox & Snell pseudo-\(R^2\). Both may be written using the deviance of a model, which is \(-2\) times its log-likelihood.
\[
\begin{align}
\textrm{Cox \& Snell pseudo-}R^2 & = 1 - \exp({\frac{\textrm{deviance of model} - \textrm{deviance of intercept-only model}}{N}}) \\
\\
\textrm{Nagelkerke pseudo-}R^2 & = \frac{1 - \exp({\frac{\textrm{deviance of model} - \textrm{deviance of intercept-only model}}{N}})}{1 - \exp({\frac{-\textrm{deviance of intercept-only model}}{N}})} \\
\end{align}
\]
Aside: There are critiques of \(R^2\) that usually boil down to the idea that its usefulness for the above purposes may be often exaggerated. We are setting that matter aside here.
Examples
R: Alternative measures of model fit. The DescTools package, which works at least with models fit using glm, polr, or multinom, includes various pseudo-\(R^2\) measures obtained via PseudoR2(modelname, which = "all").
Stata: Alternative measures of model fit. Various other pseudo-\(R^2\) measures are available in Stata using the add-on command \(\texttt{fitstat}\), co-authored once upon a time by yours truly.
Below are goodness-of-fit statistics for models fit on other pages for this course, allowing you to see how pseudo-\(R^2\) values vary among three measures: McFadden’s, Nagelkerke, and McKelvey/Zavoina.
Example of religious nones in General Social Survey
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.0 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.2 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(haven)library(tulaverse)library(DescTools)df <-read_dta("../dta/gss_norelig_thru2018.dta")model <-glm(norelig ~ male + cohort, data = df, family ="binomial")tula(model)