glm.pcr: Principal component generalised linear models

View source: R/glm.pcr.R

Principal component generalised linear modelsR Documentation

Principal component generalised linear models

Description

Principal component generalised linear models.

Usage

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

Arguments

y

A numerical vector, a real values vector or a numeric vector with 0 and 1 (binary) or a vector with discrete (count) data.

x

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

k

A number greater than or equal to 1. How many principal components to use. In the case of "pcr" this can be a single number or a vector. In the second case you get results for the sequence of principal components.

xnew

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

Details

Principal component regression is performed with linear, binary logistic or Poisson regression, depending on the nature of the response variable. 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 of the predictor variables computed via the principcal components if "pcr" is used.

model

The summary of the logistic or Poisson regression model.

per

The percentage of variance of the predictor variables retained by the k principal components.

vec

The principal components, the loadings.

est

The fitted or the predicted values (if xnew is not NULL). If the argument k is a vector then this is a matrix with the estimated values for each number of components.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Aguilera A.M., Escabias M. and Valderrama M.J. (2006). Using principal components for estimating logistic regression with high-dimensional multicollinear data. Computational Statistics & Data Analysis 50(8): 1905-1924.

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

See Also

alfa.pcr, alfapcr.tune

Examples

library(MASS)
x <- as.matrix(fgl[, 2:9])
y <- as.vector(fgl[, 1])
mod1 <- pcr(y, x, 1)
mod2 <- pcr(y, x, 2)
mod <- pcr(y, x, k = 1:4)  ## many results at once

x <- as.matrix(iris[, 1:4])
y<- rbinom(150, 1, 0.6)
mod<- glm.pcr(y, x, k = 1)

Compositional documentation built on Oct. 23, 2023, 5:09 p.m.