Learn R Programming

analogue (version 0.10-0)

predict.wa: Predict from a weighted average model

Description

Model predictions and cross-validation predictions for weighted averaging transfer function models.

Usage

## S3 method for class 'wa':
predict(object, newdata,
        CV = c("none", "LOO", "bootstrap", "nfold"),
        verbose = FALSE, n.boot = 100, nfold = 5, ...)

Arguments

object
an object of class "wa", usually the result of a call to wa
newdata
An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.
CV
Should cross-validation be performed? Leave-one-out ("LOO"), bootstrap ("bootstrap") and $k$-fold ("nfold") CV are currently available.
verbose
Should CV progress be printed to the console?
n.boot
The number of bootstrap samples or $k$-fold steps.
nfold
Number of subsets in $k$-fold CV.
...
further arguments passed to or from other methods.

Value

  • An object of class "predict.wa", a list with the following components:
  • predA list with components pred and rmsep containing the predicted values and the sample specific errors if available.
  • performanceA list with model performance statistics.
  • model.predA list with components pred and rmsep containing the predicted values for the training set samples and the sample specific errors if available.
  • callthe matched function call.
  • CV.methodThe CV method used.

Details

Not all CV methods produce the same output. CV = "bootstrap" and CV = "nfold" produce sample specific errors.

References

Birks, H.J.B., Line, J.M., Juggins, S., Stevenson, A.C. and ter Braak, C.J.F. (1990). Diatoms and pH reconstruction. Philosophical Transactions of the Royal Society of London; Series B, 327; 263--278.

See Also

wa, predict.mat, performance, reconPlot.

Examples

Run this code
## Imbrie and Kipp
data(ImbrieKipp)
data(SumSST)
ik.wa <- wa(SumSST ~ ., data = ImbrieKipp, tol.dw = TRUE,
            min.tol = 2, small.tol = "min")
ik.wa

## load V12.122 core data
data(V12.122)
V12.122 <- V12.122 / 100

## predict summer sea-surface temperature for V12.122 core
set.seed(2)
v12.pred <- predict(ik.wa, V12.122, CV = "bootstrap", n.boot = 100)

## draw the fitted reconstruction
reconPlot(v12.pred, use.labels = TRUE, display = "bars")

## extract the model performance stats
performance(v12.pred)

Run the code above in your browser using DataLab