prepare: Prepare data for modelling with idbrm

View source: R/methods.R

prepareR Documentation

Prepare data for modelling with idbrm

Description

Prepare data for modelling with idbrm

Default method used when preparing data

Usage

prepare(data, ...)

## Default S3 method:
prepare(data, model, ...)

Arguments

data

A dataframe to be used for modelling

...

Additional arguments passed to model specific prepare functions

model

Character string, model type to prepare to use. Supported options are "convolution".

Author(s)

Sam Abbott

Sam Abbott

Examples

# 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[]

epiforecasts/brms.id documentation built on Sept. 6, 2022, 3:40 a.m.