Create a custom function to calculate the R-squared value for a linear regression model.
HardProblem Statement
Create a custom function to calculate the R-squared value for a linear regression model.
Sample Input
Observed: c(3, -0.5, 2, 7) Predicted: c(2.5, 0.0, 2, 8)
Sample Output
R-squared: 0.9486
Limits
Time: 2s · Memory: 256 MB