- {
- “cells”: [
- {
“cell_type”: “markdown”, “id”: “inner-diploma”, “metadata”: {}, “source”: [
“# Mixing matricesn”, “n”, “By default the Summer compartmental model assumes that each person in the model comes into contact with every other person at the same rate (homogeneous mixing). This isn’t always true. It may be the case, for example, that children tend to interact more with other children, and less with the elderly (with-like or assortative mixing). This difference in social mixing can be expressed and modelled using a "mixing matrix". A NxN matrix which defines how each N strata of a stratification interact and may infect each other.n”, “n”, “n”, “For example, in a ‘child’/’adult’ stratification, we could have the following mixing matrix (arbitrary numbers):n”, “n”, “| | child | adult |\n", "| — | — | — |\n", "| child | 0.2 | 0.3 |\n", "| adult | 0.5 | 0.7 |\n", "\n", "\n", "In this mixing matrix, the columns are the infectors and the rows the infected. So the above matrix represents the following infector -> infected relationships:\n", "\n", "| | child | adult |\n", "| — | — | — |\n", "| child | child -> child | adult -> child |\n", "| adult | child -> adult | adult -> adult |n”, “n”, “n”, “This worked example may clarify. We will calculate the frequency-dependent infection rates for adults and children using the above mixing matrix. Assume the following scenario:n”, “n”, “- 1000 people, 10 infected, 990 susceptiblen”, “- 80% of the population is adults, 20% are childrenn”, “- So, 800 adults with 792 susceptible and 8 infected; andn”, “- 200 children with 198 susceptible and 2 infectedn”, “n”, “n”, “
`python\n", "child_force_of_inf = 0.2 * 2 / 200 + 0.3 * 8 / 800\n", "adult_force_of_inf = 0.5 * 2 / 200 + 0.7 * 8 / 800\n", "\n", "# Here we assume the contact rate accounts for the use of a mixing matrix .\n", "child_inf_rate = contact_rate * child_force_of_inf * 198\n", "adult_inf_rate = contact_rate * adult_force_of_inf * 792\n", "`n”, “n”, “## Using a mixing matrixn”, “n”, “Let’s start by defining some code to build a model and plot the results:”]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “current-banking”, “metadata”: {}, “outputs”: [], “source”: [
“import numpy as npn”, “import matplotlib.pyplot as pltn”, “from summer import CompartmentalModeln”, “n”, “def build_model():n”, ” """Returns a model for the mixing matrix examples"""n”, ” model = CompartmentalModel(n”, ” times=[0, 20],n”, ” compartments=["S", "I", "R"],n”, ” infectious_compartments=["I"],n”, ” timestep=0.1,n”, ” )n”, ” model.set_initial_population(distribution={"S": 990, "I": 10})n”, ” model.add_infection_frequency_flow(name="infection", contact_rate=2, source="S", dest="I")n”, ” model.add_transition_flow(name="recovery", fractional_rate=1/3, source="I", dest="R")n”, ” model.add_death_flow(name="infection_death", death_rate=0.05, source="I")n”, ” return modeln”, “n”, ” n”, “def plot_compartments(model, times=[]):n”, ” """Plot model compartment sizes over time"""n”, ” fig, ax = plt.subplots(1, 1, figsize=(12, 6), dpi=120)n”, ” for i in range(model.outputs.shape[1]):n”, ” ax.plot(model.times, model.outputs.T[i])n”, “n”, ” for t in times:n”, ” ax.axvline(x=t, color=’k’, linestyle=’–’, alpha=0.3)n”, “n”, ” ax.set_title("SIR Model Outputs")n”, ” ax.set_xlabel("Days")n”, ” ax.set_ylabel("Compartment size")n”, ” start, end = ax.get_xlim()n”, ” ax.xaxis.set_ticks(np.arange(start + 1, end, 5))n”, ” ax.legend([str(c) for c in model.compartments], loc=’upper right’)n”, ” plt.show()”
]
}, {
“cell_type”: “markdown”, “id”: “innocent-mortgage”, “metadata”: {}, “source”: [
“For starters let’s see what our ‘vanilla’ SIR model looks like when not stratified at all”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “seeing-diversity”, “metadata”: {}, “outputs”: [], “source”: [
“# Build and run model without any stratificationn”, “model = build_model()n”, “model.run()n”, “plot_compartments(model)”
]
}, {
“cell_type”: “markdown”, “id”: “amino-frederick”, “metadata”: {}, “source”: [
“A mixing matrix can be added to any "full" stratificiation: which is one that affects all compartments.”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “chinese-cookie”, “metadata”: {}, “outputs”: [], “source”: [
“import numpy as npn”, “from summer import Stratificationn”, “n”, “# Create a stratification named ‘age’, applying to all compartments, whichn”, “# splits the population into ‘young’ and ‘old’.n”, “# Implicitly there is a 50-50 split between young and old.n”, “strata = ["young", "old"]n”, “strat = Stratification(name="age", strata=strata, compartments=["S", "I", "R"])n”, “n”, “# Define a NxN (in this case 2x2) mixing matrix.n”, “# The order of the rows/columns will be the same as n”, “# the order of the strata passed to the Stratificationn”, “age_mixing_matrix = np.array([n”, ” [0.2, 0.3],n”, ” [0.5, 0.7],n”, “]) n”, “n”, “# Add the mixing matrix to the stratificationn”, “strat.set_mixing_matrix(age_mixing_matrix)n”, “n”, “# Build and run model with the stratification we just definedn”, “model = build_model()n”, “model.stratify_with(strat)n”, “model.run()n”, “plot_compartments(model)”
]
}, {
“cell_type”: “markdown”, “id”: “explicit-indian”, “metadata”: {}, “source”: [
“## Time-varying mixing matricesn”, “n”, “You can specify a mixing matrix that varies over time, by using a function of time that returns a mixing matrix:”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “caroline-latitude”, “metadata”: {}, “outputs”: [], “source”: [
“import numpy as npn”, “from summer import Stratificationn”, “n”, “# Create a stratification named ‘age’, applying to all compartments, whichn”, “# splits the population into ‘young’ and ‘old’.n”, “strata = ["young", "old"]n”, “strat = Stratification(name="age", strata=strata, compartments=["S", "I", "R"])n”, “n”, “# An age mixing matrix for ‘normal’ social mixingn”, “normal_mixing_matrix = np.array([n”, ” [0.2, 0.3],n”, ” [0.5, 0.7],n”, “]) n”, “n”, “# An age mixing matrix for ‘age lockdown’: n”, “# - no interaction between young and oldn”, “# - increased interaction inside each groupn”, “lockdown_mixing_matrix = np.array([n”, ” [0.3, 0.0],n”, ” [0.0, 0.8],n”, “]) n”, “n”, “start_lockdown = 3 # Day 3n”, “end_lockdown = 8 # Day 8n”, “n”, “# Define heterogeneous mixing as a function of time.n”, “def get_age_mixing_matrix(time):n”, ” if time <= start_lockdown:n”, ” # Pre lockdown, normal mixingn”, ” return normal_mixing_matrixn”, ” if time <= end_lockdown:n”, ” # Use lockdown mixingn”, ” return lockdown_mixing_matrixn”, ” else:n”, ” # Then after lockdown we go back to normal mixing againn”, ” return normal_mixing_matrixn”, “n”, “# Add the mixing matrix to the stratificationn”, “strat.set_mixing_matrix(get_age_mixing_matrix)n”, “n”, “# Build and run model with the stratification we just definedn”, “model = build_model()n”, “model.stratify_with(strat)n”, “model.run(‘rk4’, step_size=0.1)n”, “plot_compartments(model, times=[start_lockdown, end_lockdown])”
]
}, {
“cell_type”: “markdown”, “id”: “stunning-camera”, “metadata”: {}, “source”: [
“## Multiple mixing matrices for multiple stratificationsn”, “n”, “You can set mixing matrices for multiple stratifications. You also have the option not to. A key assumption is that these two types of mixing are independent. For example, below we assume that there is heterogeneous mixing between young and old agegroup as well as mixing between urban and rural residents, but the model will assume that the way that young and old people mix in rural areas is the same as the way that young and old people mix in urban areas.”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “mineral-section”, “metadata”: {}, “outputs”: [], “source”: [
“from summer import Stratification, Multiply, Overwriten”, “n”, “# Age stratification with young/old mixingn”, “age_strata = ["young", "old"]n”, “age_strat = Stratification(name="age", strata=age_strata, compartments=["S", "I", "R"])n”, “age_mixing_matrix = np.array([n”, ” [0.2, 0.3],n”, ” [0.5, 0.7],n”, “]) n”, “age_strat.set_mixing_matrix(age_mixing_matrix)n”, “n”, “n”, “# Location stratification with urban/rural mixingn”, “loc_strata = ["urban", "rural"]n”, “loc_strat = Stratification(name="location", strata=loc_strata, compartments=["S", "I", "R"])n”, “# Rural people have worse health care, higher mortality rates,n”, “loc_strat.set_flow_adjustments("infection_death", {n”, ” "urban": None,n”, ” "rural": Multiply(3),n”, “})n”, “loc_strat.set_population_split({"urban": 0.7, "rural": 0.3})n”, “loc_mixing_matrix = np.array([n”, ” [0.8, 0.2],n”, ” [0.2, 0.8],n”, “]) n”, “loc_strat.set_mixing_matrix(loc_mixing_matrix)n”, “n”, “n”, “# Build and run model with the stratifications we just definedn”, “model = build_model()n”, “# Apply age, then location stratifications n”, “model.stratify_with(age_strat)n”, “model.stratify_with(loc_strat)n”, “model.run()n”, “plot_compartments(model)”
]
}, {
“cell_type”: “markdown”, “id”: “central-variable”, “metadata”: {}, “source”: [
“The combined age and location matrix is the Kronecker product of the age and location matrices. We can visualize it here:”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “strong-northwest”, “metadata”: {}, “outputs”: [], “source”: [
“import itertoolsn”, “n”, “fig, axes = plt.subplots(1, 3, figsize=(15, 5), dpi=100)n”, “combined_strata = [n”, ” f"{age[0]} + {loc[:3]}" for age, loc n”, ” in itertools.product(age_strata, loc_strata)n”, “]n”, “combined_matrix = model._backend._get_mixing_matrix(0)n”, “plots = [n”, ” [‘Age based mixing’, age_strata, age_strat.mixing_matrix],n”, ” [‘Location based mixing’, loc_strata, loc_strat.mixing_matrix],n”, ” [‘Age and location based mixing’, combined_strata, combined_matrix],n”, “n”, “]n”, “for ax, (title, strata, matrix) in zip(axes, plots):n”, ” ax.set_title(title)n”, ” ax.set_xticks(np.arange(len(strata)))n”, ” ax.set_yticks(np.arange(len(strata)))n”, ” ax.set_xticklabels(strata)n”, ” ax.set_yticklabels(strata)n”, ” ax.imshow(matrix, cmap="Greys")n”, “n”, “plt.show()”
]
}, {
“cell_type”: “markdown”, “id”: “boolean-forge”, “metadata”: {}, “source”: [
“## Prem et al. mixing matrices based on age and locationn”, “n”, “You can obtain estimated mixing matrices from [Projecting social contact matrices in 152 countries using contact surveys and demographic data](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005697#sec020) by Prem et al. in PLOS Computational Biology in 2017.n”, “n”, “This paper is accompanied by age and location specific mixing matrices for 152 countries. You can download the matrices as Excel spreadsheets [here](https://doi.org/10.1371/journal.pcbi.1005697.s002). The paper provides mixing matrices for 5 location types:n”, “n”, “- homen”, “- schooln”, “- workn”, “- other_locationsn”, “- all_locationsn”, “n”, “The rows and columns indices of each matrix represent a 5 year age bracket from 0-80, giving us a 16x16 matrix. n”, “n”, “A more recent version of these social mixing matrices can be obtained from [Kiesha Prem’s GitHub](https://github.com/kieshaprem/synthetic-contact-matrices)”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “annual-lawrence”, “metadata”: {}, “outputs”: [], “source”: []
}
], “metadata”: {
- “kernelspec”: {
“display_name”: “Python 3”, “language”: “python”, “name”: “python3”
}, “language_info”: {
- “codemirror_mode”: {
“name”: “ipython”, “version”: 3
}, “file_extension”: “.py”, “mimetype”: “text/x-python”, “name”: “python”, “nbconvert_exporter”: “python”, “pygments_lexer”: “ipython3”, “version”: “3.6.13”
}
}, “nbformat”: 4, “nbformat_minor”: 5
}¶
- {
- “cells”: [
- {
“cell_type”: “markdown”, “id”: “inner-diploma”, “metadata”: {}, “source”: [
“# Mixing matricesn”, “n”, “By default the Summer compartmental model assumes that each person in the model comes into contact with every other person at the same rate (homogeneous mixing). This isn’t always true. It may be the case, for example, that children tend to interact more with other children, and less with the elderly (with-like or assortative mixing). This difference in social mixing can be expressed and modelled using a "mixing matrix". A NxN matrix which defines how each N strata of a stratification interact and may infect each other.n”, “n”, “n”, “For example, in a ‘child’/’adult’ stratification, we could have the following mixing matrix where the components are average numbers of social interactions per day:n”, “n”, “| | child | adult |\n", "| — | — | — |\n", "| child | 0.2 | 0.3 |\n", "| adult | 0.5 | 0.7 |\n", "\n", "\n", "In this mixing matrix, the columns are the infectors and the rows the infected. So the above matrix represents the following infector -> infected relationships:\n", "\n", "| | child | adult |\n", "| — | — | — |\n", "| child | child -> child | adult -> child |\n", "| adult | child -> adult | adult -> adult |n”, “n”, “For example, the matrix above assumes that a child contacts in average 0.3 adults per day.n”, “n”, “This worked example may clarify. We will calculate the frequency-dependent infection rates for adults and children using the above mixing matrix. Assume the following scenario:n”, “n”, “- 1000 people, 10 infected, 990 susceptiblen”, “- 80% of the population is adults, 20% are childrenn”, “- So, 800 adults with 792 susceptible and 8 infected; andn”, “- 200 children with 198 susceptible and 2 infectedn”, “n”, “n”, “
`python\n", "child_force_of_inf = 0.2 * 2 / 200 + 0.3 * 8 / 800\n", "adult_force_of_inf = 0.5 * 2 / 200 + 0.7 * 8 / 800\n", "\n", "# Here we assume the contact rate accounts for the use of a mixing matrix .\n", "child_inf_rate = contact_rate * child_force_of_inf * 198\n", "adult_inf_rate = contact_rate * adult_force_of_inf * 792\n", "`n”, “n”, “## Using a mixing matrixn”, “n”, “Let’s start by defining some code to build a model and plot the results:”]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “current-banking”, “metadata”: {}, “outputs”: [], “source”: [
“import numpy as npn”, “import matplotlib.pyplot as pltn”, “from summer import CompartmentalModeln”, “n”, “def build_model():n”, ” """Returns a model for the mixing matrix examples"""n”, ” model = CompartmentalModel(n”, ” times=[0, 20],n”, ” compartments=["S", "I", "R"],n”, ” infectious_compartments=["I"],n”, ” timestep=0.1,n”, ” )n”, ” model.set_initial_population(distribution={"S": 990, "I": 10})n”, ” model.add_infection_frequency_flow(name="infection", contact_rate=2, source="S", dest="I")n”, ” model.add_transition_flow(name="recovery", fractional_rate=1/3, source="I", dest="R")n”, ” model.add_death_flow(name="infection_death", death_rate=0.05, source="I")n”, ” return modeln”, “n”, ” n”, “def plot_compartments(model, times=[]):n”, ” """Plot model compartment sizes over time"""n”, ” fig, ax = plt.subplots(1, 1, figsize=(12, 6), dpi=120)n”, ” for i in range(model.outputs.shape[1]):n”, ” ax.plot(model.times, model.outputs.T[i])n”, “n”, ” for t in times:n”, ” ax.axvline(x=t, color=’k’, linestyle=’–’, alpha=0.3)n”, “n”, ” ax.set_title("SIR Model Outputs")n”, ” ax.set_xlabel("Days")n”, ” ax.set_ylabel("Compartment size")n”, ” start, end = ax.get_xlim()n”, ” ax.xaxis.set_ticks(np.arange(start + 1, end, 5))n”, ” ax.legend([str(c) for c in model.compartments], loc=’upper right’)n”, ” plt.show()”
]
}, {
“cell_type”: “markdown”, “id”: “innocent-mortgage”, “metadata”: {}, “source”: [
“For starters let’s see what our ‘vanilla’ SIR model looks like when not stratified at all”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “seeing-diversity”, “metadata”: {}, “outputs”: [], “source”: [
“# Build and run model without any stratificationn”, “model = build_model()n”, “model.run()n”, “plot_compartments(model)”
]
}, {
“cell_type”: “markdown”, “id”: “amino-frederick”, “metadata”: {}, “source”: [
“A mixing matrix can be added to any "full" stratificiation: which is one that affects all compartments.”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “chinese-cookie”, “metadata”: {}, “outputs”: [], “source”: [
“import numpy as npn”, “from summer import Stratificationn”, “n”, “# Create a stratification named ‘age’, applying to all compartments, whichn”, “# splits the population into ‘young’ and ‘old’.n”, “# Implicitly there is a 50-50 split between young and old.n”, “strata = ["young", "old"]n”, “strat = Stratification(name="age", strata=strata, compartments=["S", "I", "R"])n”, “n”, “# Define a NxN (in this case 2x2) mixing matrix.n”, “# The order of the rows/columns will be the same as n”, “# the order of the strata passed to the Stratificationn”, “age_mixing_matrix = np.array([n”, ” [0.2, 0.3],n”, ” [0.5, 0.7],n”, “]) n”, “n”, “# Add the mixing matrix to the stratificationn”, “strat.set_mixing_matrix(age_mixing_matrix)n”, “n”, “# Build and run model with the stratification we just definedn”, “model = build_model()n”, “model.stratify_with(strat)n”, “model.run()n”, “plot_compartments(model)”
]
}, {
“cell_type”: “markdown”, “id”: “explicit-indian”, “metadata”: {}, “source”: [
“## Time-varying mixing matricesn”, “n”, “You can specify a mixing matrix that varies over time, by using a function of time that returns a mixing matrix:”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “caroline-latitude”, “metadata”: {}, “outputs”: [], “source”: [
“import numpy as npn”, “from summer import Stratificationn”, “n”, “# Create a stratification named ‘age’, applying to all compartments, whichn”, “# splits the population into ‘young’ and ‘old’.n”, “strata = ["young", "old"]n”, “strat = Stratification(name="age", strata=strata, compartments=["S", "I", "R"])n”, “n”, “# An age mixing matrix for ‘normal’ social mixingn”, “normal_mixing_matrix = np.array([n”, ” [0.2, 0.3],n”, ” [0.5, 0.7],n”, “]) n”, “n”, “# An age mixing matrix for ‘age lockdown’: n”, “# - no interaction between young and oldn”, “# - increased interaction inside each groupn”, “lockdown_mixing_matrix = np.array([n”, ” [0.3, 0.0],n”, ” [0.0, 0.8],n”, “]) n”, “n”, “start_lockdown = 3 # Day 3n”, “end_lockdown = 8 # Day 8n”, “n”, “# Define heterogeneous mixing as a function of time.n”, “def get_age_mixing_matrix(time):n”, ” if time <= start_lockdown:n”, ” # Pre lockdown, normal mixingn”, ” return normal_mixing_matrixn”, ” if time <= end_lockdown:n”, ” # Use lockdown mixingn”, ” return lockdown_mixing_matrixn”, ” else:n”, ” # Then after lockdown we go back to normal mixing againn”, ” return normal_mixing_matrixn”, “n”, “# Add the mixing matrix to the stratificationn”, “strat.set_mixing_matrix(get_age_mixing_matrix)n”, “n”, “# Build and run model with the stratification we just definedn”, “model = build_model()n”, “model.stratify_with(strat)n”, “model.run(‘rk4’, step_size=0.1)n”, “plot_compartments(model, times=[start_lockdown, end_lockdown])”
]
}, {
“cell_type”: “markdown”, “id”: “stunning-camera”, “metadata”: {}, “source”: [
“## Multiple mixing matrices for multiple stratificationsn”, “n”, “You can set mixing matrices for multiple stratifications. You also have the option not to. A key assumption is that these two types of mixing are independent. For example, below we assume that there is heterogeneous mixing between young and old agegroups as well as mixing between urban and rural residents. The model will assume that the relative age-specific rates of contact between young and old people are the same in the urban and rural settings.”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “mineral-section”, “metadata”: {}, “outputs”: [], “source”: [
“from summer import Stratification, Multiply, Overwriten”, “n”, “# Age stratification with young/old mixingn”, “age_strata = ["young", "old"]n”, “age_strat = Stratification(name="age", strata=age_strata, compartments=["S", "I", "R"])n”, “age_mixing_matrix = np.array([n”, ” [0.2, 0.3],n”, ” [0.5, 0.7],n”, “]) n”, “age_strat.set_mixing_matrix(age_mixing_matrix)n”, “n”, “n”, “# Location stratification with urban/rural mixingn”, “loc_strata = ["urban", "rural"]n”, “loc_strat = Stratification(name="location", strata=loc_strata, compartments=["S", "I", "R"])n”, “# Rural people have worse health care, higher mortality rates,n”, “loc_strat.set_flow_adjustments("infection_death", {n”, ” "urban": None,n”, ” "rural": Multiply(3),n”, “})n”, “loc_strat.set_population_split({"urban": 0.7, "rural": 0.3})n”, “loc_mixing_matrix = np.array([n”, ” [0.8, 0.2],n”, ” [0.2, 0.8],n”, “]) n”, “loc_strat.set_mixing_matrix(loc_mixing_matrix)n”, “n”, “n”, “# Build and run model with the stratifications we just definedn”, “model = build_model()n”, “# Apply age, then location stratifications n”, “model.stratify_with(age_strat)n”, “model.stratify_with(loc_strat)n”, “model.run()n”, “plot_compartments(model)”
]
}, {
“cell_type”: “markdown”, “id”: “central-variable”, “metadata”: {}, “source”: [
“The combined age and location matrix is the Kronecker product of the age and location matrices. We can visualize it here:”
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “strong-northwest”, “metadata”: {}, “outputs”: [], “source”: [
“import itertoolsn”, “n”, “fig, axes = plt.subplots(1, 3, figsize=(15, 5), dpi=100)n”, “combined_strata = [n”, ” f"{age[0]} + {loc[:3]}" for age, loc n”, ” in itertools.product(age_strata, loc_strata)n”, “]n”, “combined_matrix = model._backend._get_mixing_matrix(0)n”, “plots = [n”, ” [‘Age based mixing’, age_strata, age_strat.mixing_matrix],n”, ” [‘Location based mixing’, loc_strata, loc_strat.mixing_matrix],n”, ” [‘Age and location based mixing’, combined_strata, combined_matrix],n”, “n”, “]n”, “for ax, (title, strata, matrix) in zip(axes, plots):n”, ” ax.set_title(title)n”, ” ax.set_xticks(np.arange(len(strata)))n”, ” ax.set_yticks(np.arange(len(strata)))n”, ” ax.set_xticklabels(strata)n”, ” ax.set_yticklabels(strata)n”, ” ax.imshow(matrix, cmap="Greys")n”, “n”, “plt.show()”
]
}, {
“cell_type”: “markdown”, “id”: “boolean-forge”, “metadata”: {}, “source”: [
“## Available resources on mixing matricesn”, “n”, “Estimated mixing matrices can be obtained from multiple sources:n”, “n”, “- A systematic review of social contact surveys was published in 2019: Hoang et al. [A Systematic Review of Social Contact Surveys to Inform Transmission Models of Close-contact Infections] (https://journals.lww.com/epidem/Fulltext/2019/09000/A_Systematic_Review_of_Social_Contact_Surveys_to.15.aspx), Epidemiology: September 2019 - Volume 30 - Issue 5 - p 723-736.n”, “n”, “n”, “- Social mixing data obtained from multiple contact surveys are publicly available from the [Social contact data](https://zenodo.org/communities/social_contact_data) repository hosted on Zenodo.n”, “n”, “n”, “- The R package [socialmixr](https://cran.r-project.org/web/packages/socialmixr/vignettes/introduction.html) can be used to derive social mixing matrices from survey data. In particular, this package can automatically load datasets from the Zenodo repository mentioned above. “
]
}, {
“cell_type”: “code”, “execution_count”: null, “id”: “annual-lawrence”, “metadata”: {}, “outputs”: [], “source”: []
}
], “metadata”: {
- “kernelspec”: {
“display_name”: “Python 3 (ipykernel)”, “language”: “python”, “name”: “python3”
}, “language_info”: {
- “codemirror_mode”: {
“name”: “ipython”, “version”: 3
}, “file_extension”: “.py”, “mimetype”: “text/x-python”, “name”: “python”, “nbconvert_exporter”: “python”, “pygments_lexer”: “ipython3”, “version”: “3.7.11”
}
}, “nbformat”: 4, “nbformat_minor”: 5
}