Skip to contents

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().

Usage

generate_ngm(x, age_breaks, R_target, setting_transmission_matrix, ...)

# S3 method for 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 conmat_population
generate_ngm(
  x,
  age_breaks,
  R_target,
  setting_transmission_matrix = NULL,
  per_capita_household_size = NULL,
  ...,
  lga_name,
  state_name
)

Arguments

x

data input - could be a conmat_population (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().

age_breaks

vector depicting age values with the highest age depicted as Inf. For example, c(seq(0, 85, by = 5), Inf)

R_target

target reproduction number

setting_transmission_matrix

default is NULL, which calculates the transmission matrix using get_setting_transmission_matrices(age_breaks). You can provide your own transmission matrix, but its rows and columns must match the number of rows and columns, and must be a list of one matrix for each setting. See the output for get_setting_transmission_matrices(age_breaks) to get a sense of the structure. See get_setting_transmission_matrices() for more detail.

...

extra arguments, currently not used

per_capita_household_size

default is NULL - which defaults to get_polymod_per_capita_household_size(), which gives 3.248971

lga_name

now defunct, but capturing arguments for informative error

state_name

now defunct, but capturing arguments for informative error

Details

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.

Note

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.

Examples

if (FALSE) {
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
)
}
# examples not run as they take a long time
if (FALSE) {
perth <- abs_age_lga("Perth (C)")
perth_contact <- extrapolate_polymod(perth)
generate_ngm(perth_contact, age_breaks = c(seq(0, 85, by = 5), Inf))
}