Skip to contents

A call to rw() can be used in the 'formula' argument of model construction functions in the epinowcast package such as enw_formula(). Does not evaluate arguments but instead simply passes information for use in model construction.

Usage

rw(time, by, type = c("independent", "dependent"))

Arguments

time

Defines the random walk time period.

by

Defines the grouping parameter used for the random walk. If not specified no grouping is used. Currently this is limited to a single variable.

type

Character string, how standard deviation of grouped random walks is estimated: "independent", or "dependent" across groups; enforced by base::match.arg().

Value

A list defining the time frame, group, and type with class "enw_rw_term" that can be interpreted by construct_rw().

See also

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

Examples

rw(time)
#> $time
#> [1] "time"
#> 
#> $by
#> NULL
#> 
#> $type
#> [1] "independent"
#> 
#> attr(,"class")
#> [1] "enw_rw_term"

rw(time, location)
#> $time
#> [1] "time"
#> 
#> $by
#> [1] "location"
#> 
#> $type
#> [1] "independent"
#> 
#> attr(,"class")
#> [1] "enw_rw_term"

rw(time, location, type = "dependent")
#> $time
#> [1] "time"
#> 
#> $by
#> [1] "location"
#> 
#> $type
#> [1] "dependent"
#> 
#> attr(,"class")
#> [1] "enw_rw_term"