Learn R Programming

Compositional (version 1.0)

glm.pcr: Principal component generalised linear models

Description

Principal component generalised linear models.

Usage

glm.pcr(y, x, k, oiko = "binomial", xnew = NULL)

Arguments

y
A numerical vector, either 0 and 1 (binary) or discrete (count) data.
x
The predictor variable(s), they have to be continuous.
k
A number at least equal to 1. How many principal components to use.
oiko
The type of regression to be used, "binomial" for binary response or "poisson" for count response.
xnew
If you have new data use it, otherwise leave it NULL.

Value

  • A list including:
  • modelThe summary of the glm model
  • perThe percentage of variance of the predictor variables retained by the k principal components.
  • estThe fitted or the predicted values (if xnew is not NULL).

Details

Principal component regression is performed with binary logistic or Poisson regression.

References

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

See Also

pcr, alfa.pcr, alfapcr.tune, glm

Examples

Run this code
library(MASS)
x<- iris[, 1:4]
y<- rbinom(150, 1, 0.6)
mod<- glm.pcr(y, x, k = 1, oiko = binomial)

Run the code above in your browser using DataLab