Skip to main content
edits are cosmetic corrections (and suggestions) only
Source Link
Nick Cox
  • 59.5k
  • 8
  • 136
  • 212
  1. $\left[\text{corr}\left(y, \hat y\right)\right]^2$

  2. The proportion of total variance that is explained by the regression model

  3. The percent reduction in square loss comparing the model towith a benchmark that always predicts the overall mean, $\bar y$, that is, $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $. This is a special case of the $R^*$ defined in equation (32) of Gneiting and Resin (2023), which they assert as a universal coefficient of determination.

"Proportion of variance explained" is a bit tricky in all but the simplest of models (OLS linear regssionregression evaluated in-sample), since that isbecause those are the only times when a decomposition of the total sum of squares yielding that interpretation is guaranteed to hold. However, calculating the squared correlation between true $y$ and predicted $\hat y$ is easy enough, and calculating $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $ looks worse than it is, and we have a computer to do the heavy lifting, anyway.

However, these are not equivalent in all situations. That nasty fraction has the interpretation of comparing the square loss of your model towith that of a naïve benchmark that always predicts the conditional mean to be the marginal/pooled/overall mean. I find it reasonable to want the data science team to be better at predicting than a middle school student would do by running AVERAGE(A:A), to use some Excel terminology, and going with that value every time. That calculation flags such situations with values below zero, indicating quite poor performance.

The predictions, at least in terms of square loss, are much worse than predicingpredicting $\bar y = 2$ every time. I give additional examples of this here and here.

Mean squared error, on the other hand, detects all deviations between true and predicted values. If the prediction is not exactly the same as its corresponding true value, there is a penalty. However, mean squared error does not make an explicit comparison towith any kind of benchmark. One most certainly can say something like, "The current state of the art achieves a mean squared error of 11, so our mean squared error of 3 represents a considerable improvement," but I have seen plenty of work where all that gets reported are their results without any comparison towith the performance of a benchmark or competitor, not even a naïve benchmark like, "Predict the overall mean every time."

What Pearson correlation gives you that is not as explicit in the mean squared error, however, is a sense of how tellwell the model is able to distinguish between distinct values. For instance, if $y=(1, 2, 3)$ and $\hat y = (11, 21, 31)$, the predictions are flawed, but the model has good ability to distinguish between distinct observed values. Pearson correlation can be seen as a measure of pure predictive discrimination, similar to how area under the receiver operator characteristic curve gives a sense of how well the two categories of a "classification" problem are distinguished from each other. Thus, Pearson correlation is not totally worthless. As you pointed out, despite the flaws of Pearson correlation, it is effective at determining if the model predicts high values when the true values are high and low values when the true values are low (ditto for Spearman correlation).

AddressigAddressing a few more pieces from the question:

This gets tricky, because there is not a universal sense of what constitutes good and bad performance that can be thought of like grades in school where a $90\%$ is an A that makes us happy and a $50\%$ is an F that makes us sad.$^{\dagger}$ I would say that the way to evaluate if a model is performing poorly is to compare it towith the performance of a competitor or if the predictions are good enough to help you solve your overall task (the latter of which might be quite difficult to assess).

  1. $\left[\text{corr}\left(y, \hat y\right)\right]^2$

  2. The proportion of total variance that is explained by the regression model

  3. The percent reduction in square loss comparing the model to a benchmark that always predicts the overall mean, $\bar y$, that is, $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $. This is a special case of the $R^*$ defined in equation (32) of Gneiting and Resin (2023), which they assert as a universal coefficient of determination.

"Proportion of variance explained" is a bit tricky in all but the simplest of models (OLS linear regssion evaluated in-sample), since that is those are the only times when a decomposition of the total sum of squares yielding that interpretation is guaranteed to hold. However, calculating the squared correlation between true $y$ and predicted $\hat y$ is easy enough, and calculating $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $ looks worse than it is, and we have a computer to do the heavy lifting, anyway.

