mhglm_sim {mbest}R Documentation

Simulate response patterns

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

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

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)

[Package mbest version 0.6 Index]