PLS-methods: Partial least squares

Description Usage Arguments Value Author(s) References See Also Examples

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

 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
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

Example output

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

Loading required package: BiocParallel
Loading required package: EBImage
Loading required package: S4Vectors
Loading required package: stats4

Attaching package:S4VectorsThe following object is masked frompackage:base:

    expand.grid

Loading required package: ProtGenerics

Attaching package:ProtGenericsThe following object is masked frompackage:stats:

    smooth


Attaching package:CardinalThe following object is masked frompackage:stats:

    filter

Projection to latent components:
 
 Classification on 2 classes: circle square 
 Method = pls
 
  Number of Components Accuracy Sensitivity Specificity
1                    1    0.950   0.8666667           1
2                    2    0.950   0.8666667           1
3                    3    0.975   0.9333333           1
Projection to latent components:
 
 Classification on 2 classes: circle square 
 Method = pls
 
  Number of Components Accuracy Sensitivity Specificity
1                    1    0.950   0.8666667           1
2                    2    0.950   0.8666667           1
3                    3    0.975   0.9333333           1

Cardinal documentation built on Nov. 8, 2020, 11:10 p.m.