spcr: Fit a sparse principal component regression (SPCR)

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/spcr.R

Description

This function computes a principal component regression model via sparse regularization.

Usage

1
2
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 B.

lambda.gamma

The regularization parameter for the coefficient vector γ.

w

Weight parameter with 0≤ w ≤ 1. The default is 0.1.

xi

The elastic net mixing parameter with 0≤ α ≤ 1. The default is 0.01.

adaptive

If "TRUE", the adaptive SPCR is used.

center

If "TRUE", the data matrix is centered.

scale

If "TRUE", the data matrix is scaled.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#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

Example output

$loadings.B
            [,1]      [,2]
[1,]  0.00000000 0.8143329
[2,]  0.76409873 0.0000000
[3,] -0.01053248 0.0000000
[4,]  0.16515576 0.0000000
[5,]  0.06239955 0.0000000

$gamma
[1]  1.075557 -1.080739

$gamma0
[1] -0.187528

$loadings.A
             [,1]        [,2]
[1,] -0.007234729  0.97301073
[2,]  0.938958511 -0.05354597
[3,] -0.222296505 -0.02218262
[4,]  0.221738956  0.11496902
[5,]  0.140430310  0.19150199

$call
spcr(x = x, y = y, k = 2, lambda.B = 6, lambda.gamma = 2)

attr(,"class")
[1] "spcr"
$loadings.B
          [,1]      [,2]
[1,] 0.0000000 0.5549139
[2,] 0.5714354 0.0000000
[3,] 0.0000000 0.0000000
[4,] 0.0000000 0.0000000
[5,] 0.0000000 0.0000000

$gamma
[1]  1.44579 -1.51807

$gamma0
[1] -0.187528

$loadings.A
            [,1]        [,2]
[1,] -0.01223896  0.97658264
[2,]  0.98036693 -0.01061109
[3,] -0.17805636 -0.02509174
[4,]  0.03780562  0.09911387
[5,]  0.07481685  0.18899894

$call
spcr(x = x, y = y, k = 2, lambda.B = 6, lambda.gamma = 2, adaptive = TRUE)

attr(,"class")
[1] "spcr"

spcr documentation built on Sept. 28, 2021, 5:08 p.m.

Related to spcr in spcr...