spcr {spcr} | R Documentation |
Fit a sparse principal component regression (SPCR)
Description
This function computes a principal component regression model via sparse regularization.
Usage
spcr(x, y, k, lambda.B, lambda.gamma, w=0.1, xi=0.01,
adaptive=FALSE, center=TRUE, scale=FALSE)
Arguments
x |
A data matrix. |
y |
A response vector. |
k |
The number of principal components. |
lambda.B |
The regularization parameter for the parameter |
lambda.gamma |
The regularization parameter for the coefficient vector |
w |
Weight parameter with |
xi |
The elastic net mixing parameter with |
adaptive |
If |
center |
If |
scale |
If |
Value
loadings.B |
the loading matrix B |
gamma |
the coefficient |
gamma0 |
intercept |
loadings.A |
the loading matrix A |
Author(s)
Shuichi Kawano
skawano@ai.lab.uec.ac.jp
References
Kawano, S., Fujisawa, H., Takada, T. and Shiroishi, T. (2015). Sparse principal component regression with adaptive loading. Compuational Statistics & Data Analysis, 89, 192–203.
See Also
cv.spcr
Examples
#data
n <- 100
np <- 5
set.seed(4)
nu0 <- c(-1, 1)
x <- matrix( rnorm(np*n), n, np )
e <- rnorm(n)
y <- nu0[1]*x[ ,1] + nu0[2]*x[ ,2] + e
#fit
spcr.fit <- spcr(x=x, y=y, k=2, lambda.B=6, lambda.gamma=2)
spcr.fit
#fit (adaptive SPCR)
adaspcr.fit <- spcr(x=x, y=y, k=2, lambda.B=6, lambda.gamma=2, adaptive=TRUE)
adaspcr.fit