View source: R/aggregate_predicted_contacts.R
aggregate_predicted_contacts | R Documentation |
Aggregates contacts rate from, say, a 1 year level into
provided age breaks, weighting the contact rate by the specified age
population. For example, if you specify breaks as c(0, 5, 10, 15, Inf),
it will return age groups as 0-5, 5-10, 10-15, and 15+ (Inf). Used
internally within predict_contacts()
, although can be used by users.
aggregate_predicted_contacts(
predicted_contacts_1y,
population,
age_breaks = c(seq(0, 75, by = 5), Inf)
)
predicted_contacts_1y |
contacts in 1 year breaks (could technically
by in other year breaks). Data must contain columns, |
population |
a |
age_breaks |
vector of ages. Default: c(seq(0, 75, by = 5), Inf) |
data frame with columns, age_group_from
, age_group_to
, and
contacts
, which is the aggregated model.
fairfield <- abs_age_lga("Fairfield (C)")
fairfield
# We can predict the contact rate for Fairfield from the existing contact
# data, say, between the age groups of 0-15 in 5 year bins for school:
fairfield_contacts_1 <- predict_contacts_1y(
model = polymod_setting_models$home,
population = fairfield,
age_min = 0,
age_max = 15
)
fairfield_contacts_1
aggregated_fairfield <- aggregate_predicted_contacts(
predicted_contacts_1y = fairfield_contacts_1,
population = fairfield,
age_breaks = c(0, 5, 10, 15, Inf)
)
aggregated_fairfield
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.