construct_rw: Constructs random walk terms

construct_rwR Documentation

Constructs random walk terms


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.


construct_rw(rw, data)



A random walk term as defined by rw().


A data.frame of observations used to define the random walk term. Must contain the time and grouping variables defined in the rw() term specified.


A list containing the following:

  • data: The input data.frame with the addition of the new variables required by the specified random walk. These are added using enw_add_cumulative_membership(). -terms: A character vector of new fixed effects terms to add to a model formula.

  • effects: A data.frame describing the random effect structure of the new effects.

See Also

Functions used to help convert formulas into model designs as_string_formula(), construct_re(), enw_formula(), enw_manual_formula(), parse_formula(), re(), remove_rw_terms(), rw(), rw_terms(), split_formula_to_terms()


data <- enw_example("preproc")$metareference[[1]]

epinowcast:::construct_rw(rw(week), data)

epinowcast:::construct_rw(rw(week, day_of_week), data)

seabbs/epinowcast documentation built on July 17, 2024, 5:18 p.m.