Description Usage Arguments Details Value Author(s) See Also Examples
Calculates the AUC and plots ROC for supervised objects from s/plsda, mint.s/plsda and block.plsda, block.splsda or wrapper.sgccda.
1 2 3 4 5 6 7 8 9 10 11 12 | auroc(object, ...)
## S3 method for class 'mixo_plsda'
auroc(object, newdata = object$input.X,
outcome.test = as.factor(object$Y), multilevel = NULL, plot = TRUE,
roc.comp = 1, ...)
## S3 method for class 'mint.plsda'
auroc(object, newdata = object$X,
outcome.test = as.factor(object$Y), study.test = object$study,
multilevel = NULL, plot = TRUE, roc.comp = 1,
roc.study = "global", ...)
|
object |
Object of class inherited from one of the following supervised analysis function: "plsda", "splsda", "mint.plsda", "mint.splsda", "block.splsda" or "wrapper.sgccda" |
... |
external optional arguments for plotting |
newdata |
numeric matrix of predictors, by default set to the training data set (see details). |
outcome.test |
Either a factor or a class vector for the discrete outcome, by default set to the outcome vector from the training set (see details). |
multilevel |
Sample information when a newdata matrix is input and when
multilevel decomposition for repeated measurements is required. A numeric
matrix or data frame indicating the repeated measures on each individual,
i.e. the individuals ID. See examples in |
plot |
Whether the ROC curves should be plotted, by default set to TRUE (see details). |
roc.comp |
Specify the component (integer) for which the ROC will be plotted from the multivariate model, default to 1. |
study.test |
For MINT objects, grouping factor indicating which samples
of |
roc.study |
Specify the study for which the ROC will be plotted for a mint.plsda or mint.splsda object, default to "global". |
roc.block |
Specify the block number (integer) or the name of the block (set of characters) for which the ROC will be plotted for a block.plsda or block.splsda object, default to 1. |
For more than two classes in the categorical outcome Y, the AUC is calculated as one class vs. the other and the ROC curves one class vs. the others are output.
The ROC and AUC are calculated based on the predicted scores obtained from
the predict
function applied to the multivariate methods
(predict(object)$predict
). Our multivariate supervised methods
already use a prediction threshold based on distances (see predict
)
that optimally determine class membership of the samples tested. As such AUC
and ROC are not needed to estimate the performance of the model (see
perf
, tune
that report classification error rates). We provide
those outputs as complementary performance measures.
The pvalue is from a Wilcoxon test between the predicted scores between one class vs the others.
External independent data set (newdata
) and outcome
(outcome.test
) can be input to calculate AUROC. The external data set
must have the same variables as the training data set (object$X
).
If newdata
is not provided, AUROC is calculated from the training
data set, and may result in overfitting (too optimistic results).
Note that for mint.plsda and mint.splsda objects, if roc.study
is
different from "global", then newdata
), outcome.test
and
sstudy.test
are not used.
Depending on the type of object used, a list that contains: The AUC and Wilcoxon test pvalue for each 'one vs other' classes comparison performed, either per component (splsda, plsda, mint.plsda, mint.splsda), or per block and per component (wrapper.sgccda, block.plsda, blocksplsda).
Benoit Gautier, Francois Bartolo, Florian Rohart
tune
, perf
, and http://www.mixOmics.org
for more details.
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ## example with PLSDA, 2 classes
# ----------------
#' \dontrun{
library(mixOmics.data)
X <- breast.tumors$gene.exp
Y <- breast.tumors$sample$treatment
plsda.breast <- plsda(X, Y, ncomp = 2)
auc.plsda.breast = auroc(plsda.breast, ncomp = 1)
## example with sPLSDA
# -----------------
splsda.breast <- splsda(X, Y, ncomp = 2, keepX = c(25, 25))
auroc(plsda.breast, plot = FALSE)
## example with sPLSDA with 4 classes
# -----------------
X <- as.matrix(liver.toxicity$gene)
# Y will be transformed as a factor in the function,
# but we set it as a factor to set up the colors.
Y <- as.factor(liver.toxicity$treatment[, 4])
splsda.liver <- splsda(X, Y, ncomp = 2, keepX = c(20, 20))
auc.splsda.liver = auroc(splsda.liver, ncomp = 1)
## example with mint.plsda
# -----------------
res = mint.plsda(X = stemcells$gene, Y = stemcells$celltype, ncomp = 3,
study = stemcells$study)
auc.mint.pslda = auroc(res, plot = FALSE)
## example with mint.splsda
# -----------------
res = mint.splsda(X = stemcells$gene, Y = stemcells$celltype, ncomp = 3, keepX = c(10, 5, 15),
study = stemcells$study)
auc.mint.spslda = auroc(res, plot = TRUE, roc.comp = 3)
## example with block.plsda
# ------------------
data(nutrimouse)
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid)
# with this design, all blocks are connected
design = matrix(c(0,1,1,0), ncol = 2, nrow = 2,
byrow = TRUE, dimnames = list(names(data), names(data)))
block.plsda.nutri = block.plsda(X = data, Y = nutrimouse$diet)
auc.block.plsda.nutri = auroc(block.plsda.nutri, block = 'lipid')
## example with block.splsda
# ---------------
list.keepX = list(gene = rep(10, 2), lipid = rep(5,2))
block.splsda.nutri = block.splsda(X = data, Y = nutrimouse$diet, keepX = list.keepX)
auc.block.splsda.nutri = auroc(block.splsda.nutri, block = 1)
#' }
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.