R-squared Value – Why the GLM Function Does Not Return an R^2 Value

r-squared

The lm function in R retrieves an R^2 value.

The glm function, even if applied to a Gaussian family, does not retrieve an R^2 value.

What is/are the reason/reasons for this?

Thank you!

Best Answer

The glm function uses a maximum likelihood estimator (or restricted maximum likelihood). Maximum likelihood does not minimize the squared error (this is called [ordinary] least squares). Sometimes both estimators give the same results (in the linear/ordinary case for normal distributed error terms, see here) but this does not hold in general. Since the coefficient of determination $R^2$ is calculated by ordinary least-squares regression and not by maximum likelihood, there is no reason to display this measure.

PS: Also regard Nick Cox very valid comment below: $R^2$ may be also well-definied and interesting for GLM. My personal experience is that (as so often) some people like/accept it, while others do not.

Related Question