extract_equation {LearnVizLMM} | R Documentation |
extract_equation()
takes the nlme::lme()
or lme4::lmer()
code for
fitting a linear mixed effect model and returns the corresponding model
equation written in 'LaTeX' notation.
extract_equation(
model,
cat_vars = NULL,
cat_vars_nlevels = NULL,
output_type = "latex"
)
model |
Code for fitting a |
cat_vars |
Optional character vector of the names of categorical
predictor variables included in the |
cat_vars_nlevels |
Optional numeric vector of the number of levels (i.e.
categories) for each variable in |
output_type |
Output type can be |
None (invisible NULL) (output_type = "latex"
), a string
(output_type = "string"
), or no output (output_type = "none"
).
# Different ways to write the same lme model
extract_equation(model = "lme(score ~ age, random=~age|subject)")
extract_equation(model = "lme(score ~ age, random=list(subject=~age))")
# Correlated vs. Uncorrelated
extract_equation(model = "lmer(score ~ age + (age|subject))")
extract_equation(model = "lmer(score ~ age + (age||subject))")
# Add a categorical predictor and interaction
extract_equation(model = "lmer(score ~ age*treat + (age|subject))",
cat_vars = "treat",
cat_vars_nlevels = 3)