truncate: Eigenvalue truncation

View source: R/truncate.R View source: R/truncate.R

truncateR Documentation

Eigenvalue truncation

Description

This function truncates the scaled eigenvalues of x in order to provide a denoised estimator e_denoised of the underlying correlation matrix. There are three methods to chose from. The threshold method returns $(1-alpha)*rnk$ proportion of eigenvalues above threshold; the hard method returns all the empirical eigenvalues greater than the upper limit of the support to the Marchenko-Pastur spectrum; the identity method returns eigenvalues specified in a location vector. While we keep a proportion of eigenvalues, we can either shrink the remaining ones by a trace-preserving constant (i.e. $Tr(E\_denoised) = Tr(E)$) or set them all to zero. This function is adapted from "Python for Random Matrix Theory" credit to J.-P. Bouchaud and M. Potters.

Usage

truncate(
  x,
  components = NA,
  method = c("threshold", "hard", "identity"),
  alpha = NA,
  location = NA,
  zeroout = FALSE,
  verbose = TRUE,
  ...
)

Arguments

x

A subspace class or a numeric real-valued matrix with n number of samples and p number of features. If p>n, a warning message is generated and the transpose of x is used.

components

A series of right singular vectors to estimate. Components must be smaller or equal to min(nrow(x),ncol(x)).

method

The method to be used; method = "threshold" returns (1-alpha)*rnk proportion of eigenvalues above threshold; method = "hard" returns all the empirical eigenvalues greater than the upper limit of the support to the Marcenko-Pastur spectrum; method = "identity" returns eigenvalues specified in location vector.

alpha

Determine the fraction to keep of the top eigenvalues in threshold method.

location

Indicate the location of eigenvalues to keep in identity method.

zeroout

A logical value to zero out eigenvalues when truncating. default is to set to FALSE.

verbose

output message

...

Extra parameters

Value

Returns a list with entries:

xi_denoised:

A denoised estimator of eigenvalues through a simple eigenvalue truncation procedure (cf. reference below).

x_denoised:

A denoised estimator of the true sigmal matrix underlying a noisy high dimensional matrix x.

v_denoised:

A denoised estimator of the true covariance matrix underlying a noisy, in-sample estimate empirical correaltion matrix estimated from x (cf. reference below).

e_denoised:

A denoised estimator of the true correlation matrix underlying a noisy, in-sample estimate empirical correaltion matrix estimated from x (cf. reference below).

v:

Right singular vectors of x matrix for specified rank.

u:

Left singular vectors of x matrix or specified rank.

See Also

* [MarchenkoPasturPar()] calculates upper and lower limits of Marcenko-Pastur distribution from RMTstat package.

Examples

x <- x_sim(n = 100, p = 150, ncc = 10, var = c(rep(10, 5), rep(1, 5)))
x_denoised <- truncate(x,
                       components = 20,
                       method = "threshold",
                       alpha = 0.9,
                       zeroout = TRUE)
x_denoised <- truncate(x,
                       components = 20,
                       method = "hard",
                       zeroout = FALSE)
x_denoised <- truncate(x,
                       components = 20,
                       method = "identity",
                       location = 1:15,
                       zeroout = FALSE)

# equivalently, if subspace is calculated
Subspace  <- subspace(x,
                      components = 1:20)
x_denoised <- truncate(Subspace,
                       location = 1:15,
                       zeroout = FALSE)

WenlanzZ/MKDim documentation built on July 30, 2022, 7:25 a.m.