cv.spcr: Cross-validation for spcr

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

View source: R/cv.spcr.R

Description

This function performs cross-validation for spcr. cv.spcr enables us to determine two regularization parameters λ_β and λ_γ objectively.

Usage

1
2
3
cv.spcr(x, y, k, w=0.1, xi=0.01, nfolds=5, adaptive=FALSE, 
	center=TRUE, scale=FALSE, lambda.B.length=10, lambda.gamma.length=10,
	lambda.B=NULL, lambda.gamma=NULL)

Arguments

x

A data matrix.

y

A response vector.

k

The number of principal components.

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.

nfolds

The number of folds. The default is 5.

adaptive

If "TRUE", the adaptive SPCR is used.

center

If "TRUE", the data matrix is centered.

scale

If "TRUE", the data matrix is scaled.

lambda.B.length

The number of candidates for the parameter λ_β. The default is 10.

lambda.gamma.length

The number of candidates for the parameter λ_γ. The default is 10.

lambda.B

Optional user-supplied candidates for the parameter λ_β. The default is NULL.

lambda.gamma

Optional user-supplied candidates for the parameter λ_γ. The default is NULL.

Value

lambda.gamma.seq

The values of lambda.gamma in the fit.

lambda.B.seq

The values of lambda.B in the fit.

CV.mat

Matrix of the mean values of cross-validation. The row shows a sequence of lambda.gamma. The column shows a sequence of lambda.B.

lambda.gamma.cv

The value of lambda.gamma selected by cross-validation.

lambda.B.cv

The value of lambda.B selected by cross-validation.

cvm

The minimum of the mean cross-validated error.

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

spcr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#data
n <- 50
np <- 5
set.seed(1)
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
cv.spcr.fit <- cv.spcr(x=x, y=y, k=2)
cv.spcr.fit

#fit (adaptive SPCR)
cv.adaspcr.fit <- cv.spcr(x=x, y=y, k=2, adaptive=TRUE)
cv.adaspcr.fit

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

Related to cv.spcr in spcr...