PLS-methods {Cardinal} | R Documentation

## Partial least squares

### Description

Performs partial least squares (also called projection to latent structures or PLS) on an imaging dataset. This will also perform discriminant analysis (PLS-DA) if the response is a `factor`. Orthogonal partial least squares options (O-PLS and O-PLS-DA) are also available.

### Usage

    ## S4 method for signature 'SparseImagingExperiment,ANY'
    PLS(x, y, ncomp = 3, method = c("pls", "opls"),
            center = TRUE, scale = FALSE,
            iter.max = 100, ...)

    ## S4 method for signature 'SparseImagingExperiment,ANY'
    OPLS(x, y, ncomp = 3, ...)

    ## S4 method for signature 'PLS2'
    predict(object, newx, newy, ncomp, ...)

    ## S4 method for signature 'PLS2'
    fitted(object, ...)

    ## S4 method for signature 'PLS2'
    summary(object, ...)

    ## S4 method for signature 'SImageSet,matrix'
    PLS(x, y, ncomp = 3,
        method = "nipals",
        center = TRUE,
        scale = FALSE,
        iter.max = 100, ...)

    ## S4 method for signature 'SImageSet,ANY'
    PLS(x, y, ...)

    ## S4 method for signature 'SImageSet,matrix'
    OPLS(x, y, ncomp = 3,
        method = "nipals",
        center = TRUE,
        scale = FALSE,
        keep.Xnew = TRUE,
        iter.max = 100, ...)

    ## S4 method for signature 'SImageSet,ANY'
    OPLS(x, y, ...)

    ## S4 method for signature 'PLS'
    predict(object, newx, newy, ...)

    ## S4 method for signature 'OPLS'
    predict(object, newx, newy, keep.Xnew = TRUE, ...)

### Arguments

`x` | The imaging dataset on which to perform partial least squares.
`y` | The response variable, which can be a `matrix` or a `vector` for ordinary PLS, or a `factor` or a `character` for PLS-DA.
`ncomp` | The number of PLS components to calculate.
`method` | The function used to calculate the projection.
`center` | Should the data be centered first? This is passed to `scale`.
`scale` | Shoud the data be scaled first? This is passed to `scale`.
`iter.max` | The number of iterations to perform for the NIPALS algorithm.
`...` | Passed to the next PLS method.
`object` | The result of a previous call to `PLS`.
`newx` | An imaging dataset for which to calculate their PLS projection and predict a response from an already-calculated `PLS` object.
`newy` | Optionally, a new response from which residuals should be calcualted.
`keep.Xnew` | Should the new data matrix be kept after filtering out the orthogonal variation?

### Value

An object of class `PLS2`, which is a `ImagingResult`, or an object of class `PLS`, which is a `ResultSet`. Each elemnt of `resultData` slot contains at least the following components:

`fitted`:

  The fitted response.

`loadings`:

  A matrix with the explanatory variable loadings.

`weights`:

  A matrix with the explanatory variable weights.

`scores`:

  A matrix with the component scores for the explanatary variable.

`Yscores`:

  A matrix objects with the component scores for the response variable.

`Yweights`:

  A matrix objects with the response variable weights.

`coefficients`:

  The matrix of the regression coefficients.

The following components may also be available for classes `OPLS` and `OPLS2`.

`Oloadings`:

  A matrix objects with the orthogonal explanatory variable loadings.

`Oweights`:

  A matrix with the orthgonal explanatory variable weights.

If `y` is a categorical variable, then a categorical `class` prediction will also be available in addition to the `fitted` numeric response.

### Author(s)

Kylie A. Bemis

### References

Trygg, J., & Wold, S. (2002). Orthogonal projections to latent structures (O-PLS). Journal of Chemometrics, 16(3), 119-128. doi:10.1002/cem.695

### See Also

`PCA`, `spatialShrunkenCentroids`,

### Examples

    setCardinalBPPARAM(SerialParam())

    set.seed(1)
    x <- simulateImage(preset=2, npeaks=10, dim=c(10,10),
        snoise=1, sdpeaks=1, representation="centroid")

    y <- makeFactor(circle=pData(x)$circle, square=pData(x)$square)

    pls <- PLS(x, y, ncomp=1:3)

    summary(pls)

    opls <- OPLS(x, y, ncomp=1:3)

    summary(pls)

[Package Cardinal version 2.6.0 Index]