Skip to contents

Standardized univariate coefficients s_j = x_j' y / |x_j| on centred data, features with |s_j| > threshold, their first m principal components and a least-squares regression of y on them (ESL Alg. 18.1, eqs 18.32-18.33).

Usage

morie_esl_supervised_pc(X, y, threshold, m = 1, newdata = NULL)

Arguments

X

Features, N by p.

y

Outcome.

threshold

theta.

m

Number of components.

newdata

Points to predict.

Value

Named list: scores_univariate, selected (1-based), loadings, coefficients, fitted, prediction.

References

Bair, E., Hastie, T., Paul, D. & Tibshirani, R. (2006). JASA 101, 119-137.

Examples

i <- 1:40
X <- cbind(sin(i), cos(i), sin(2 * i), cos(3 * i))
morie_esl_supervised_pc(X, X[, 1] + X[, 2] + 0.2 * cos(7 * i), 1)$selected
#> [1] 1 2