This is a simple function to simulate longitudinal data from a shared latent process mixed effects model
the data provides a good example for application of slapmeg and pairslapmeg
and pairslapmeg objects.
simslapmeg(
nY,
ntime,
nsubj,
pDif = 1/3,
fixed = ~1 + time,
random = ~1 + time,
fixedbeta = c(0, 2),
randbeta = c(0, 2),
group,
groupbeta = 2,
sigma.b,
sigma.u,
seed = as.integer(runif(1, 0, .Machine$integer.max)),
returnpar = FALSE
)number of omics in the data
number of repeated measures
number of subjects
proportion of differentially expressed omics in the data (the default is 1/3)
A one-sided formula for the fixed-effects excluding the group variable, the default includes an intercept and time
A one-sided formula for the random-effects, the default includes an intercept and time
effect size of fixed terms in formula, the length should match the fixed formula, the default is 0 (intercept) and 2 (time)
effect size of random terms in formula, the length should match the random formula, the default is 0 (intercept) and 2 (time)
Vector indicating group membership, the length should match the number of subjects, The default is random allocation of half of subjects to each group. If use with slapmeg is intended, the group variable should have only two groups
effect size of group variable, the default is 2
variance of the omic- / subject- specific random effects, the length should math nY.
If not specified, nY values from normal distribution will be randomly assigned.
Variance of the subject-specific random effects, the length should math the random effects defined in random formula. If not specified, 2 values from normal distribution will be randomly assigned.
Value of seed, if not specified a random integer will be assigned
logical if TRUE, all simulation parameters will be returned along with the simulated data.
Returns a dataframe where the rows represent the observations and the columns represent the subject Id, time and group variable followed by the omics in pathway; if returnpar is TRUE, a list with both data and parametrs is returned