PCA-methods {Cardinal} | R Documentation

## Principal components analysis

### Description

Performs principal components analysis efficiently on large datasets using implicitly restarted Lanczos bi-diagonalization (IRLBA) algorithm for approximate singular value decomposition of the data matrix.

### Usage

    ## S4 method for signature 'SparseImagingExperiment'
    PCA(x, ncomp = 3, center = TRUE, scale = FALSE, ...)

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

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

    ## S4 method for signature 'SImageSet'
    PCA(x, ncomp = 3,
        method = c("irlba", "nipals", "svd"),
        center = TRUE,
        scale = FALSE,
        iter.max = 100, ...)

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

### Arguments

`x` | The imaging dataset for which to calculate the principal components.
`ncomp` | The number of principal components to calculate.
`method` | The function used to calculate the singular value decomposition.
`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.
`...` | Ignored.
`object` | The result of a previous call to `PCA`.
`newx` | An imaging dataset for which to calculate the principal components scores based on the aleady-calculated principal components loadings.

### Value

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

`loadings`:

  A matrix with the principal component loadings.

`scores`:

  A matrix with the principal component scores.

`sdev`:

  The standard deviations of the principal components.

### Author(s)

Kylie A. Bemis

### See Also

`OPLS`, `PLS`, `irlba`, `svd`

### Examples

    register(SerialParam())

    set.seed(1)
    data <- simulateImage(preset=2, npeaks=20, dim=c(6,6),
        representation="centroid")

    # project to FastMap components
    pca <- PCA(data, ncomp=2)

    # visualize first 2 components
    image(pca, superpose=FALSE)

[Package Cardinal version 2.2.6 Index]