asmbPLSDA.predict {asmbPLS}R Documentation

Using an asmbPLS-DA model for classification of new samples

Description

Derives classification for new samples from a model fitted by the function asmbPLSDA.fit.

Usage

asmbPLSDA.predict(fit.results, X.matrix.new, PLS.comp, method = NULL)

Arguments

fit.results

The output of asmbPLSDA.fit

X.matrix.new

A predictors matrix, whose predictors are the same as the predictors in model fitting.

PLS.comp

Number of PLS components used for prediction.

method

Decision rule used for prediction. For binary outcome, the methods include "fixed_cutoff" (default), "Euclidean_distance_X" and "Mahalanobis_distance_X". For categorical outcome with more than 2 levels, the methods include "Max_Y" (default), "Euclidean_distance_X", "Mahalanobis_distance_X", "Euclidean_distance_Y", and "PCA_Mahalanobis_distance_Y".

Value

asmbPLSDA.predict returns a list containing the following components:

Y_pred

Predicted class for the new sampels.

Y_pred_numeric

Predicted Y values for the new samples, different decision rules can be used to obtain different Y_pred.

NewX_super_score

Predicted super score for new samples, which can be used as predictors for other classification algorithms.

method

Decision rule used for preidction.

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
Y.matrix.multiclass = asmbPLSDA.example$Y.matrix.morethan2levels
X.dim = asmbPLSDA.example$X.dim
PLS.comp = asmbPLSDA.example$PLS.comp
quantile.comb = asmbPLSDA.example$quantile.comb
 
## asmbPLSDA fit for binary outcome
asmbPLSDA.fit.binary <- asmbPLSDA.fit(X.matrix = X.matrix, 
                                      Y.matrix = Y.matrix.binary, 
                                      PLS.comp = PLS.comp, 
                                      X.dim = X.dim, 
                                      quantile.comb = quantile.comb,
                                      outcome.type = "binary")

## asmbPLSDA fit for categorical outcome with more than 2 levels
asmbPLSDA.fit.multiclass <- asmbPLSDA.fit(X.matrix = X.matrix, 
                                          Y.matrix = Y.matrix.multiclass,
                                          PLS.comp = PLS.comp, 
                                          X.dim = X.dim, 
                                          quantile.comb = quantile.comb,
                                          outcome.type = "multiclass")

## asmbPLSDA prediction for the new data, you could use different numbers of 
## PLS components for prediction
## Use only the first PLS component 
Y.pred.binary.1 <- asmbPLSDA.predict(asmbPLSDA.fit.binary, 
                                     X.matrix.new, 
                                     PLS.comp = 1)
## Use the first two PLS components                                      
Y.pred.binary.2 <- asmbPLSDA.predict(asmbPLSDA.fit.binary,
                                     X.matrix.new, 
                                     PLS.comp = 2)

## PLS components for prediction
Y.pred.multiclass.1 <- asmbPLSDA.predict(asmbPLSDA.fit.multiclass,
                                         X.matrix.new, 
                                         PLS.comp = 1)
## Use the first two PLS components     
Y.pred.multiclass.2 <- asmbPLSDA.predict(asmbPLSDA.fit.multiclass,
                                         X.matrix.new, 
                                         PLS.comp = 2)


[Package asmbPLS version 1.0.0 Index]