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(). Mathematically a Gaussian random walk is exactly an ARIMA(0, 1, 0) process; rw(time, by, type) is now a thin wrapper over arima() with p = 0, d = 1, q = 0. It is kept as a user-facing convenience because random walks are the most common time-series structure in epinowcast formulas.

Usage

rw(time, by)

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. Each group draws an independent shock series; the latent standard deviation is shared across groups (per-group standard deviations are a planned extension).

Value

A list of class enw_arima_term (with p = 0, d = 1, q = 0) that can be interpreted by construct_arima().

Details

Does not evaluate arguments but instead simply passes information for use in model construction.

Examples

rw(time)
#> $time
#> [1] "time"
#> 
#> $by
#> NULL
#> 
#> $p
#> [1] 0
#> 
#> $d
#> [1] 1
#> 
#> $q
#> [1] 0
#> 
#> attr(,"class")
#> [1] "enw_arima_term"

rw(time, location)
#> $time
#> [1] "time"
#> 
#> $by
#> [1] "location"
#> 
#> $p
#> [1] 0
#> 
#> $d
#> [1] 1
#> 
#> $q
#> [1] 0
#> 
#> attr(,"class")
#> [1] "enw_arima_term"

rw(time, location)
#> $time
#> [1] "time"
#> 
#> $by
#> [1] "location"
#> 
#> $p
#> [1] 0
#> 
#> $d
#> [1] 1
#> 
#> $q
#> [1] 0
#> 
#> attr(,"class")
#> [1] "enw_arima_term"