Learn R Programming

Compositional (version 1.4)

Principal components regression: Principal components regression

Description

Principal components regression.

Usage

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

Arguments

y
A real values vector.
x
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.

Value

A list including:
beta
The beta coefficients.
parameters
The beta coefficients and their standard eror.
mse
The MSE of the linear regression, if xnew is NULL, becuase it needs the fitted values.
adj.rsq
The value of the adusted $R^2$ if xnew is NULL.
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).

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.

References

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

See Also

pcr.tune, alfa.pcr, glm.pcr

Examples

Run this code
library(MASS)
x <- fgl[, 2:9]
y <- fgl[, 1]
mod1 <- pcr(y, x, 1)
mod2 <- pcr(y, x, 2)

Run the code above in your browser using DataLab