predict.pcr {analogue} | R Documentation |

## Predicted values from a principal components regression

### Description

Calculates predicted values from a fitted principal components regression model. Leave-one-out, bootstrap or n k-fold crossvalidated predictions are also implemented.

### Usage

```
## S3 method for class 'pcr'
predict(object, newdata, ncomp = object$ncomp,
CV = c("none", "LOO", "bootstrap", "kfold"),
verbose = FALSE, nboot = 100, kfold = 10, folds = 5,
...)
```

### Arguments

`object` |
a fitted model of class |

`newdata` |
data frame of new observations for which predictions are sought. |

`ncomp` |
numeric; the PCR components for which predictions are
sought. If |

`CV` |
character; the type of crossvalidation required. Currently, no crossvalidation methods are implemented. |

`verbose` |
logical; should progress on crossvalidation be printed to the console? |

`nboot` |
numeric; the number of bootstrap samples to draw. |

`kfold` |
numeric; the number of folds to split data into. |

`folds` |
numeric; the number of repetitions of k-fold CV. |

`...` |
arguments passed to other methods. |

### Details

`predict.pcr`

arranges for any transformation applied to the
training data to be applied to the `newdata`

prior to
prediction.

### Value

A matrix of predicted values with rows representing samples in
`newdata`

and columns, the PCR components requested via
`ncomp`

.

### Author(s)

Gavin L. Simpson

### See Also

### Examples

```
## Load the Imbrie & Kipp data and
## summer sea-surface temperatures
data(ImbrieKipp)
data(SumSST)
## choose 10 samples to act as a test set, for illustration
take <- c(5,58,31,51,42,28,30,57,8,50)
## normal interface and apply Hellinger transformation
mod <- pcr(ImbrieKipp[-take, ], SumSST[-take], tranFun = Hellinger)
## predictions
predict(mod, ImbrieKipp[take, ], ncomp = 4)
## predictions
set.seed(123)
predict(mod, ImbrieKipp[take, ], ncomp = 4, CV = "bootstrap",
nboot = 100)
```

*analogue*version 0.17-6 Index]