lme4_to_glmmr {glmmrBase} | R Documentation |
Map lme4 formula to glmmrBase formula
Description
Returns a formula that can be used for glmmrBase Models from an lme4 input.
Usage
lme4_to_glmmr(formula, cnames)
Arguments
formula |
A lme4 style formula |
cnames |
The column names of the data to be used. These are used to check if the specified clustering variables are in the data. |
Details
The package lme4 uses a syntax to specify random effects as '(1|x)' where 'x' is the grouping variable. This function will modify such a formula, including those with nesting and crossing operators '/' and ':' into the glmmrBase syntax using the 'gr()' function. Not typically required by the user as it is used internally in the 'mcml_lmer' and 'mcml_glmer' functions.
Value
A formula.
Examples
df <- data.frame(cl = 1:3, t = 4:6)
f1 <- lme4_to_glmmr(y ~ x + (1|cl/t),colnames(df))
[Package glmmrBase version 0.9.2 Index]