However, these are not equivalent in all situations. That nasty fraction has the interpretation of comparing the square loss of your model to that of a naïve benchmark that always predicts the conditional mean to be the marginal/pooled/overall mean. I find it reasonable to want the data science team to be better at predicting than a middle school student would do by running AVERAGE(A:A), to use some Excel terminology, and going with that value every time. That calculation flags such situations with values below zero, indicating quite poor performance.

The predictions, at least in terms of square loss, are much worse than predicing $\bar y = 2$ every time. I give additional examples of this here and here.

Mean squared error, on the other hand, detects all deviations between true and predicted values. If the prediction is not exactly the same as its corresponding true value, there is a penalty. However, mean squared error does not make an explicit comparison to any kind of benchmark. One most certainly can say something like, "The current state of the art achieves a mean squared error of 11, so our mean squared error of 3 represents a considerable improvement," but I have seen plenty of work where all that gets reported are their results without any comparison to the performance of a benchmark or competitor, not even a naïve benchmark like, "Predict the overall mean every time."

What Pearson correlation gives you that is not as explicit in the mean squared error, however, is a sense of how tell the model is able to distinguish between distinct values. For instance, if $y=(1, 2, 3)$ and $\hat y = (11, 21, 31)$, the predictions are flawed, but the model has good ability to distinguish between distinct observed values. Pearson correlation can be seen as a measure of pure predictive discrimination, similar to how area under the receiver operator characteristic curve gives a sense of how well the two categories of a "classification" problem are distinguished from each other. Thus, Pearson correlation is not totally worthless. As you pointed out, despite the flaws of Pearson correlation, it is effective at determining if the model predicts high values when the true values are high and low values when the true values are low (ditto for Spearman correlation).

Addressig a few more pieces from the question:

This gets tricky, because there is not a universal sense of what constitutes good and bad performance that can be thought of like grades in school where a $90\%$ is an A that makes us happy and a $50\%$ is an F that makes us sad.$^{\dagger}$ I would say that the way to evaluate if a model is performing poorly is to compare it to the performance of a competitor or if the predictions are good enough to help you solve your overall task (the latter of which might be quite difficult to assess).

  1. $\left[\text{corr}\left(y, \hat y\right)\right]^2$

  2. The proportion of total variance that is explained by the regression model

  3. The percent reduction in square loss comparing the model with a benchmark that always predicts the overall mean, $\bar y$, that is, $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $. This is a special case of the $R^*$ defined in equation (32) of Gneiting and Resin (2023), which they assert as a universal coefficient of determination.

"Proportion of variance explained" is a bit tricky in all but the simplest of models (OLS linear regression evaluated in-sample), because those are the only times when a decomposition of the total sum of squares yielding that interpretation is guaranteed to hold. However, calculating the squared correlation between true $y$ and predicted $\hat y$ is easy enough, and calculating $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $ looks worse than it is, and we have a computer to do the heavy lifting, anyway.

However, these are not equivalent in all situations. That nasty fraction has the interpretation of comparing the square loss of your model with that of a naïve benchmark that always predicts the conditional mean to be the marginal/pooled/overall mean. I find it reasonable to want the data science team to be better at predicting than a middle school student would do by running AVERAGE(A:A), to use some Excel terminology, and going with that value every time. That calculation flags such situations with values below zero, indicating quite poor performance.

The predictions, at least in terms of square loss, are much worse than predicting $\bar y = 2$ every time. I give additional examples of this here and here.

Mean squared error, on the other hand, detects all deviations between true and predicted values. If the prediction is not exactly the same as its corresponding true value, there is a penalty. However, mean squared error does not make an explicit comparison with any kind of benchmark. One most certainly can say something like "The current state of the art achieves a mean squared error of 11, so our mean squared error of 3 represents a considerable improvement," but I have seen plenty of work where all that gets reported are their results without any comparison with the performance of a benchmark or competitor, not even a naïve benchmark like, "Predict the overall mean every time."

