This function calculates R2 prediction statistic.

r2predict(mod)

Arguments

mod

A lm object.

Value

The press function returns the press statistic defined as \(R2predict=1-PRESS/SST\).

Examples

x <- c(1, 1, 2, 3, 3, 4, 4, 4, 4.7, 5, 5.6, 5.6, 5.6, 6, 6, 6.5, 6.9)
y <- c(10.84, 9.3, 16.35, 22.88, 24.35, 24.56, 25.86, 29.16, 24.59,
       22.25, 25.9, 27.2, 25.61, 25.45, 26.56, 21.03, 21.46)
mod <- lm(y ~ x)
r2predict(mod)
#> [1] 0.2489834