
Last chance! 50% off unlimited learning
Sale ends in
A wrapper for Model stochastic maximum likelihood model fitting replicating lme4's syntax
mcml_glmer(
formula,
data,
family,
start = NULL,
offset = NULL,
verbose = 1L,
iter.warmup = 100,
iter.sampling = 50,
weights = NULL,
...
)
A `mcml` model fit object.
A two-sided linear formula object including both the fixed and random effects specifications, see Details.
A data frame containing the variables named in `formula`.
A family object expressing the distribution and link function of the model, see family.
Optional. A vector of starting values for the fixed effects.
Optional. A vector of offset values.
Integer, controls the level of detail printed to the console, either 0 (no output), 1 (main output), or 2 (detailed output)
The number of warmup iterations for the MCMC sampling step of each iteration.
The number of sampling iterations for the MCMC sampling step of each iteration.
Optional. A vector of observation level weights to apply to the model fit.
additional arguments passed to `Model$MCML()`
This function aims to replicate the syntax of lme4's `lmer` command. The specified formula can be the standard lme4 syntax, or alternatively a glmmrBase style formula can also be used to allow for the wider range of covariance function specifications. For example both `y~x+(1|cl/t)` and `y~x+(1|gr(cl))+(1|gr(cl)*ar1(t))` would be valid formulae.
#create a data frame describing a cross-sectional parallel cluster
#randomised trial
df <- nelder(~(cl(10)*t(5)) > ind(10))
df$int <- 0
df[df$cl > 5, 'int'] <- 1
# simulate data using the Model class
df$y <- Model$new(
formula = ~ factor(t) + int - 1 + (1|gr(cl)) + (1|gr(cl,t)),
data = df,
family = stats::binomial()
)$sim_data()
if (FALSE) {
fit <- mcml_glmer(y ~ factor(t) + int - 1 + (1|cl/t), data = df, family = binomial())
}
Run the code above in your browser using DataLab