multi_sample_spiked_wishart: Compute means of each singular value and the mean Jacobian,...

View source: R/spiked_wishart.R

multi_sample_spiked_wishartR Documentation

Compute means of each singular value and the mean Jacobian, see sample_spiked_wishart_and_jac

Description

Compute means of each singular value and the mean Jacobian, see sample_spiked_wishart_and_jac

Usage

multi_sample_spiked_wishart(
  count,
  spiked_sd,
  num_observations,
  num_variables,
  population_sd = 1,
  num_eigs = 0
)

Arguments

count

The number of samples to compute the mean of

spiked_sd

The spiked standard deviations

num_observations

The number of observations (aka samples or columns)

num_variables

The number of variables (aka features or rows)

population_sd

the standard deviation of all non-spiked components (num_variables - length(spiked_sd) of them)

num_eigs

The number of eigenvalues to compute. If 0 compute all of them using dense matrix routines. If greater than zero, use sparse matrices and compute that many top eigenvalues.

Value

List with a vector of mean singular values of G where G is a random num_variables x num_observations matrix with iid columns from N(0, Sigma) where Sigma is diagonal with entries spiked_sd^2 and all the remaining are population_sd^2. and also the mean Jacobian, where ⁠\[i,j\]⁠ is the derivative of the ith singular value with respect to the jth spiked SD, and the gradient of the population_sd parameter

Examples

# Sample 10 times from the spiked Wishart distribution with (500, 100, 1, ..., 1) singular values
# and take the means of the singular values as well as derivatives (jacobian and pop_sd_grad)
mean_vals <- multi_sample_spiked_wishart(
    count = 10,
    spiked_sd = c(500, 100),
    num_observations = 10-1,
    num_variables = 1000,
    num_eigs = 3
)
mean_vals$singular_vals
mean_vals$jacobian
mean_vals$pop_sd_grad

dependentsimr documentation built on Aug. 8, 2025, 6:23 p.m.