Calculate prediction areas that can be used in plotIndiv to shade the background.
A list of data sets (called 'blocks') measured on the same samples. Data in the list should be arranged in matrices, samples x variables, with samples order matching in all data sets.
Matrix response for a multivariate regression framework. Data should be continuous variables (see block.splsda for supervised classification and factor reponse)
distance to use to predict the class of new data,
should be a subset of
numeric list of vectors of length 2, giving the x and y coordinates ranges for the simulated data. By default will be 1.2* the range of object$variates$X[,i]
A total of
resolution*resolution points within the rectangle defined by xlim on the x-axis and ylim on the y-axis, and then predicts the class of each point (defined by two coordinates). The algorithm estimates the predicted area for each class, defined as the 2D surface where all points are predicted to be of the same class. A polygon is returned and should be passed to
plotIndiv for plotting the actual background.
Note that by default xlim and ylim will create a rectangle of simulated data that will cover the plotted area of
plotIndiv. However, if you use
ellipse=TRUE or if you set
ylim, then you will need to adapt
Also note that the white frontier that defines the predicted areas when plotting with
plotIndiv can be reduced by increasing
More details about the prediction distances in
?predict and the supplemental material of the mixOmics article (Rohart et al. 2017).
background.predict returns a list of coordinates to be used with
polygon to draw the predicted area for each class.
Rohart F, Gautier B, Singh A, Lê Cao K-A. mixOmics: an R package for 'omics feature selection and multiple data integration. PLoS Comput Biol 13(11): e1005752
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
# Example 1 # ----------------------------------- ## Not run: data(breast.tumors) X <- breast.tumors$gene.exp Y <- breast.tumors$sample$treatment splsda.breast <- splsda(X, Y,keepX=c(10,10),ncomp=2) # calculating background for the two first components, and the centroids distance background = background.predict(splsda.breast, comp.predicted = 2, dist = "centroids.dist") # default option: note the outcome color is included by default! plotIndiv(splsda.breast, background = background) ## End(Not run) # Example 2 # ----------------------------------- ## Not run: data(liver.toxicity) X = liver.toxicity$gene Y = as.factor(liver.toxicity$treatment[, 4]) plsda.liver <- plsda(X, Y, ncomp = 2) # calculating background for the two first components, and the mahalanobis distance background = background.predict(plsda.liver, comp.predicted = 2, dist = "mahalanobis.dist") plotIndiv(plsda.liver, background = background, legend = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.