Skip to content

Instantly share code, notes, and snippets.

@njtierney
Created March 19, 2024 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njtierney/d7adc0d8f551be795e489a80e7c1cae9 to your computer and use it in GitHub Desktop.
Save njtierney/d7adc0d8f551be795e489a80e7c1cae9 to your computer and use it in GitHub Desktop.
library(conmat)
library(socialmixr)
library(tidyverse)
countries_of_interest <- c("Italy", "Spain")
list_countries <- map(countries_of_interest,
\(x) wpp_age(x, years = 2015))
list_conmat_pop <- map(
.x = list_countries,
.f = function(x) as_conmat_population(x,
age = lower.age.limit,
population = population)
) %>%
set_names(countries_of_interest)
new_age_breaks <- c(seq(0, 80, by = 5), Inf)
list_contact_matrices <- map(
.x = list_conmat_pop,
.f = function(x) extrapolate_polymod(x,
age_breaks = new_age_breaks)
) %>%
set_names(countries_of_interest)
list_contact_matrices$Italy$home
list_contact_matrices$Italy$work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment