inference | R Documentation |
MCMC based inference of the parameter values given the different data sets
inference(demography, ili, mon_pop, n_pos, n_samples, vaccine_calendar, polymod_data, initial, parameter_map, age_groups, age_group_map, risk_group_map, risk_ratios, lprior, lpeak_prior, nburn = 0, nbatch = 1000, blen = 1, depth = 3, abs_err)
demography |
A vector with the population size by each age 0,1,.. |
ili |
The number of Influenza-like illness cases per week |
mon_pop |
The number of people monitored for ili |
n_pos |
The number of positive samples for the given strain (per week) |
n_samples |
The total number of samples tested |
vaccine_calendar |
A vaccine calendar valid for that year |
polymod_data |
Contact data for different age groups |
initial |
Vector with starting parameter values or one can pass the results of a previous fit to continue from those results |
parameter_map |
Optional mapping parameter (by description and age group) to the relevant index
in the initial vector. Needed parameters are: epsilon (ascertainment) with a separate value per data
age group, transmissibility, psi (infection from outside sources), susceptibility (with a value per age group)
and log of initial_infected population |
age_groups |
Optional age groups upper limits used in your model and data. If you use different age groups for the model and the data you need to provide a age_group_map instead. |
age_group_map |
Optional age group mapping from model age groups to data age groups ( |
risk_group_map |
Optional risk group mapping from model risk groups to data risk groups ( |
risk_ratios |
A matrix with the fraction in the risk groups. The leftover fraction is assumed to be low risk. ( |
lprior |
Optional function returning the log prior probability of the parameters. If no function is passed then a flat prior is used. |
lpeak_prior |
Optional function to include prior knowledge on the peak time and height. This function should accept a time and height (no. of infected in the population) and return a log likelihood value for those values. |
nburn |
Number of iterations of burn in |
nbatch |
Number of batches to run (number of samples to return) |
blen |
Length of each batch |
depth |
Obsolete, use abs_err instead. The depth of the likelihood approximation. Higher values result in better approximations. The default value is 3. |
abs_err |
The absolute error of the likelihood approximation. Lower values are more precise at the cost of performance. Default value is 1e-5. |
The method we use here combines data from numerous sources that are then used to compute the likelihood of the predicted
number of influenza cases in a given week. Given the data and the likelihood function we use MCMC to obtain the posterior
distribution of the parameters of an underlying epidemiological model (see also: infectionODEs
).
When running inference there are four main steps needed are 1) prepare the data, 2) load a vaccination calendar (as_vaccination_calendar
)
3) decide on parameterisation of the model (https://blackedder.github.io/flu-evidence-synthesis/modelling.html) and 4) run the inference using
this function.
The initial parameters vector should contain values for the parameters (in order):
Ascertainment probabilty for each age group (epsilon)
Outside infection (psi)
Transmissibility
Susceptibility for each age group
Initial number of infections (log transformed)
If your model is more complex and the number of age groups and risk groups are different between the epidemiological model (vaccination calendar) and the influenza data then you need to
provide (one or more of) the following extra variables to the function: parameter_map
(see also: parameter_mapping
), age_group_map
(see also:
age_group_mapping
) and risk_group_map
(see also: risk_group_mapping
).
See https://blackedder.github.io/flu-evidence-synthesis/inference.html for more details.
Returns a list with the accepted samples and the corresponding llikelihood values and a matrix (contact.ids) containing the ids (row number) of the contacts data used to build the contact matrix.
infectionODEs
; age_group_mapping
; risk_group_mapping
; parameter_mapping
; https://blackedder.github.io/flu-evidence-synthesis/inference.html
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.