beta = sum over the first M components of (z_m'y / z_m'z_m) v_m on the
centred design (ESL eq 3.61), returned on the original scale with the
intercept separately.
Arguments
- X
Predictors without an intercept column.
- y
Response.
- M
Number of components, 1 <= M <= min(n - 1, p).
Value
Named list: estimate, beta, intercept, variance_explained,
singular_values, M, n, p.
References
Hastie, Tibshirani & Friedman (2009), sec. 3.5.1.
Examples
morie_esl_pcr(cbind(c(0, 1, 2, 3), c(1, 0, 2, 1)), c(1, 2, 5, 5), 1)$beta
#> [1] 1.4524919 0.4397792