2

I found that there has been extensive discussion on the invalidity of R-squared for nonlinear models according to its original definition based on the following mathematical analysis,.

The variance in the dependent variable: $$\sum{((Y_i-\bar{Y}))^2} = \sum{((Y_i-\hat{Y_i})+(\hat{Y_i}-\bar{Y}))^2} \\= \sum{(Y_i-\hat{Y_i})^2} + \sum{(\hat{Y_i}-\bar{Y})^2} + 2*\sum{(Y_i-\hat{Y_i})*(\hat{Y_i}-\bar{Y})}$$

In nonlinear models, it is generally not true that the third term, $\sum{(Y_i-\hat{Y_i})(\hat{Y_i}-\bar{Y})}=0$, which is necessary for R-squared to be strictly applicable.

However, in cases where linear models are regularized or the parameters of the linear model are subjectively chosen, $\sum{(Y_i-\hat{Y_i})(\hat{Y_i}-\bar{Y})}$ may not equal zero as well. So, my question is whether R-squared is valid for these linear models?

Alex
  • 83

1 Answers1

0

The R-squared is defined as the mean squared-error (MSE) improvement relative to an intercept-only model.

Thus, it is a natural relative performance measure at least for models with the squared error as loss function. This includes some linear and non-linear models.

Regularization penalties applied to the MSE are not considered during model evaluation on validation/test data, so they do not invalidate the R-squared.

The answer is thus "yes", and it has nothing to do with models being linear or regularized, but rather whether they use the squared error as loss function.

Michael M
  • 11,815
  • 5
  • 33
  • 50
  • I think most related discussion focus on the condition that if SST should be equal to SSE+SSR. If only concerning MSE, why not define the metric to be SSE/SST? In the definition of R-squared, ”SST-SSE“ in the numerator can not be clear interpreted in nonlinear or non-lsq models. – Alex Oct 01 '23 at 04:14
  • Above equation also never holds in out-of-sample applications. Maybe the term "skill score" is worth mentioning. At least from a model evaluation perspective, the question is strange. – Michael M Oct 01 '23 at 06:03
  • Yes, that's why I understand that there is also controversy about how R-squared should be defined in out-of-sample applications. https://stats.stackexchange.com/questions/228540/how-to-calculate-out-of-sample-r-squared. R-squared was originally defined in statistics only for the evaluation of in-sample regression – Alex Oct 01 '23 at 09:27
  • It is roughly defined as $1- MSE(test)/MSE_0(test)$, where the denominator is (ideally) computed wrt the training average. This remembers me of a blog post that I have always wanted to write about it ;-). – Michael M Oct 01 '23 at 09:30
  • Instead of the training average, the out-of-sample R-squared is also defined as a comparison of two out-of-sample models from the above link and this provided reference:

    Hawinkel, Stijn, Willem Waegeman, and Steven Maere. "Out-of-sample R 2: estimation and inference." The American Statistician just-accepted (2023): 1-16.

    – Alex Oct 01 '23 at 09:36