gen_likelihood: Prepare a likelihood function for use in Bayesian calibration

Description Usage Arguments Details Value Likelihood function

View source: R/likelihood.R

Description

Build a function that given a set of model parameters runs the model and computes the log-likelihood for the model.

Usage

1
2
3
4
5
6
7
gen_likelihood(
  hparms,
  fixed_parms = NULL,
  maxdate = NULL,
  verbose = FALSE,
  waicmode = FALSE
)

Arguments

hparms

Hyperparameters for the calculation, as described in gen_post

fixed_parms

A named vector of parameters to use as fixed values for parameters not passed to the likelihood function. Note these "fixed" parameters can still be overridden by passing an explicit value.

maxdate

Last date to use in the calibration. Default is 2020-06-30

verbose

If TRUE, print additional diagnostic information.

waicmode

If TRUE, generate a function that returns the likelihood contributions from each data point.

Details

The observational data is the daily county-by-county reports of new confirmed COVID-19 cases. We are using the New York Times dataset (https://github.com/nytimes/covid-19-data), which is based on reports from state departments of health, including the VDH. For statistics on COVID-19 testing, we use the vacovdata dataset, which was compiled by the COVID Tracking project (https://covidtracking.com/).

The model parameters currently recognized are:

eta

(real) Log of the baseline transmissibility

xi

(real) Coefficient of population density in log-transmissibility

D0

(real > 0) The initial average infection duration

A0

(real > 0) The average incubation time

Ts

(real > 0) The average time from infection to symptom onset. Note that this parameter is probably not identifiable with our current data.

b

(real > 0) The testing bias factor. That is, the positive test rate divided by the true infection rate. b can be different from 1 because of false positives or because testing is targeted to people suspected of having the disease. (Generally, we expect b>1, but we don't require this.)

I0

(real > 0) The initial number of infected people, once the infection starts. This is taken to be the same in all counties.

For the time being, we start tracking the infection in Fairfax county on day 30, and all of the counties are delayed relative to Fairfax by a number of days equal to the difference between their first observed case and the first case observed in Fairfax.

To compute the likelihood, our assumption is that the output of the model represents an average infection rate. The average observation rate is then

\bar{N}_o = \bar{N}_I f_t b,

where f_t is the fraction of the total population tested. We then assume that the actual observations are distributed as

N_o \sim Pois(\bar{N}_o).

Value

A function that takes a named list of model parameters and returns a log-likelihood value. See details for the parameters recognized and the output of the function returned.

Likelihood function

By default, the function produced will return a single value, which is the sum of

Technically, the latter two are priors, since they don't depend on the observations, but the model must be run in order to compute them, so they are computed here.

If the waicmode flag is set, then the function will return detailed information on the contribution of each data point to the log-likelihood. The result will be a data frame containing

Additionally, the antibody prevalence and symptomatic fraction corrections will be attached to the data frame as attributes (hfadjust and fsadjust).

The default mode output can be used in optimizations or Markov chain Monte Carlo. The waicmode output is useful for computing the WAIC, or for diagnosing which counties and/or days are favoring one model over another.


rplzzz/CovMitigation documentation built on June 7, 2021, 8:48 a.m.