Simulate response patterns for generalized linear models of gaussian or binomial families, with both an intercept and slope covariate. Used primarily for testing purposes.
mhglm_sim(n, m_per_level, sd_intercept, sd_slope, family = c("gaussian","binomial"), seed)
Arguments
n: an integer scalar, the number of observations at the lowest grouping level.
m_per_level: an integer vector, the number of grouping levels nested under the level above.
sd_intercept: a numeric vector, the standard deviations of the intercept random effects.
sd_slope: a numeric vector, the standard deviations of the slope random effects.
family: a character scalar, either "gaussian" or "binomial".
seed: a single value, interpreted as an integer, or NULL as in set.seed.
Details
returns a data.frame with design matrix, response, and group levels.