getR2 | R Documentation |
Calculates an R-squared value. Vectors for observed and predicted values must be the same length. Missing values are allowed. Any observed-predicted pairs with missing values are removed before computations are done.
getR2(obs, pred)
obs |
Vector of observed values. |
pred |
Vector of predicted values. |
Returned R-squared might be negative. This indicates that the prediction is worse than using the mean. This function specifically computes:
R^2=1-SS_{err}/SS_{y}
which is equivalent to
R^2=1-MSE/Var_{y}
The R-squared value.
getR2pop
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.