Create model formulas with every combination of your fixed effects, along with the dependent variable and random effects. 259,358 formulas have been precomputed with two- and three-way interactions for up to 8 fixed effects, with up to 5 included effects per formula. Uses the + and * operators, so lower order interactions are automatically included.
dependent: Name of dependent variable. (Character)
fixed_effects: list of fixed effects. (Character)
Max. limit of 8 effects when interactions are included !
A fixed effect name cannot contain: white spaces, "*" or "+".
Effects in sublists will be interchanged. This can be useful, when we have multiple versions of a predictor (e.g. x1 and log(x1)) that we do not wish to have in the same formula.
Example of interchangeable effects:
list( list( "x1", "log_x1" ), "x2", "x3" )
random_effects: The random effects structure. (Character)
Is appended to the model formulas.
max_fixed_effects: Maximum number of fixed effects in a model formula. (Integer)
Max. limit of 5 when interactions are included !
max_interaction_size: Maximum number of effects in an interaction. (Integer)
Max. limit of 3.
Use this to limit the n-way interactions allowed. 0 or 1 excludes interactions all together.
A model formula can contain multiple interactions.
max_effect_frequency: Maximum number of times an effect is included in a formula string.
Returns
list of model formulas.
E.g.:
c("y ~ x1 + (1|z)", "y ~ x2 + (1|z)", "y ~ x1 + x2 + (1|z)", "y ~ x1 *x2 + (1|z)").
Examples
# Attach packageslibrary(cvms)# Create effect namesdependent <-"y"fixed_effects <- c("a","b","c")random_effects <-"(1|e)"# Create model formulascombine_predictors( dependent, fixed_effects, random_effects
)# Create effect names with interchangeable effects in sublistsfixed_effects <- list("a", list("b","log_b"),"c")# Create model formulascombine_predictors( dependent, fixed_effects, random_effects
)