opt.penalty.values: Choosing a value for penalty parameters lambdaX and lambdaY...

Description Usage Arguments Value Author(s) Examples

View source: R/AllFunctions.R

Description

Gives the value of the penalty parameters (lambdaX,lambdaY) having the minimum RMSEP value.

Usage

1
2
opt.penalty.values(X, Y, A, algorithm = NULL, eps, from.value.X, to.value.X,
  from.value.Y, to.value.Y, lambdaY.len, lambdaX.len, ...)

Arguments

X

A (NxP) predictor matrix

Y

A (NxM) response matrix; can also be a vector in the case of the SPLS-GLM

A

The number of Partial Least Squares (PLS) components

algorithm

Any of the SPLS or SPLS-GLM algorithms ("mod.SPLS", "SPLS.GLM", "SPLS.binomial.GLM")

eps

Cut off value for convergence step

from.value.X

starting value for lambdaX

to.value.X

ending value for lambdaX

from.value.Y

starting value for lambdaY

to.value.Y

ending value for lambdaY

lambdaY.len

length of lambdaY value

lambdaX.len

length of lambdaX value

...

Other arguments. Currently ignored

Value

the value of the penalty parameters (lambdaX,lambdaY) having the minimum RMSEP value, as well as the RMSEP values obtained when the lambdaX and lambdaY values were paired together

Author(s)

Opeoluwa F. Oyedele and Sugnet Gardner-Lubbe

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if(require(chemometrics))
data(ash, package="chemometrics")
X1 = as.matrix(ash[,10:17], ncol=8)
Y1 = as.matrix(ash$SOT)
colnames(Y1) = paste("SOT")
#choosing a value for the penalty parameters lambdaY and lambdaX for this data
opt.penalty.values(X=scale(X1), Y=scale(Y1), A=2, algorithm=mod.SPLS, eps=1e-5,
from.value.X=0, to.value.X=500, from.value.Y=0, to.value.Y=0, lambdaY.len=1, lambdaX.len=100)
#thus, use lambdaX = 10.10 and lambdaY = 0 for the SPLS analysis of this data

#possum.mat data
if(require(robustbase))
possum.mat
y = as.matrix(possum.mat[,1], ncol=1)
dimnames(y) = list(paste("S", 1:nrow(possum.mat), seq=""), "Diversity")
X = as.matrix(possum.mat[,2:14], ncol=13)
dimnames(X) = list(paste("S", 1:nrow(possum.mat), seq=""), colnames(possum.mat[,2:14]))
#choosing a value for the penalty parameters lambdaY and lambdaX for this data
opt.penalty.values(X=scale(X), Y=scale(y), A=2, algorithm=SPLS.GLM, eps=1e-3,
from.value.X=1, to.value.X=4, from.value.Y=0, to.value.Y=0, lambdaY.len=1, lambdaX.len=100)
#thus, use lambdaY = 0 and lambdaX = 3.3 for the (Poisson) SPLS-GLM analysis of this data

#Pima.tr data
if(require(MASS))
data(Pima.tr, package="MASS")
X = as.matrix(cbind(Pima.tr[,1:7]))
dimnames(X) = list(1:nrow(X), colnames(X))
y = as.matrix(as.numeric(Pima.tr$type)-1, ncol=1)
#0=No and 1=Yes
dimnames(y) = list(1:nrow(y), paste("type"))
#choosing a value for the penalty parameters lambdaY and lambdaX for this data
opt.penalty.values(X=scale(X), Y=scale(y), A=2, algorithm=SPLS.binomial.GLM, eps=1e-3,
from.value.X=0, to.value.X=95, from.value.Y=0, to.value.Y=0, lambdaY.len=1, lambdaX.len=100)
#thus, use lambdaY = 0 and lambdaX = 0.96 for the (Binomial) SPLS-GLM analysis of this data

PLSbiplot1 documentation built on May 2, 2019, 9:41 a.m.