mhglm_sim: Simulate response patterns

Description Usage Arguments Details Examples

Description

Simulate response patterns for generalized linear models of gaussian or binomial families, with both an intercept and slope covariate. Used primarily for testing purposes.

Usage

1
2
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.

Examples

1
2
3
4
5
mhglm_sim(n = 2, m_per_level = c(3, 3), sd_intercept = c(1, 2), 
        sd_slope = c(2, 1), family = "gaussian", seed = 123)

mhglm_sim(n = 2, m_per_level = c(3, 3), sd_intercept = c(1, 2), 
        sd_slope = c(2, 1), family = "binomial", seed = 123)

mbest documentation built on May 2, 2019, 2:14 p.m.