This function computes the Principal Components Regression (PCR) fit.
Arguments
- X
matrix of predictor observations.
- y
vector of response observations. The length of
yis the same as the number of rows ofX.- scale
Should the predictor variables be scaled to unit variance? Default is
TRUE.- m
maximal number of principal components. Default is
m=min(ncol(X),nrow(X)-1).- eps
precision. Eigenvalues of the correlation matrix of
Xthat are smaller thanepsare set to 0. The default value iseps=10^{-6}.- supervised
Should the principal components be sorted by decreasing squared correlation to the response? Default is FALSE.
Value
- coefficients
matrix of regression coefficients, including the coefficients of the null model, i.e. the constant model
mean(y).- intercept
vector of intercepts, including the intercept of the null model, i.e. the constant model
mean(y).
