Learn R Programming

qpcR (version 1.4-0)

PRESS: Allen's PRESS (Prediction Sum-Of-Squares) statistic, aka P-square

Description

Calculates the PRESS statistic, a leave-one-out refitting and prediction method, as described in Allen (1971). Works for any regression model with a call slot, an update and a predict function, hence all models of class lm, glm, nls and drc (and maybe more...). The function also returns the PRESS analog to R-square, the P-square.

Usage

PRESS(object, verbose = TRUE)

Arguments

object

a fitted model.

verbose

logical. If TRUE, iterations are displayed on the console.

Value

A list with the following components:

stat

The PRESS statistic.

residuals

a vector containing the PRESS residuals for each \(x_i\).

P.square

the P-square value. See 'Details'.

Details

From a fitted model, each of the predictors \(x_i, i = 1 \ldots{n}\) is removed and the model is refitted to the \(n-1\) points. The predicted value \(\hat{y}_{i, -i}\) is calculated at the excluded point \(x_i\) and the PRESS statistic is given by: $$\sum_{i=1}^n (y_i - \hat{y}_{i, -i})^2$$ The PRESS statistic is a surrogate measure of crossvalidation of small sample sizes and a measure for internal validity. Small values indicate that the model is not overly sensitive to any single data point. The P-square value, the PRESS equivalent to R-square, is given by $$P^2 = \frac{\sum_{i=1}^n \hat{\varepsilon}^2_{-i}}{\sum_{i=1}^n (y_i - \bar{y})^2}$$ with \(\hat\varepsilon_{-i} = y_i - \hat{y}_{-i}\).

References

The relationship between variable selection and data augmentation and a method for prediction. Allen DM. Technometrics (1974), 16: 25-127.

The Prediction Sum of Squares as a Criterion for Selecting Predictor Variables. Allen DM. Technical Report Number 23 (1971), Department of Statistics, University of Kentucky.

Classical and Modern Regression with Applications. Myers RH. Second Edition (1990), Duxbury Press (PWS-KENT Publishing Company), 299-304.

Examples

Run this code
# NOT RUN {
## Example for PCR analysis.
m1 <- pcrfit(reps, 1, 2, l7)
PRESS(m1)

## Compare PRESS statistic in models
## with fewer parameters.
m2 <- pcrfit(reps, 1, 2, l5)
PRESS(m2)
m3 <- pcrfit(reps, 1, 2, l4)
PRESS(m3)

## Example for linear regression.
x <- 1:10
y <- rnorm(10, x, 0.1)
mod <- lm(y ~ x)
PRESS(mod)

## Example for NLS fitting.     
DNase1 <- subset(DNase, Run == 1)
fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1)
res <- PRESS(fm1DNase1)

## PRESS residuals plot.
barplot(res$residuals)
# }

Run the code above in your browser using DataLab