spatialShrunkenCentroids-methods {Cardinal} | R Documentation

## Spatially-aware shrunken centroid clustering and classification

### Description

Performs spatially-aware nearest shrunken centroid clustering or classification on an imaging dataset. These methods use statistical regularization to shrink the t-statistics of the features toward 0 so that unimportant features are removed from the analysis. A Gaussian spatial kernel or an adaptive kernel based on bilateral filtering are used for spatial smoothing.

### Usage

    ## S4 method for signature 'SparseImagingExperiment,missing'
    spatialShrunkenCentroids(x, r = 1, k = 3, s = 0,
        method = c("gaussian", "adaptive"),
        dist = "chebyshev", init = NULL,
        iter.max = 10, BPPARAM = getCardinalBPPARAM(), ...)

    ## S4 method for signature 'SparseImagingExperiment,ANY'
    spatialShrunkenCentroids(x, y, r = 1, s = 0,
        method = c("gaussian", "adaptive"),
        dist = "chebyshev", priors = table(y),
        BPPARAM = getCardinalBPPARAM(), ...)

    ## S4 method for signature 'SpatialShrunkenCentroids2'
    predict(object, newx, newy, BPPARAM = getCardinalBPPARAM(), ...)

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

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

    ## S4 method for signature 'SImageSet,missing'
    spatialShrunkenCentroids(x, r = 1, k = 3, s = 0,
        method = c("gaussian", "adaptive"),
        iter.max=10, ...)

    ## S4 method for signature 'SImageSet,factor'
    spatialShrunkenCentroids(x, y, r = 1, s = 0,
        method = c("gaussian", "adaptive"),
        priors = table(y), ...)

    ## S4 method for signature 'SImageSet,character'
    spatialShrunkenCentroids(x, y, ...)

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

### Arguments

`x` | The imaging dataset to segment or classify.
`y` | A `factor` or `character` response.
`r` | The spatial neighborhood radius of nearby pixels to consider. This can be a vector of multiple radii values.
`k` | The maximum number of segments (clusters). This can be a vector to try initializing the clustering with different numbers of maximum segments. The final number of segments may differ.
`s` | The sparsity thresholding parameter by which to shrink the t-statistics.
`method` | The method to use to calculate the spatial smoothing weights. The 'gaussian' method refers to spatially-aware (SA) weights, and 'adaptive' refers to spatially-aware structurally-adaptive (SASA) weights.
`dist` | The type of distance metric to use when calculating neighboring pixels based on `r`. The options are ‘radial’, ‘manhattan’, ‘minkowski’, and ‘chebyshev’ (the default).
`init` | Initial cluster configuration. This may either be the result of a call to `spatialKMeans`, or a list of factors giving the initial cluster configurations.
`iter.max` | The maximum number of clustering iterations.
`priors` | Prior probabilities on the classes for classification. Improper priors will be normalized automatically.
`...` | Passed to internal methods.
`BPPARAM` | An optional instance of `BiocParallelParam`. See documentation for `bplapply`.
`object` | The result of a previous call to `spatialShrunkenCentroids`.
`newx` | An imaging dataset for which to calculate the predicted response from shrunken centroids.
`newy` | Optionally, a new response from which residuals should be calculated.

### Value

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

`class, classes`:

  A factor indicating the predicted class for each pixel in the dataset.

`probability, probabilities`:

  A matrix of class probabilities.

`centers`:

  A matrix of shrunken class centers.

`statistic, tstatistics`:

  A matrix of shrunken t-statistics of the features.

`scores`:

  A matrix of discriminant scores.

`sd`:

  The pooled within-class standard deviations for each feature.

### Author(s)

Kylie A. Bemis

### References

Bemis, K., Harry, A., Eberlin, L. S., Ferreira, C., van de Ven, S. M., Mallick, P., Stolowitz, M., and Vitek, O. (2016.) Probabilistic segmentation of mass spectrometry images helps select important ions and characterize confidence in the resulting segments. Molecular & Cellular Proteomics. doi:10.1074/mcp.O115.053918

Tibshirani, R., Hastie, T., Narasimhan, B., & Chu, G. (2003). Class Prediction by Nearest Shrunken Centroids, with Applications to DNA Microarrays. Statistical Science, 18, 104-117.

Alexandrov, T., & Kobarg, J. H. (2011). Efficient spatial segmentation of large imaging mass spectrometry datasets with spatially aware clustering. Bioinformatics, 27(13), i230-i238. doi:10.1093/bioinformatics/btr246

### See Also

`spatialKMeans`

### Examples

    setCardinalBPPARAM(SerialParam())

    set.seed(1)
    x <- simulateImage(preset=2, dim=c(10,10), npeaks=10,
        peakheight=c(4,6,8), representation="centroid")

    res <- spatialShrunkenCentroids(x, r=1, k=5, s=c(0,3,6), method="adaptive")

    summary(res)

    image(res, model=list(s=6))

[Package Cardinal version 2.10.0 Index]