Suppose the following data correspond to observed responses and their predictions obtained from some model.
observed <- runif(100)
predicted <- 1 + observed + rnorm(100, sd = 0.1) # suppose they are obtained from some model instead
# predicted vs actual plot
plot(observed, predicted)
We can observe a linear trend and therefore expect a high $R^2$. $R^2$ can be interpreted as
- the degree of linear association between "predicted" and "observed", or
- the proportion of the total variation of the y-variable (here, "predicted") explained by the x-variable (here, "observed") using a straight line.
Question
Below are two versions of $R^2$ reported by caret
. How do you interpret the "traditional" version, which gives -11 for the above example?
R2_default <- caret::R2(pred = predicted, obs = observed)
R2_tradi <- caret::R2(pred = predicted, obs = observed, form = "traditional")
R2_tradi2 <- 1 - sum((observed - predicted)^2) / sum((observed - mean(observed))^2)