LogLikelihood: Likelihood function for Wuhan nCoV-2019

Description Usage Arguments Details Value

View source: R/likelihood.R

Description

This function returns a function encoding the likelihood for the nCoV-2019 model. It assumes Poisson-distributed increments of case reports in China, and Poisson-distributed increments in numbers of infected passengers on planes elsewhere.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
LogLikelihood(
  y,
  z,
  N,
  K,
  W,
  sim_fun,
  phi_mask = (rownames(K) == "Wuhan"),
  agg_up_to = 11
)

Arguments

y

a n \times T matrix of case reports in China

z

a m \times T matrix of case reports elsewhere

N

the population sizes within China, length n

K

the within-China air travel matrix, n \times n

W

the international air travel matrix, n \times m

sim_fun

a function which returns a simulation from a disease model

phi_mask

a vector of 0s and 1s determining which cities in China to apply the underreporting parameter phi to.

agg_up_to

aggregate the first however many case detection records, allowing for a delay in receiving counts from the first few cases.

Details

This function returns a closure – another function that encapsulates the data passed to the containing function. See the return value for the function signature.

Value

a function to calculate the log likelihood. This function has signature logp_fn(params, visualise=FALSE) where params is a vector of parameters c(beta, gamma, I0W, phi). If visualise is TRUE, then parameter values are printed to the console and a graph showing how the ODE mean function matches the observed timeseries (in Wuhan) is displayed. This is useful for tracking the progression of various optimisers.


chrism0dwk/wuhan documentation built on Feb. 16, 2020, 6:01 p.m.