Input simulation parameters and returns random effects.
sim_rand_eff(
random_var,
n,
rand_gen,
ther = c(0, 1),
ther_sim = FALSE,
cor_vars = NULL,
...
)
Variance of random effects. Must be same length as random.
Cluster sample size.
The generating function used (e.g. rnorm).
A vector of length two that specifies the theoretical mean and standard deviation of the rand_gen. This would commonly be used to standardize the generating variable to have a mean of 0 and standard deviation of 1 to meet model assumptions. The variable is then rescaled to have the variance specified by random_var.
A TRUE/FALSE flag indicating whether the error simulation function should be simulated, that is should the mean and standard deviation used for standardization be simulated.
A vector of correlations between random effects.
Additional values that need to be passed to the function called from rand_gen.
Simulates random effects for the master function sim_reg
when
simulating a linear mixed model, both cross sectional and longitudinal.
Allows the ability to simulate random effects from a Laplace,
chi-square (1), mixture normal, or normal distribution.