pcr: Principal components regression

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

View source: R/pcr.R

Description

Principal components regression.

Usage

1
pcr(y, x, k = 1, xnew = NULL)

Arguments

y

A real values vector.

x

A matrix with the predictor variable(s), they have to be continuous.

k

The number of principal components to use.

xnew

If you have new data use it, otherwise leave it NULL.

Details

The principal components of the cross product of the independent variables are obtained and classical regression is performed. This is used in the function alfa.pcr.

Value

A list including:

be

The beta coefficients.

per

The percentage of variance of the cross product of the independent variables explained by the k components.

est

The fitted or the predicted values (if xnew is not NULL).

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <[email protected]> and Giorgos Athineou <[email protected]>

References

Jolliffe I.T. (2002). Principal Component Analysis.

See Also

pcr.tune, alfa.pcr, glm.pcr

Examples

1
2
3
4
5
library(MASS)
x <- as.matrix(fgl[, 2:9])
y <- as.vector(fgl[, 1])
mod1 <- pcr(y, x, 1)
mod2 <- pcr(y, x, 2)

Compositional documentation built on May 24, 2018, 9:04 a.m.