Using other data soruces
other-data-sources.Rmd
library(conmat)
The primary goal of the conmat package is to be able to get a contact matrix for a given age population. It was initially written for work done in Australia, and so the initial focus was on cleaning and extracting data from the Australian Bureau of Statistics.
This vignette focusses on using other data sources with conmat.
We can use some other functions from socialmixr
to
extract similar estimates for different populations in different
countries.
We could extract some data from Italy using the socialmixr
R
package
library(socialmixr)
#>
#> Attaching package: 'socialmixr'
#> The following object is masked from 'package:utils':
#>
#> cite
italy_2005 <- wpp_age("Italy", "2005")
head(italy_2005)
#> country lower.age.limit year population
#> 1 Italy 0 2005 2758749
#> 2 Italy 5 2005 2712790
#> 3 Italy 10 2005 2815246
#> 4 Italy 15 2005 2917476
#> 5 Italy 20 2005 3168918
#> 6 Italy 25 2005 3786584
We can then convert this data into a conmat_population
object and use it in extrapolate_polymod
italy_2005_pop <- as_conmat_population(
data = italy_2005,
age = lower.age.limit,
population = population
)
italy_contact <- extrapolate_polymod(
italy_2005_pop
)
italy_contact
#>
#> ── Setting Prediction Matrices ─────────────────────────────────────────────────
#> A list of matrices containing the model predicted contact rate between ages in
#> each setting.
#> • home: a 16x16 <matrix>
#> • work: a 16x16 <matrix>
#> • school: a 16x16 <matrix>
#> • other: a 16x16 <matrix>
#> • all: a 16x16 <matrix>
#> ℹ Access each <matrix> with `x$name`
#> ℹ e.g., `x$home`