getR2: Calculate R-squared

View source: R/GPfunctions.R

getR2R Documentation

Calculate R-squared

Description

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.

Usage

getR2(obs, pred)

Arguments

obs

Vector of observed values.

pred

Vector of predicted values.

Details

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}

Value

The R-squared value.

See Also

getR2pop


tanyalrogers/GPEDM documentation built on June 1, 2025, 8:10 p.m.