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

Description Usage Arguments Details Value Note Author(s) References Examples

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

1
PRESS(object, verbose = TRUE)

Arguments

object

a fitted model.

verbose

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

Details

From a fitted model, each of the predictors x_i, i = 1 …{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:

∑_{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{∑_{i=1}^n \hat{\varepsilon}^2_{-i}}{∑_{i=1}^n (y_i - \bar{y})^2}

with \hat\varepsilon_{-i} = y_i - \hat{y}_{-i}.

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'.

Note

There is also a PRESS function in library 'MPV' that works solely for lm models using the hat matrix.

Author(s)

Andrej-Nikolai Spiess

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## 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)

Example output

Loading required package: MASS
Loading required package: minpack.lm
Loading required package: rgl
Loading required package: robustbase
Loading required package: Matrix
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
.........10.........20.........30.........40.........
$stat
[1] 0.1707453

$residuals
 [1]  0.0699912011  0.0492530168  0.0336378205  0.0140590934  0.0059468637
 [6] -0.0152327406 -0.0243766115 -0.0426399156 -0.0501553346 -0.0482169526
[11] -0.0366446095 -0.0036441082  0.0373464997  0.0573424976  0.0522079969
[16] -0.0273484899 -0.1055046107 -0.0758678030  0.1430477620  0.1444815092
[21] -0.0389319241 -0.0531211747 -0.0925170482 -0.1211925186 -0.0689272016
[26] -0.0894964170 -0.0373461368 -0.0010994085  0.0876387288  0.0341216634
[31]  0.0411379038  0.0339644121 -0.0007373321  0.0896910509  0.0585704515
[36]  0.0754036046  0.0474721358 -0.0042283054  0.0293228863  0.0346239127
[41]  0.0119107545  0.0155387052 -0.0308005207 -0.0467234448 -0.0267803826
[46] -0.0365759500 -0.0778858256 -0.0113176165  0.0120983719

$P.square
[1] 0.9998614

.........10.........20.........30.........40.........
$stat
[1] 0.3268035

$residuals
 [1] -0.106118454 -0.081593284 -0.057837927 -0.041580309 -0.016816340
 [6] -0.006930450  0.013450991  0.022785352  0.038748617  0.055243604
[11]  0.066340758  0.078839608  0.080558464  0.040298420 -0.020051138
[16] -0.078591715 -0.085985589 -0.021335394  0.161313557  0.118811611
[21] -0.079458234 -0.084876337 -0.106059001 -0.116170742 -0.051263943
[26] -0.058884450 -0.000323674  0.040957433  0.130516252  0.083106588
[31]  0.091850841  0.085472438  0.050791569  0.137114478  0.103272589
[36]  0.115322965  0.081801592  0.023285051  0.048233674  0.043882281
[41]  0.010554768  0.002151746 -0.056229156 -0.085428283 -0.081179422
[46] -0.106273794 -0.160373431 -0.118745576 -0.118750543

$P.square
[1] 0.9997347

.........10.........20.........30.........40.........
$stat
[1] 0.4309723

$residuals
 [1] -0.137979577 -0.113829850 -0.090439453 -0.074429395 -0.050020906
 [6] -0.040134803 -0.019433513 -0.008210846  0.012964285  0.041420877
[11]  0.074913451  0.121080019  0.162461276  0.162884497  0.111075713
[16] -0.053469110 -0.182877980 -0.133366255  0.129065194  0.175136046
[21]  0.025454779  0.009426146 -0.034599262 -0.067603271 -0.021445994
[26] -0.042099717  0.006962126  0.041520911  0.126253717  0.075519524
[31]  0.081881330  0.073842883  0.038047779  0.123366768  0.088994207
[36]  0.100591043  0.066831593  0.008217351  0.032949217  0.028487557
[41] -0.004855648 -0.013305953 -0.071607114 -0.100778227 -0.096566825
[46] -0.121626423 -0.175620672 -0.134099097 -0.134113759

$P.square
[1] 0.9996502

.........10
$stat
[1] 0.1115235

$residuals
 [1]  0.152527590  0.027823320 -0.109059747 -0.085491313 -0.009560023
 [6]  0.010612568  0.103179965 -0.103810472 -0.110594330  0.185537340

$P.square
[1] 0.9986148

.........10......

qpcR documentation built on May 2, 2019, 5:17 a.m.

Related to PRESS in qpcR...