construct_re | R Documentation |
Constructs random effect terms
construct_re(re, data)
re |
A random effect as defined using |
data |
A |
A list containing the transformed data ("data"),
fixed effects terms ("terms") and a data.frame
specifying
the random effect structure between these terms (effects
). Note
that if the specified random effect was not a factor it will have been
converted into one.
Functions used to help convert formulas into model designs
as_string_formula()
,
construct_rw()
,
enw_formula()
,
enw_manual_formula()
,
parse_formula()
,
re()
,
remove_rw_terms()
,
rw()
,
rw_terms()
,
split_formula_to_terms()
# Simple examples
form <- epinowcast:::parse_formula(~ 1 + (1 | day_of_week))
data <- enw_example("prepr")$metareference[[1]]
random_effect <- re(form$random[[1]])
epinowcast:::construct_re(random_effect, data)
# A more complex example
form <- epinowcast:::parse_formula(
~ 1 + disp + (1 + gear | cyl) + (0 + wt | am)
)
random_effect <- re(form$random[[1]])
epinowcast:::construct_re(random_effect, mtcars)
random_effect2 <- re(form$random[[2]])
epinowcast:::construct_re(random_effect2, mtcars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.