idbrm.idbrms_convolution | R Documentation |
A model that assumes that a secondary observations can be predicted using a convolution of a primary observation multipled by some scaling factor. An example use case of this model is to estimate the case fatality rate (with the primary observation being cases and the secondary observation being deaths) and then explore factors that influence it.
## S3 method for class 'idbrms_convolution' idbrm( data, formula = id_formula(data), family = negbinomial(link = "identity"), priors = id_priors(data), custom_stancode = id_stancode(data), dry = FALSE, ... )
data |
A data.frame as produced by |
formula |
A formula as defined using |
family |
A observation model family as defined in |
priors |
A list of priors as defined using |
custom_stancode |
A list of |
dry |
Logical, defaults to TRUE. For testing purposes should just the
|
... |
Additional parameters passed to |
A "brmsfit" object or stan code (if dry = TRUE
).
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[, 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.