What Pearson correlation gives you that is not as explicit in the mean squared error, however, is a sense of how well the model is able to distinguish between distinct values. For instance, if $y=(1, 2, 3)$ and $\hat y = (11, 21, 31)$, the predictions are flawed, but the model has good ability to distinguish between distinct observed values. Pearson correlation can be seen as a measure of pure predictive discrimination, similar to how area under the receiver operator characteristic curve gives a sense of how well the two categories of a "classification" problem are distinguished from each other. Thus, Pearson correlation is not totally worthless. As you pointed out, despite the flaws of Pearson correlation, it is effective at determining if the model predicts high values when the true values are high and low values when the true values are low (ditto for Spearman correlation).

Addressing a few more pieces from the question:

This gets tricky, because there is not a universal sense of what constitutes good and bad performance that can be thought of like grades in school where a $90\%$ is an A that makes us happy and a $50\%$ is an F that makes us sad.$^{\dagger}$ I would say that the way to evaluate if a model is performing poorly is to compare it with the performance of a competitor or if the predictions are good enough to help you solve your overall task (the latter of which might be quite difficult to assess).

added 626 characters in body
Source Link
Dave
  • 67.1k
  • 7
  • 105
  • 305
  1. $\left[\text{corr}\left(y, \hat y\right)\right]^2$

  2. The proportion of total variance that is explained by the regression model

  3. The percent reduction in square loss comparing the model to a benchmark that always predicts the overall mean, $\bar y$, that is, $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $. This is a special case of the $R^*$ defined in equation (32) of Gneiting and Resin (2023), which they assert as a universal coefficient of determination.

$^{\dagger}$Even that is not true, though. I remember one examination in graduate school where the class average was something like a $34\%$, so when I got my test back and saw my $41\%$, I thought, "Awesome, I got an A!"

REFERENCE

Gneiting, Tilmann, and Johannes Resin. "Regression diagnostics meets forecast evaluation: Conditional calibration, reliability diagrams, and coefficient of determination." Electronic Journal of Statistics 17.2 (2023): 3226-3286.

  1. $\left[\text{corr}\left(y, \hat y\right)\right]^2$

  2. The proportion of total variance that is explained by the regression model

  3. The percent reduction in square loss comparing the model to a benchmark that always predicts the overall mean, $\bar y$, that is, $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $.

$^{\dagger}$Even that is not true, though. I remember one examination in graduate school where the class average was something like a $34\%$, so when I got my test back and saw my $41\%$, I thought, "Awesome, I got an A!"

  1. $\left[\text{corr}\left(y, \hat y\right)\right]^2$

  2. The proportion of total variance that is explained by the regression model

  3. The percent reduction in square loss comparing the model to a benchmark that always predicts the overall mean, $\bar y$, that is, $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $. This is a special case of the $R^*$ defined in equation (32) of Gneiting and Resin (2023), which they assert as a universal coefficient of determination.

$^{\dagger}$Even that is not true, though. I remember one examination in graduate school where the class average was something like a $34\%$, so when I got my test back and saw my $41\%$, I thought, "Awesome, I got an A!"

REFERENCE

Gneiting, Tilmann, and Johannes Resin. "Regression diagnostics meets forecast evaluation: Conditional calibration, reliability diagrams, and coefficient of determination." Electronic Journal of Statistics 17.2 (2023): 3226-3286.

Source Link
Dave
  • 67.1k
  • 7
  • 105
  • 305

As Nick Cox pointed out, Pearson correlation between true and predicted values has an equivalence with the $R^2$ of classical linear regression.

The trouble I see is that multiple expressions are equivalent to this definition of $R^2$ in classical linear modeling. For instance, in a classical linear model (with an intercept), the following are equivalent in the sense that their calculations all yield the same value.

  1. $\left[\text{corr}\left(y, \hat y\right)\right]^2$

  2. The proportion of total variance that is explained by the regression model

  3. The percent reduction in square loss comparing the model to a benchmark that always predicts the overall mean, $\bar y$, that is, $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $.

