prepare.idbrms_convolution | R Documentation |
Prepare data for fitting using a convolution model
## S3 method for class 'idbrms_convolution' prepare( data, location, primary, secondary, initial_obs = 14, max_convolution = 30, ... )
data |
A data frame containing at least two integer observations and a date variable. |
location |
Character string, variable to use as the spatial location. |
primary |
Character string, variable to use as the primary observation. |
secondary |
Character string, variable to use as the secondary observation. |
initial_obs |
Integer, number of observations to hold out from the likelihood. This is useful as initially the outcome will depend on primary data outside of the range of the training set and including this could bias the estimated delay distribution. Defaults to 14 days. |
max_convolution |
Integer defining the maximum index to use for the convolution. Defaults to 30 days. |
... |
Additional arguments passed to model specific prepare functions |
Sam Abbott
# define some example data library(data.table) dt <- data.table( region = "France", cases = seq(10, 500, by = 10), date = seq(as.Date("2020-10-01"), by = "days", length.out = 50) ) dt <- dt[, deaths := as.integer(shift(cases, 5) * 0.1)] dt <- dt[is.na(deaths), deaths := 0] dt <- prepare( dt, model = "convolution", location = "region", primary = "cases", secondary = "deaths", ) dt[]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.