Learn R Programming

denoiseR (version 1.0.2)

LRsim: Low Rank Simulation

Description

This function simulates a data set as a low-rank signal corrupted by Gaussian noise.

Usage

LRsim(n, p, k, SNR)

Arguments

n

integer, number of rows

p

integer, number of columns

k

integer, rank of the signal

SNR

numeric, signal to noise ratio

Value

X the simulated data

mu the true signal

sigma the standard deviation of the noise added to the signal

Details

A data set of size n*p and of rank k is simulated. More precisely, it is simulated as follows: A SVD is performed on a n*p matrix generated from a standard multivariate normal distribution. Then, the signal is computed using the first k singular vectors and singular values U_q D_q V_q'. The signal is scaled in such a way that the variance of each column is 1 and then a Gaussian noise with variance sigma^2 is added. The SNR is calculated as 1/ sigma sqrt(np).

Examples

Run this code
# NOT RUN {
 
Xsim <- LRsim(100, 30, 2, 2)
# }

Run the code above in your browser using DataLab