predict.pcreg: Predict Method for Pcreg.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/pcreg.R

Description

Prediction for models fit using pcreg().

Usage

1
2
## S3 method for class 'pcreg'
predict(object, newdata, ...)

Arguments

object

the S3 class object produced as output from the function pcreg()

newdata

dataframe with new data and with same column names as used in the original argument to pcreg.

...

additional arguments

Details

The prediction method, predict.mvr(), which is available in the pls package is used. We take advantage of this since it avoids fussing with scaling issues since it is automatically handled for us by predict.mvr()

Value

the predicted values

Author(s)

A. I. McLeod

See Also

predict.pcreg, summary.pcreg, plot.pcreg, fitted.pcreg, residuals.pcreg

Examples

1
2
3
4
5
XyList <- trainTestPartition(mcdonald)
XyTr <- XyList$XyTr
XyTe <- XyList$XyTe
ans <- pcreg(XyTr, scale=TRUE)
predict(ans, newdata=XyTe)

Example output

Loading required package: leaps
 [1]  929.0372  907.8880 1051.7537  938.7067  889.6990  924.8623  879.4270
 [8]  901.1829  946.7659  907.1468  899.6585  960.0635  794.5098  871.8236
[15]  859.0607  910.7289  906.1838  910.2026  969.5062  944.3537

bestglm documentation built on March 26, 2020, 7:25 p.m.