subspace: A constructor function for the subspace class

View source: R/subspace.R View source: R/subspace.R

subspaceR Documentation

A constructor function for the subspace class

Description

This function calculates scaled eigenvalues and eigenvectors of x matrix, as well as sampled eigenvalues from a random noise matrix N of the same dimension as x, which follows a Marcenko-Pastur distribution with package "RMTsata"(https://cran.r-project.org/web/packages/RMTstat/index.html).

Usage

subspace(
  x,
  components = NULL,
  decomposition = c("svd", "eigen"),
  mp = TRUE,
  num_est_samples = NA,
  verbose = FALSE,
  ...
)

Arguments

x

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)).

decomposition

The method to be used; method = "svd" returns results from singular value decomposition; method = "eigen" returns results from eigenvalue decomposition.

mp

A logical value. If true, sample eigenvlaues from random noise matrix with mp distribution.

num_est_samples

Split data into num_est_samples-fold for parallel computation.

verbose

output message

...

Extra parameters

Value

Returns a list with entries:

ndf:

The number of degrees of freedom of x.

pdim:

The number of dimensions of x.

components:

A series of right singular vectors estimated.

var_correct:

Corrected population variance for Marcenko-Pastur distribution.

transpose_flag:

A logical value indicating whether the matrix x is transposed.

irl:

A data frame of scaled eigenvalues for specified components and corresponding dimensions.

sigma_a:

A vector of corrected eigenvalues up to max(components) if mp is true.

mp_irl:

A data frame of sampled expected eigenvalues from Marcenko-Pastur for specified components and corresponding dimensions.

sigma_mp:

A vector of samped expected eigenvalues from Marcenko-Pastur up to max(components).

v:

Right singular vectors of x matrix for specified components.

u:

Left singular vectors of x matrix or specified components.

See Also

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

* [rmp()] sample scaled eigenvalues of random noise matrix from RMTstat package.

Examples

x <- x_sim(n = 100, p = 150, ncc = 10, var = c(rep(10, 5), rep(1, 5)))
Subspace <- subspace(x)
Subspace <- subspace(x, components = 8:30)
Subspace <- subspace(x, components = c(2, 3, 6, 16))
Subspace <- subspace(x, components = 1:20, mp = FALSE)
Subspace
plot(Subspace, changepoint = 0, annotation = 1:10)

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