Prediction or classification using lpls and double-cross-validation with potential jackknife variable selection and re-fitting of the lpls model to a reduced variable set based on the inner CV-loop results before prediction of samples in the outer CV-loop.

lplsReg.dcv(X1, X2, X3, npc.sel = 1:5, alpha = 0, npc.ref = NULL,
  testlevel = 0.05, dreduce = F, colcent = c(T, T), rowcent = c(F, F),
  grandcent = c(F, F), outerfolds, innernfolds = 10, err.type = "rate")

Arguments

X1

A response vector or matrix for regression. For classification this should be either a factor or a dummy coded 0/1 matrix with one column per group.

X2

Predictor matrix of size (n x p).

X3

Background information matrix of size (m x p)

npc.sel

A vector of component numbers to be tested in the initial LPLS model based on all variables in the inner CV-loop. Default is 1:5.

alpha

A vector of alpha-values to be tested in the initial LPLS model based on all variables in the inner CV-loop. Default is a single value 0. See lplsReg for details on alpha.

npc.ref

A vector of component numbers to be tested in the re-fitted LPLS model based on selected variables in the inner CV-loop. Default is 1:5.

testlevel

Testlevel for the jackknife testing of the variables. Deafult is 0.05

dreduce

Logical. Should variable selection on the columns of X3 (parallel to X2) also be applied to the rows of X3? This is logical only if X3 is a (p x p) matrix expressing some dependency or simlarity between the variables in X2, hence, in cases where both the rows and columns of X3 relate to the variables of X2.

colcent

Logical vector of length referring to X2 and X3. Should column centering be performed?

rowcent

Logical vector of length referring to X2 and X3. Should row centering be performed?

grandcent

Logical vector of length referring to X2 and X3. Should overall centering be performed?

outerfolds

A list of length k defining the sample numbers in each fold of k-fold cross-validation (outer segments). May use balanced.folds to make the segment list up front of the analysis.

innernfolds

The number of segments to be used in the inner cv-loop.

err.type

The evaluation criterion for prediction/classification performance. Either "rate" (total error rate), "rmsep" (root mean square error), or "rmsep2" a modified rmsep where only predictions between 0 and 1 contribute to the error. Predictions outside this range are considered as perfect predictions.

Value

call

The function call

total.error

The total error according to the chosen evaluation criterion (see err.type)

apost

For classification: Posterior probabilities of class membership for each sample.

trueclass

For clasification: The true class of each sample

class

For clasification: The predicted class of each sample

X1pred

The numerical predicted value for each sample.

cv.npc.sel

The best number of components for the the outer-loop model chosen from the inner-loop results. This is used for the outer loop predictions if refit = FALSE.

cv.alpha

The best value of alpha for the the outer-loop model chosen from the inner-loop results.

cv.npc.ref

The best number of components for the the outer-loop model chosen from the results of re-fitted inner-loop models to jackknife selected variables. This is used for the outer loop predictions if refit = TRUE.

varfreq

The frequency of variables being selected across outer cross-validation segments.

Examples

data(BCdata) segs <- balanced.folds(BCdata$Y, 5) fit.dcv <- lplsReg.dcv(factor(BCdata$Y), BCdata$X, BCdata$Z, outerfolds = segs, innernfolds = 5)
#> Segment 1 of 5 completed #> Segment 2 of 5 completed #> Segment 3 of 5 completed #> Segment 4 of 5 completed #> Segment 5 of 5 completed #> Outer segment 1 completed #> Segment 1 of 5 completed #> Segment 2 of 5 completed #> Segment 3 of 5 completed #> Segment 4 of 5 completed #> Segment 5 of 5 completed #> Outer segment 2 completed #> Segment 1 of 5 completed #> Segment 2 of 5 completed #> Segment 3 of 5 completed #> Segment 4 of 5 completed #> Segment 5 of 5 completed #> Outer segment 3 completed #> Segment 1 of 5 completed #> Segment 2 of 5 completed #> Segment 3 of 5 completed #> Segment 4 of 5 completed #> Segment 5 of 5 completed #> Outer segment 4 completed #> Segment 1 of 5 completed #> Segment 2 of 5 completed #> Segment 3 of 5 completed #> Segment 4 of 5 completed #> Segment 5 of 5 completed #> Outer segment 5 completed