cv.spls: Compute and plot cross-validated mean squared prediction...

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

View source: R/cv.spls.R

Description

Draw heatmap of v-fold cross-validated mean squared prediction error and return optimal eta (thresholding parameter) and K (number of hidden components).

Usage

1
2
3
cv.spls( x, y, fold=10, K, eta, kappa=0.5,
        select="pls2", fit="simpls",
        scale.x=TRUE, scale.y=FALSE, plot.it=TRUE )

Arguments

x

Matrix of predictors.

y

Vector or matrix of responses.

fold

Number of cross-validation folds. Default is 10-folds.

K

Number of hidden components.

eta

Thresholding parameter. eta should be between 0 and 1.

kappa

Parameter to control the effect of the concavity of the objective function and the closeness of original and surrogate direction vectors. kappa is relevant only when responses are multivariate. kappa should be between 0 and 0.5. Default is 0.5.

select

PLS algorithm for variable selection. Alternatives are "pls2" or "simpls". Default is "pls2".

fit

PLS algorithm for model fitting. Alternatives are "kernelpls", "widekernelpls", "simpls", or "oscorespls". Default is "simpls".

scale.x

Scale predictors by dividing each predictor variable by its sample standard deviation?

scale.y

Scale responses by dividing each response variable by its sample standard deviation?

plot.it

Draw heatmap of cross-validated mean squared prediction error?

Value

Invisibly returns a list with components:

mspemat

Matrix of cross-validated mean squared prediction error. Rows correspond to eta and columns correspond to the number of components (K).

eta.opt

Optimal eta.

K.opt

Optimal K.

Author(s)

Dongjun Chung, Hyonho Chun, and Sunduz Keles.

References

Chun H and Keles S (2010), "Sparse partial least squares for simultaneous dimension reduction and variable selection", Journal of the Royal Statistical Society - Series B, Vol. 72, pp. 3–25.

See Also

print.spls, plot.spls, predict.spls, and coef.spls.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
    data(yeast)
    set.seed(1)

    # MSPE plot. eta is searched between 0.1 and 0.9 and
    # number of hidden components is searched between 1 and 10

    ## Not run: 
        cv <- cv.spls(yeast$x, yeast$y, K = c(1:10), eta = seq(0.1,0.9,0.1))
        
        # Optimal eta and K
        cv$eta.opt
        cv$K.opt
        (spls(yeast$x, yeast$y, eta=cv$eta.opt, K=cv$K.opt))
    
## End(Not run)

Example output

Sparse Partial Least Squares (SPLS) Regression and
Classification (version 2.2-3)

eta = 0.1 
eta = 0.2 
eta = 0.3 
eta = 0.4 
eta = 0.5 
eta = 0.6 
eta = 0.7 
eta = 0.8 
eta = 0.9 

Optimal parameters: eta = 0.6, K = 8
[1] 0.6
[1] 8

Sparse Partial Least Squares for multivariate responses
----
Parameters: eta = 0.6, K = 8, kappa = 0.5
PLS algorithm:
pls2 for variable selection, simpls for model fitting

SPLS chose 56 variables among 106 variables

Selected variables: 
ACE2_YPD	ARG80_YPD	ARG81_YPD	ASH1_YPD	AZF1_YPD	
BAS1_YPD	CBF1_YPD	CHA4_YPD	CRZ1_YPD	FHL1_YPD	
FKH1_YPD	FKH2_YPD	FZF1_YPD	GAT1_YPD	GAT3_YPD	
GCN4_YPD	GCR2_YPD	GLN3_YPD	HAA1_YPD	HAP2_YPD	
HAP5_YPD	HIR1_YPD	HIR2_YPD	IME4_YPD	INO4_YPD	
A1..MATA1._YPD	MBP1_YPD	MCM1_YPD	MET4_YPD	MSN2_YPD	
NDD1_YPD	NRG1_YPD	PHD1_YPD	PHO2_YPD	PUT3_YPD	
RCS1_YPD	REB1_YPD	RFX1_YPD	RIM101_YPD	RME1_YPD	
RTG1_YPD	RTG3_YPD	SIP4_YPD	SOK2_YPD	STB1_YPD	
STE12_YPD	STP2_YPD	SWI4_YPD	SWI5_YPD	SWI6_YPD	
THI2_YPD	YAP1_YPD	YAP6_YPD	YAP7_YPD	YFL044C_YPD	
YJL206C_YPD	

spls documentation built on May 6, 2019, 1:09 a.m.