sim_rand_eff: Function to simulate random effects.

Description Usage Arguments Details

View source: R/rand_eff_sim.r

Description

Input simulation parameters and returns random effects.

Usage

1
2
sim_rand_eff(random_var, n, rand_gen, ther = c(0, 1), ther_sim = FALSE,
  cor_vars = NULL, ...)

Arguments

random_var

Variance of random effects. Must be same length as random.

n

Cluster sample size.

rand_gen

The generating function used (e.g. rnorm).

ther

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.

ther_sim

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.

cor_vars

A vector of correlations between random effects.

...

Additional values that need to be passed to the function called from rand_gen.

Details

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.


simglm documentation built on Jan. 24, 2019, 1:04 a.m.