rsim_data | R Documentation |
rsim_data
simulates a data matrix, M
, of a given dimension and rank by simulating
ground truth low rank (L
), sparse (S
) and noise (Z
) components.
Meaning M = L + S + Z
. The M
, L
, S
and Z
matrices are all accessible from this function,
allowing for easy evaluation of PCP's performance.
rsim_data( sim_seed, nrow, ncol, rank, sigma, add_sparse = FALSE, nonneg = TRUE, ldist = runif, sdist = runif, zdist = rnorm, ... )
sim_seed |
Required seed to allow for reproducible results & distinct simulated matrices. |
nrow |
Sets number of rows in the simulated data matrix. |
ncol |
Sets the number of columns in the simulated data matrix. |
rank |
Sets the rank of the simulated data matrix. |
sigma |
Sets the standard deviation of the noise matrix, |
add_sparse |
Logical that sets whether sparse noise, |
nonneg |
Logical that sets whether the final M matrix should be non-negative. Default= |
ldist |
Function that defines a distribution to use when simulating the L matrix. Default= |
sdist |
Function that defines a distribution to use when simulating the S matrix. Default= |
zdist |
Function that defines a distribution to use when simulating the Z matrix. Default= |
list containing the simulated M
, L
, S
and Z
matrices.
data <- rsim_data(sim_seed = 1, nrow = 10, ncol = 10, rank = 3, sigma = .1, add_sparse = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.