## example for PCR analysis
mod <- pcrfit(reps, 1, 2, l5())
PRESS(mod)$stat
## or
mod <- drmfit(F1.1 ~ Cycles, data = reps, fct = l5())
PRESS(mod)$stat
## compare PRESS statistic in models
## with fewer parameters
mod2 <- update(mod, fct = l4())
PRESS(mod2)$stat
mod3 <- update(mod, fct = l3())
PRESS(mod3)$stat
## example for linear regression
x <- 1:10
y <- rnorm(10, x, 0.1)
mod <- lm(y ~ x)
PRESS(mod)$stat
## example for NLS fitting
## starting values need to be attached!
DNase1 <- subset(DNase, Run == 1)
inits <- getInitial(density ~ SSlogis(log(conc), Asym, xmid, scal), data = DNase1)
attach(as.list(inits))
fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1)
res <- PRESS(fm1DNase1)
## PRESS residuals plot
plot(fitted(fm1DNase1), res$resid)
Run the code above in your browser using DataLab