View source: R/truncate.R View source: R/truncate.R
truncate | R Documentation |
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.
truncate( x, components = NA, method = c("threshold", "hard", "identity"), alpha = NA, location = NA, zeroout = FALSE, verbose = TRUE, ... )
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 |
Returns a list with entries:
A denoised estimator of eigenvalues through a simple eigenvalue truncation procedure (cf. reference below).
A denoised estimator of the true sigmal matrix underlying a noisy high dimensional matrix x.
A denoised estimator of the true covariance matrix underlying a noisy, in-sample estimate empirical correaltion matrix estimated from x (cf. reference below).
A denoised estimator of the true correlation matrix underlying a noisy, in-sample estimate empirical correaltion matrix estimated from x (cf. reference below).
Right singular vectors of x matrix for specified rank.
Left singular vectors of x matrix or specified rank.
* [MarchenkoPasturPar()] calculates upper and lower limits of Marcenko-Pastur distribution from RMTstat package.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.