Sample data with the latent factor model.
lfmm_sampler(n, p, K, outlier.prop, cs, sigma = 0.2, B.sd = 1, B.mean = 0, U.sd = 1, V.sd = 1)
n | number of observations. |
---|---|
p | number of output variables. |
K | number of latent variables. |
outlier.prop | proportion of outlier. |
cs | correlation with between X and U. |
sigma | standard deviation of the error. |
B.sd | standard deviation of B. |
B.mean | mean of B. |
U.sd | standard deviation of U. |
V.sd | standard deviation of V. |
A list with sampled data.
lfmm_sample()
sample an output matrix Y and primary matrix X such that
Y = U t(V) + X t(B) + Epsilon.
U,V, B and Epsilon are sampled with normal multivariate distribution.
Moreover U and X are such that cor(U[,i], X) = cs[i]
.
dat <- lfmm_sampler(n = 100, p = 1000, K = 3, outlier.prop = 0.1, cs = c(0.8), sigma = 0.2, B.sd = 1.0, B.mean = 0.0, U.sd = 1.0, V.sd = 1.0)#>