Generate simulated data for multilevel models
gen_multilevel(
n = 25,
m = 6,
sigma_e = 2,
sigma_u0 = 2,
sigma_u1 = 2,
sigma_u01 = -2,
beta0 = 0,
beta1 = 2,
x.jitter = 0.5,
seed = NULL
)
A dataframe containing the response variable y
, the
unidimensional explanatory variables X
, and the levels/groups
(factors).
Sample size. Input either a single number for a balanced data set,
or a vector of length m
indicating the sample size in each group.
Number of groups/levels.
The standard deviation of the errors.
The standard deviation of the random intercept.
The standard deviation of the random slopes.
The covariance of between the random intercept and the random slope.
The mean of the random intercept.
The mean of the random slope.
A small amount of jitter is added to the X
variables
generated from a normal distribution with mean zero and standard deviation
equal to x.jitter
.
(Optional) Random seed.