asmbPLSDA.vote.fit {asmbPLS}R Documentation

asmbPLS-DA vote model fit

Description

Function to fit multiple asmbPLS-DA models using cross validation results with different decision rules obtained from asmbPLSDA.cv, the weight for each model are calculated based on cross-validation accuracy, which can be used for asmbPLSDA.vote.predict to obtain the final classification.

Usage

asmbPLSDA.vote.fit(
  X.matrix,
  Y.matrix,
  X.dim,
  cv.results.list,
  nPLS,
  outcome.type,
  method = "weighted",
  measure = NULL,
  center = TRUE,
  scale = TRUE
)

Arguments

X.matrix

Predictors matrix. Samples in rows, variables in columns.

Y.matrix

Outcome matrix. Samples in rows, this is a matrix with one column (binary) or multiple columns (more than 2 levels, dummy variables).

X.dim

A vector containing the number of predictors in each block (ordered).

cv.results.list

A list containing quantile_table_CV from asmbPLSDA.cv using different decision rules, the name of each element in the list should be the corresponding name of decision rule.

nPLS

A vector containing the number of PLS components used for different decision rules.

outcome.type

The type of the outcome Y. "binary" for binary outcome, and "multiclass" for categorical outcome with more than 2 levels.

method

Vote options. "unweighted" gives each decision rule the same weight; "weighted" assigns higher weight to method with higher measure, i.e. weight = log(measure/(1-measure)); "ranked" ranks the given methods based on the average rank of methods using accuracy, balanced accuracy, precision, recall and F1 score.

measure

Measure to be selected when method is weighted. The default is B_accuracy.

center

A logical value indicating whether weighted mean center should be implemented for X.matrix and Y.matrix. The default is TRUE.

scale

A logical value indicating whether scale should be implemented for X.matrix. The default is TRUE.

Value

asmbPLSDA.vote.fit returns a list of lists, which can be used as the inputs for asmbPLSDA.vote.predict. Each list contains the fit information for model with specific decision rule:

fit.model

A list containing model fit information.

nPLS

The number of PLS components used.

weight

The weight for this model.

outcome.type

The type of the outcome Y.

Examples

## Use the example dataset
data(asmbPLSDA.example)
X.matrix = asmbPLSDA.example$X.matrix
X.matrix.new = asmbPLSDA.example$X.matrix.new
Y.matrix.binary = asmbPLSDA.example$Y.matrix.binary
X.dim = asmbPLSDA.example$X.dim
PLS.comp = asmbPLSDA.example$PLS.comp
quantile.comb.table.cv = asmbPLSDA.example$quantile.comb.table.cv

## Cross validaiton based on fixed cutoff
cv.results.cutoff <- asmbPLSDA.cv(X.matrix = X.matrix, 
                                  Y.matrix = Y.matrix.binary,
                                  PLS.comp = PLS.comp, 
                                  X.dim = X.dim, 
                                  quantile.comb.table = quantile.comb.table.cv, 
                                  outcome.type = "binary", 
                                  method = "fixed_cutoff",
                                  k = 3,
                                  ncv = 1)
quantile.comb.cutoff <- cv.results.cutoff$quantile_table_CV

## Cross validation using Euclidean distance of X super score
cv.results.EDX <- asmbPLSDA.cv(X.matrix = X.matrix, 
                               Y.matrix = Y.matrix.binary,
                               PLS.comp = PLS.comp, 
                               X.dim = X.dim, 
                               quantile.comb.table = quantile.comb.table.cv, 
                               outcome.type = "binary", 
                               method = "Euclidean_distance_X",
                               k = 3,
                               ncv = 1)
quantile.comb.EDX <- cv.results.EDX$quantile_table_CV

## Cross validation using Mahalanobis distance of X super score
cv.results.MDX <- asmbPLSDA.cv(X.matrix = X.matrix, 
                                  Y.matrix = Y.matrix.binary,
                                  PLS.comp = PLS.comp, 
                                  X.dim = X.dim, 
                                  quantile.comb.table = quantile.comb.table.cv, 
                                  outcome.type = "binary", 
                                  method = "Mahalanobis_distance_X",
                                  k = 3,
                                  ncv = 1)
quantile.comb.MDX <- cv.results.MDX$quantile_table_CV

#### vote list ####
cv.results.list = list(fixed_cutoff = quantile.comb.cutoff,
                       Euclidean_distance_X = quantile.comb.EDX,
                       Mahalanobis_distance_X = quantile.comb.MDX)

## vote models fit
vote.fit <- asmbPLSDA.vote.fit(X.matrix = X.matrix, 
                               Y.matrix = Y.matrix.binary, 
                               X.dim = X.dim, 
                               nPLS = c(cv.results.cutoff$optimal_nPLS, 
                               cv.results.EDX$optimal_nPLS, 
                               cv.results.MDX$optimal_nPLS),
                               cv.results.list = cv.results.list, 
                               outcome.type = "binary",
                               method = "weighted")


[Package asmbPLS version 1.0.0 Index]