Estimates a real-time case fatality ratio from line-list data. Each case is
fatal with probability cfr and, when fatal, dies at an onset-to-death
delay; cases still alive at the cut-off are right-censored, correcting the
downward bias of the naive deaths / cases ratio. The delay and the CFR prior
are given as distspec distributions.
Arguments
- data
Output of
prepare_cfr_data(), or anepidist_cure_model/ data frame withy,outcome,pwindow,swindow.- delay
Onset-to-death delay as a distspec distribution (
distspec::LogNormal()ordistspec::Gamma()) whose native parameters are fixed numbers orNormal()priors.- cfr_prior
CFR prior as a
distspec::Beta(). Defaults toBeta(1, 1).- recovery_delay
Optional onset-to-recovery delay (same form as
delay) for the two-outcome fit; may use a different family fromdelay.- formula
A
brmsformula for the delay locationmuand, optionally, the CFR (cfr ~ ...). Defaults tomu ~ 1. Thecfr_priornormally lands on the CFR intercept; when the CFR formula drops the intercept (e.g.cfr ~ 0 + group, one logit-CFR per group) it is placed on those coefficients instead. It then applies to everycfrcoefficient, so an intercept-free formula should carry only factor terms.- ...
Passed to
epidist::epidist()and on tobrms::brm()(e.g.chains,iter,backend,seed).
Value
A brmsfit with class cfrnow_fit; summarise with cmdstanr::summary().
Details
The delay's native parameters may each be a fixed number (held fixed; fixing
the whole delay gives the Ghani/Nishiura estimator) or a Normal() prior
(co-estimated). The family (LogNormal() or Gamma()) sets the delay
distribution. cfr_prior is a Beta(); it matters because the CFR is weakly
identified early on (Beta(1, 1) is uniform, Beta(1, 9) favours a low CFR,
Beta(6.6, 13.4) suits a high-fatality pathogen).
The model is fitted through epidist::epidist(), so covariates (or a smooth
time effect) can be put on the CFR or the delay through formula, e.g.
formula = brms::bf(mu ~ 1, cfr ~ age). When the line list carries recovery
dates, pass a recovery_delay to fit the two-outcome model that also times
recoveries.
See also
Other fit:
pp_check_cfr(),
summary.cfrnow_fit()
Examples
if (FALSE) { # \dontrun{
ll <- simulate_linelist(n = 500, cfr = 0.4, delay = LogNormal(2.4, 0.5))
d <- prepare_cfr_data(ll, obs_time = max(ll$onset_date) - 5)
otd <- LogNormal(meanlog = Normal(2.41, 0.2), sdlog = Normal(0.51, 0.15))
# co-estimated delay
fit <- fit_cfr(d, delay = otd, cfr_prior = Beta(1, 1), backend = "cmdstanr")
summary(fit)
# fixed delay (Ghani/Nishiura), a gamma family, and a CFR covariate
fit_cfr(d, delay = LogNormal(meanlog = 2.41, sdlog = 0.51))
fit_cfr(d, delay = Gamma(shape = Normal(3.3, 1), rate = Normal(0.26, 0.08)))
fit_cfr(d, delay = otd, formula = brms::bf(mu ~ 1, cfr ~ group))
} # }