Learn R Programming

epidemia (version 1.0.0)

rw: Adds random walks with independent Gaussian steps to the parameterization of the time-varying reproduction number.

Description

A call to rw can be used in the 'formula' argument of epim, allowing random walks for the reproduction number. Does not evaluate arguments. Simply creates a list with the information needed for the stan data to be parsed correctly.

Usage

rw(time, gr, prior_scale = 0.2)

Arguments

time

An optional name defining the random walk time periods for each date and group. This must be a column name found in the data argument to epim. If not specified, determined by the dates column implied by the formula argument to epim is used.

gr

Same as for time, except this defines the grouping to use for the random walks. A separate walk is defined for each group. If not specified a common random walk is used for all groups.

prior_scale

The steps of the walks are independent zero mean normal with an unknown scale hyperparameter. This scale is given a half-normal prior. prior_scale sets the scale parameter of this hyperprior.

Value

A list to be parsed internally.

Examples

Run this code
# NOT RUN {
data("EuropeCovid")
args <- EuropeCovid
args$formula <- R(country, date) ~ 1 + rw(gr=country) + lockdown
# }

Run the code above in your browser using DataLab