plot,opls-method {ropls} | R Documentation

## Plot Method for (O)PLS(-DA)

### Description

This function plots values based upon a model trained by `opls`.

### Usage

    ## S4 method for signature 'opls'
    plot(x, y, typeVc = c("correlation", "outlier",
      "overview", "permutation", "predict-train", "predict-test", "summary",
      "x-loading", "x-score", "x-variance", "xy-score", "xy-weight")[7],
      parAsColFcVn = NA, parCexN = 0.8, parCompVi = c(1, 2),
      parEllipsesL = NA, parLabVc = NA, parPaletteVc = NA,
      parTitleL = TRUE, file.pdfC = NULL, .sinkC = NULL,
      parCexMetricN = NA, fig.pdfC = NA, info.txtC = NA, ...)

### Arguments

`x` | An S4 object of class `opls`, created by the `opls` function.
`y` | Currently not used.
`typeVc` | Character vector: the following plots are available: 'correlation': Variable correlations with the components, 'outlier': Observation diagnostics (score and orthogonal distances), 'overview': Model overview showing R2Ycum and Q2cum (or 'Variance explained' for PCA), 'permutation': Scatterplot of R2Y and Q2Y actual and simulated models after random permutation of response values; 'predict-train' and 'predict-test': Predicted vs Actual Y for reference and test sets (only if Y has a single column), 'summary' [default]: 4-plot summary showing permutation, overview, outlier, and x-score together, 'x-variance': Spread of raw variables corresp. with min, median, and max variances, 'x-loading': X-loadings (the 6 of variables most contributing to loadings are colored in red to facilitate interpretation), 'x-score': X-Scores, 'xy-score': XY-Scores, 'xy-weight': XY-Weights
`parAsColFcVn` | Optional factor character or numeric vector to be converted into colors for the score plot; default is NA [ie colors will be converted from 'y' in case of (O)PLS(-DA) or will be 'black' for PCA]
`parCexN` | Numeric: amount by which plotting text should be magnified relative to the default
`parCompVi` | Integer vector of length 2: indices of the two components to be displayed on the score plot (first two components by default)
`parEllipsesL` | Should the Mahalanobis ellipses be drawn? If 'NA' [default], ellipses are drawn when either a character parAsColVcn is provided (PCA case), or when 'y' is a character factor ((O)PLS-DA cases).
`parLabVc` | Optional character vector for the labels of observations on the plot; default is NA [ie row names of 'x', if available, or indices of 'x', otherwise, will be used]
`parPaletteVc` | Optional character vector of colors to be used in the plots
`parTitleL` | Should the titles of the plots be printed on the graphics (default = TRUE); It may be convenient to set this argument to FALSE when the user wishes to add specific titles a posteriori
`file.pdfC` | Character: deprecated; use the 'fig.pdfC' argument instead
`.sinkC` | Character: deprecated; use the 'info.txtC' argument instead
`parCexMetricN` | Numeric: magnification of the metrics at the bottom of score plot (default -NA- is 1 in 1x1 and 0.7 in 2x2 display)
`fig.pdfC` | Figure filename (e.g. in case of batch mode) ending with '.pdf'; default is NA (no saving; displaying instead)
`info.txtC` | Character: Report filename for R output diversion [default = NA: no diversion]
`...` | Currently not used.

### Author(s)

Etienne Thevenot, etienne.thevenot@cea.fr

### Examples

    data(sacurine)
    attach(sacurine)

    for(typeC in c("correlation", "outlier", "overview",
                   "permutation", "predict-train","predict-test",
                   "summary", "x-loading", "x-score", "x-variance",
                   "xy-score", "xy-weight")) {

        print(typeC)

        if(grepl("predict", typeC))
            subset <- "odd"
        else
            subset <- NULL

        plsModel <- opls(dataMatrix, sampleMetadata[, "gender"],
                         predI = ifelse(typeC != "xy-weight", 1, 2),
                         orthoI = ifelse(typeC != "xy-weight", 1, 0),
                         permI = ifelse(typeC == "permutation", 10, 0),
                         subset = subset,
                         info.txtC = NULL,
                         fig.pdfC = NULL)

        plot(plsModel, typeVc = typeC)

    }

    sacPlsda <- opls(dataMatrix, sampleMetadata[, "gender"])
    plot(sacPlsda, parPaletteVc = c("green4", "magenta"))

    detach(sacurine)

[Package ropls version 1.16.0 Index]