fitCPCA: Contrastive Principal Component Analysis

View source: R/fitCPCA.R

fitCPCAR Documentation

Contrastive Principal Component Analysis

Description

Given target and background dataframes or matrices, cPCA will perform contrastive principal component analysis (cPCA) of the target data for a given number of eigenvectors and a vector of real valued contrast parameters. This is identical to the implementation of cPCA method of \insertCiteabid2018exploring;textualscPCA.

Usage

fitCPCA(
  target,
  center,
  scale,
  c_contrasts,
  contrasts,
  n_eigen,
  n_medoids,
  eigdecomp_tol,
  eigdecomp_iter
)

Arguments

target

The target (experimental) data set, in a standard format such as a data.frame or matrix.

center

A logical indicating whether the target and background data sets should be centered to mean zero.

scale

A logical indicating whether the target and background data sets should be scaled to unit variance.

c_contrasts

A list of contrastive covariances.

contrasts

A numeric vector of the contrastive parameters used to compute the contrastive covariances.

n_eigen

A numeric indicating the number of eigenvectors to be computed.

n_medoids

A numeric indicating the number of medoids to consider. Not used if contrasts is a single value.

eigdecomp_tol

A numeric providing the level of precision used by eigendecompositon calculations. Defaults to 1e-10.

eigdecomp_iter

A numeric indicating the maximum number of interations performed by eigendecompositon calculations. Defaults to 1000.

Value

A list of lists containing the cPCA results for each contrastive parameter deemed to be a medoid.

  • rotation - the list of matrices of variable loadings

  • x - the list of rotated data, centred and scaled if requested, multiplied by the rotation matrix

  • contrast - the list of contrastive parameters

  • penalty - set to zero, since loadings are not penalized in cPCA

References

\insertAllCited

PhilBoileau/scPCA documentation built on Feb. 6, 2024, 3:33 p.m.