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)

Arguments

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.

Value

A list with sampled data.

Details

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

Examples

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)
#> length(cs) < K. Filling cs with zero