Compute likelihood

log_likelihood(
  pars,
  n,
  k,
  cap,
  infected,
  observed,
  population,
  tested_population,
  rng,
  n_threads = 1L,
  chunk_size = NULL
)

Arguments

pars

Named list of parameters. Must have elements a_bar, a_sigma, b_bar, b_sigma, tmax_bar, tmax_sigma, log_vlmax_bar, log_vlmax_sigma

n

number of days to truncate infectiousness at

k

index of the viral load equation to use

cap

whether to apply a cap to the value of the maximum viral load to avoid NAN errors

infected

Vector of number of simulated infections. Must have length observed$size_full (this is checked)

observed

An observed object, created by prepare_observed

population

Integer, size of population

tested_population

Integer, size of tested population

rng

A random number pointer, created by dust::dust_rng_pointer

n_threads

Number of threads to run on, if openmp available. See dust::dust_openmp_threads for guidance

chunk_size

The size of the chunks to run the parallel jobs in. The optimal value here will vary depending on your problem and number of threads. '5' seems like a good guess.

Value

A single numeric log-likelihood value