brmid: Interface for infectious disease modelling using brms.

idbrmR Documentation

Interface for infectious disease modelling using brms.

Description

Interface for infectious disease modelling using brms.

Usage

idbrm(data, formula, family, priors, custom_stancode, dry = FALSE, ...)

Arguments

data

A data frame as prepared for modelling using prepare with a class associated with the model prepared for.

formula

A formula as defined using id_formula or as supported by brms::brm.

family

A observation model family as defined in brms.

priors

A list of priors as defined using brms or id_priors. Defaults to the the id_priors defined for the model class being fit.

custom_stancode

A list of stanvars used to define custom stancode in brms. By default uses the code designed for the model class being fit (as specified using id_stancode).

dry

Logical, defaults to TRUE. For testing purposes should just the stan code be output with not fitting done.

...

Additional arguments to pass to brms::brm.

Author(s)

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[, deaths := as.integer(shift(cases, 5) * 0.1)]
dt[is.na(deaths), deaths := 0]

dt <- prepare(
  dt, model = "convolution", location = "region",
  primary = "cases", secondary = "deaths",
  )

# fit the convolution model using a Poisson observation model
fit <- idbrm(data = dt, family = poisson(link = "identity"))


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