This function takes random walks as defined
by rw(), produces the required additional variables
(denoted using a "c" prefix and constructed using
enw_add_cumulative_membership()), and then returns the
extended data.frame along with the new fixed effects and the
random effect structure.
Value
A list containing the following:
data: The inputdata.framewith the addition of the new variables required by the specified random walk. These are added usingenw_add_cumulative_membership(). -terms: A character vector of new fixed effects terms to add to a model formula.effects: Adata.framedescribing the random effect structure of the new effects.
See also
Functions used to help convert formulas into model designs
ar(),
arima(),
arima_terms(),
arma(),
as_string_formula(),
construct_arima(),
construct_gp(),
construct_re(),
enw_formula(),
enw_manual_formula(),
gp(),
gp_terms(),
ma(),
parse_formula(),
re(),
remove_arima_terms(),
remove_gp_terms(),
remove_rw_terms(),
rw(),
rw_terms(),
split_formula_to_terms()
Examples
data <- enw_example("preproc")$metareference[[1]]
epinowcast:::construct_rw(rw(week), data)
#> $time
#> [1] "week"
#>
#> $by
#> NULL
#>
#> $p
#> [1] 0
#>
#> $d
#> [1] 1
#>
#> $q
#> [1] 0
#>
#> $T
#> [1] 6
#>
#> $G
#> [1] 1
#>
#> $time_idx
#> [1] 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6
#> [39] 6 6
#>
#> $group_idx
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [39] 1 1
#>
#> $time_vals
#> [1] 0 1 2 3 4 5
#>
#> $group_levels
#> [1] "1"
#>
#> $name
#> [1] "arima__week"
#>
epinowcast:::construct_rw(rw(week, day_of_week), data)
#> $time
#> [1] "week"
#>
#> $by
#> [1] "day_of_week"
#>
#> $p
#> [1] 0
#>
#> $d
#> [1] 1
#>
#> $q
#> [1] 0
#>
#> $T
#> [1] 6
#>
#> $G
#> [1] 7
#>
#> $time_idx
#> [1] 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6
#> [39] 6 6
#>
#> $group_idx
#> [1] 7 5 1 3 4 2 6 7 5 1 3 4 2 6 7 5 1 3 4 2 6 7 5 1 3 4 2 6 7 5 1 3 4 2 6 7 5 1
#> [39] 3 4
#>
#> $time_vals
#> [1] 0 1 2 3 4 5
#>
#> $group_levels
#> [1] "Friday" "Monday" "Saturday" "Sunday" "Thursday" "Tuesday"
#> [7] "Wednesday"
#>
#> $name
#> [1] "arima__week__day_of_week"
#>
