Learn R Programming

bestglm (version 0.37.3)

pcreg: Principal Component and Partial Least Squares Regression

Description

Regression using the principal components or latent variables as inputs. The best model is selected using components 1, 2, ..., r, where r, the number of components to use is determined by the AIC or BIC.

Usage

pcreg(Xy, scale = TRUE, method = c("PC", "LV"), ic = c("BIC", "AIC"))

Arguments

Xy

dataframe with variable names in columns

scale

Whether or not to scale. Default is TRUE.

method

either principal components, "PC", or partial least squares latent variables, "LV"

ic

"BIC" or "AIC"

Value

An S3 class list "pcreg" with components

lmfit

lm model

PLSFit

column sd

Z

matrix of principal components or latent vector

method

'pcr' or 'pls'

See Also

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

Examples

Run this code
# NOT RUN {
pcreg(mcdonald, scale=TRUE, method="PC")
pcreg(mcdonald, scale=TRUE, method="LV")
# }

Run the code above in your browser using DataLab