DOI: 10.34894/j5uhnl
title: Code and data for 'Age-specific transmission dynamics of SARS-CoV-2 during the first two years of the pandemic'

description: This is the main code for the paper "Age-specific transmission dynamics of SARS-CoV-2 during the first two years of the pandemic" by Otilia Boldea, Amir Alipoor, Sen Pei, Jeffrey Shaman, and Ganna Rozhnova and its Supplement.
&lt;br&gt;&lt;br&gt;
For questions related to the code, please email Otilia Boldea via the button "Contact Owner" top right or &lt;a href="https://sites.google.com/site/otiliaboldea/home"&gt;https://sites.google.com/site/otiliaboldea/home&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
The code is organized as follows:
&lt;br&gt;
Main Code/ Code with synthetic train data 
&lt;br&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt; synthetic_mobility.m is the code to generate the synthetic mobility Msynth.mat; the true data, used to generate the results in the paper (output.m) is property of the national railway company National Spoorwegen, and is confidential
&lt;li&gt;all the other data is publicly available or posted by us with permission from RIVM (Royal Institute for Public Health and Environment). 
&lt;li&gt;The folder Data contains all this data. The code for construction of the data along with plots and Tables can be found in Supplementary Materials Code/Code for S figures and Tables. 
&lt;li&gt;The description of how this data is constructed in available in the Supplementary Materials of the above paper
&lt;/ul&gt;
&lt;/ul&gt;
To run the code with synthetic mobility data: 
&lt;ul&gt;
&lt;li&gt;run inference.m, which uses the following functions:
&lt;li&gt;SEIRHS.m - runs the stochastic version of the epidemiology model and an RK4 integration
&lt;li&gt;transf.m - calculates the time-varying transition function of contacts multiplied by the susceptibility parameter
&lt;li&gt;waning - calculates the waning of protection parameters in the second compartment set
&lt;li&gt;initialize - initializes the parameters and the unobserved states
&lt;li&gt;checkbound_ini - checks initial bounds on unobserved states (for example, S cannot be negative or larger than population)
&lt;li&gt;checkbound - checks bounds on unobserved states - after updating (for example, S cannot be negative or larger than population)
&lt;li&gt;Inflation.m - performs variance inflation of posterior updates to prevent the filter from collapsing due to lack of variance 
&lt;li&gt;liki.m - calculates the marginal posterior (quasi-)likelihood of the model based on the ensemble adjustment Kalman filter
&lt;li&gt;the dataset movNSperc.mat (generated for Figures S11 and S19) contains percentage change in National train mobility compared to pre-pandemic levels and is used by the function synthetic_mobility.m (note that instead, Google mobility data could be used, but priors on parameters theta would likely need adjustment)
&lt;li&gt;the dataset CBSprov.mat contains in column 4 the number of people living in province i and working in j, and is downloaded from CBS (Central Bureau Statistics)
 https://www.cbs.nl/nl-nl/cijfers/detail/83628NED#shortTableDescription 
&lt;li&gt;use year 2018, first published in 2020. 
&lt;/ul&gt;
&lt;br&gt;
Main Code/ Output files 
&lt;br&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;contains output.m, main output in the paper
&lt;li&gt;output_synth.m, output with synthetic train mobility data
&lt;/ul&gt;

&lt;br&gt;
Main Code/ Code for Main Text Figures 
&lt;br&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;contains code for reproducing Figures in the main text
&lt;/ul&gt;Supplementary Materials Code

&lt;br&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt; contains two folders. 
&lt;li&gt;The folder "Code for S Figures and Tables" contains code for constructing all the data used in the main code, as well as code for reproducing
 the Tables and Figures in the Supplementary Materials of the paper, labeled "S"
&lt;li&gt;The folder "Code for A Figures and Tables" contains code for reproducing the figures and tables in the Supplementary Materials labeled "A"
&lt;/ul&gt;
&lt;br&gt;
Main Text Figures
&lt;br&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;contains all the figures in the main text of the paper
&lt;/ul&gt;

Supplementary Figures
&lt;ul&gt;
&lt;li&gt;contains all the figures in the Supplement
&lt;/ul&gt;
Universe: Covering the entire Dutch population&lt;br&gt;&lt;br&gt;
Country / Nation: the Netherlands.
description: Data files: The number of files is too large to fill this in as it includes both data creation, modelling and outputs of the paper and the supplement. Readme files are available in each subfolder. 
<br><br>
Structure data package: Data is structured in the following subfolders: Main code (for results, figures and tables in the paper), Main Text Figures, Supplementary Figures, Supplementary Materials code, and an overall readme file explaining the structure further.
description: The files are large due to two output files that are large.
<br>
https://github.com/oboldea/COVID_age_regions<br>

The datasets used as input in this study are listed in Table 1 of the related publication. All input datasets except for regional train mobility data are in this dataset. Requests for regional train mobility data to the Dutch Railways (Nederlandse Spoorwegen—NS).