If the regression only has one feature $x$ along with an intercept ("simple linear regression"), then a fourth calculation equivalent to the previous three is $\left[\text{corr}\left(x, y\right)\right]^2$.

"Proportion of variance explained" is a bit tricky in all but the simplest of models (OLS linear regssion evaluated in-sample), since that is those are the only times when a decomposition of the total sum of squares yielding that interpretation is guaranteed to hold. However, calculating the squared correlation between true $y$ and predicted $\hat y$ is easy enough, and calculating $\left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] $ looks worse than it is, and we have a computer to do the heavy lifting, anyway.

However, these are not equivalent in all situations. That nasty fraction has the interpretation of comparing the square loss of your model to that of a naïve benchmark that always predicts the conditional mean to be the marginal/pooled/overall mean. I find it reasonable to want the data science team to be better at predicting than a middle school student would do by running AVERAGE(A:A), to use some Excel terminology, and going with that value every time. That calculation flags such situations with values below zero, indicating quite poor performance.

The Pearson correlation can miss some ways in which the true and predicted values differ. For instance, $y=(1, 2, 3)$ has a perfect Pearson correlation with $\hat y = (11, 21, 31)$. The predictions, however, are awful.

$$ \left[1-\left(\dfrac{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\hat y_i \right)^2 }{ \overset{N}{\underset{i=1}{\sum}}\left( y_i-\bar y \right)^2 }\right)\right] =-621.5 $$

The predictions, at least in terms of square loss, are much worse than predicing $\bar y = 2$ every time. I give additional examples of this here and here.

Consequently, a high value of $\left[\text{corr}\left(y, \hat y\right)\right]^2$ does not tell us quite as much as we would like. Such a calculation does not detect certain deviations the predictions can have from the true values.

Mean squared error, on the other hand, detects all deviations between true and predicted values. If the prediction is not exactly the same as its corresponding true value, there is a penalty. However, mean squared error does not make an explicit comparison to any kind of benchmark. One most certainly can say something like, "The current state of the art achieves a mean squared error of 11, so our mean squared error of 3 represents a considerable improvement," but I have seen plenty of work where all that gets reported are their results without any comparison to the performance of a benchmark or competitor, not even a naïve benchmark like, "Predict the overall mean every time."

What Pearson correlation gives you that is not as explicit in the mean squared error, however, is a sense of how tell the model is able to distinguish between distinct values. For instance, if $y=(1, 2, 3)$ and $\hat y = (11, 21, 31)$, the predictions are flawed, but the model has good ability to distinguish between distinct observed values. Pearson correlation can be seen as a measure of pure predictive discrimination, similar to how area under the receiver operator characteristic curve gives a sense of how well the two categories of a "classification" problem are distinguished from each other. Thus, Pearson correlation is not totally worthless. As you pointed out, despite the flaws of Pearson correlation, it is effective at determining if the model predicts high values when the true values are high and low values when the true values are low (ditto for Spearman correlation).

Your comment, So my question is whether using both MSE as a metric for precise values and correlation as a metric for the overall “shape” of the output data gives any advantage over using only one or the other, is getting at the right idea, it seems.

Addressig a few more pieces from the question:

I assume that a good correlation value does not necessarily mean that the model is accurate

Exactly. Correlation will miss a number of ways in which predictions are incorrect, such as the example with $y=(1, 2, 3)$ and $\hat y = (11, 21, 31)$.

does a bad correlation value mean that the model is definitely performing poorly?

This gets tricky, because there is not a universal sense of what constitutes good and bad performance that can be thought of like grades in school where a $90\%$ is an A that makes us happy and a $50\%$ is an F that makes us sad.$^{\dagger}$ I would say that the way to evaluate if a model is performing poorly is to compare it to the performance of a competitor or if the predictions are good enough to help you solve your overall task (the latter of which might be quite difficult to assess).

$^{\dagger}$Even that is not true, though. I remember one examination in graduate school where the class average was something like a $34\%$, so when I got my test back and saw my $41\%$, I thought, "Awesome, I got an A!"