spcr: Fit a sparse principal component regression (SPCR)

View source: R/spcr.R

spcrR 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 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

#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

spcr documentation built on Oct. 16, 2022, 9:05 a.m.

Related to spcr in spcr...