generate_ngm | R Documentation |
Once infected, a person can transmit an infectious disease to
another, creating generations of infected individuals. We can define a
matrix describing the number of newly infected individuals in given
categories, such as age, for consecutive generations. This matrix is
called a "next generation matrix" (NGM). We can generate an NGM from two
sources - a conmat_population
object (such as the output from
abs_age_lga()
), or a conmat_setting_prediction_matrix
, which is the
output from extrapolate_polymod()
or predict_setting_contacts()
.
generate_ngm(x, age_breaks, R_target, setting_transmission_matrix, ...)
## S3 method for class 'conmat_setting_prediction_matrix'
generate_ngm(
x,
age_breaks,
R_target,
setting_transmission_matrix = NULL,
per_capita_household_size = NULL,
...,
lga_name,
state_name
)
## S3 method for class 'conmat_population'
generate_ngm(
x,
age_breaks,
R_target,
setting_transmission_matrix = NULL,
per_capita_household_size = NULL,
...,
lga_name,
state_name
)
x |
data input - could be a |
age_breaks |
vector depicting age values with the highest age depicted
as |
R_target |
target reproduction number |
setting_transmission_matrix |
default is NULL, which calculates the transmission
matrix using |
... |
extra arguments, currently not used |
per_capita_household_size |
default is NULL - which defaults to |
lga_name |
now defunct, but capturing arguments for informative error |
state_name |
now defunct, but capturing arguments for informative error |
The NGM can be used to calculate the expected number of secondary infections in a given age group. Given certain age breaks, we compute the unscaled next generation matrices for that location across different settings & age groups using the contact rates extrapolated from POLYMOD survey data on the specified location, adjusted by the per capita household size and the setting-specific relative per-contact transmission probability matrices for the same age groups. These NGMs are then scaled according to a target reproduction number (which is provided as an argument) using the ratio of the desired R0 and the R0 of the NGM for the combination of all settings. The R0 of the combination of all settings is obtained by calculating the unique, positive eigen value of the combination NGM. This ratio is then used to scale all the setting specific NGMs.
A next generation matrix, containing the rates of contact between two age groups.
When using a setting prediction contact matrix (such as one generated
by extrapolate_polymod
, with class conmat_setting_prediction_matrix
),
the age breaks specified in generate_ngm
must be the same as the age
breaks specified in the synthetic contact matrix, otherwise it will error
as it is trying to multiple incompatible matrices.
## Not run:
perth <- abs_age_lga("Perth (C)")
perth_hh <- get_abs_per_capita_household_size(lga = "Perth (C)")
age_breaks_0_80_plus <- c(seq(0, 80, by = 5), Inf)
# you can also run this without `per_capita_household_size`
perth_ngm_lga <- generate_ngm(
perth,
age_breaks = age_breaks_0_80_plus,
per_capita_household_size = perth_hh,
R_target = 1.5
)
perth_contact <- extrapolate_polymod(
perth,
per_capita_household_size = perth_hh
)
perth_ngm <- generate_ngm(
perth_contact,
age_breaks = age_breaks_0_80_plus,
R_target = 1.5
)
# using our own transmission matrix
new_transmission_matrix <- get_setting_transmission_matrices(
age_breaks = age_breaks_0_80_plus,
# is normally 0.5
asymptomatic_relative_infectiousness = 0.75
)
new_transmission_matrix
perth_ngm_0_80_new_tmat <- generate_ngm(
perth_contact,
age_breaks = age_breaks_0_80_plus,
R_target = 1.5,
setting_transmission_matrix = new_transmission_matrix
)
## End(Not run)
# examples not run as they take a long time
## Not run:
perth <- abs_age_lga("Perth (C)")
perth_contact <- extrapolate_polymod(perth)
generate_ngm(perth_contact, age_breaks = c(seq(0, 85, by = 5), Inf))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.