This function uses a series internal functions
to break an input formula into its component parts each of which
can then be handled separately. Currently supported components are
fixed effects, lme4 style random effects, and random walks
using the rw()
helper function.
Reference
The random walk functions used internally by this function were
adapted from code written by J Scott (under an MIT license) as part of
the epidemia
package (https://github.com/ImperialCollegeLondon/epidemia/).
See also
Functions used to help convert formulas into model designs
as_string_formula()
,
construct_re()
,
construct_rw()
,
enw_formula()
,
enw_manual_formula()
,
re()
,
remove_rw_terms()
,
rw()
,
rw_terms()
,
split_formula_to_terms()
Examples
epinowcast:::parse_formula(~ 1 + age_group + location)
#> $fixed
#> [1] "1" "age_group" "location"
#>
#> $random
#> NULL
#>
#> $rw
#> character(0)
#>
epinowcast:::parse_formula(~ 1 + age_group + (1 | location))
#> $fixed
#> [1] "1" "age_group"
#>
#> $random
#> $random[[1]]
#> 1 | location
#>
#>
#> $rw
#> character(0)
#>
epinowcast:::parse_formula(~ 1 + (age_group | location))
#> $fixed
#> [1] "1"
#>
#> $random
#> $random[[1]]
#> age_group | location
#>
#>
#> $rw
#> character(0)
#>
epinowcast:::parse_formula(~ 1 + (1 | location) + rw(week, location))
#> $fixed
#> [1] "1"
#>
#> $random
#> $random[[1]]
#> 1 | location
#>
#>
#> $rw
#> [1] "rw(week, location)"
#>