Abstract
Epidemiological models range in complexity from relatively simple statistical models that make minimal assumptions about the variables driving epidemic dynamics to more mechanistic models that include effects such as vaccinederived and infectionderived immunity, population structure and heterogeneity. The former are often fitted to data in realtime and used for shortterm forecasting, while the latter are more suitable for comparing longerterm scenarios under differing assumptions about control measures or other factors. Here, we present a mechanistic model of intermediate complexity that can be fitted to data in realtime but is also suitable for investigating longerterm dynamics. Our approach provides a bridge between primarily empirical approaches to forecasting and assumptiondriven scenario models. The model was developed as a policy advice tool for New Zealand’s 2021 outbreak of the Delta variant of SARSCoV2 and includes the effects of age structure, nonpharmaceutical interventions, and the ongoing vaccine rollout occurring during the time period studied. We use an approximate Bayesian computation approach to infer the timevarying transmission coefficient from realtime data on reported cases. We then compare projections of the model with future, outofsample data. We find that this approach produces a good fit with insample data and reasonable forward projections given the inherent limitations of predicting epidemic dynamics during periods of rapidly changing policy and behaviour. Results from the model helped inform the New Zealand Government’s policy response throughout the outbreak.
Similar content being viewed by others
Introduction
Between March 2020 and March 2022, New Zealand used strong border controls to minimise the importation of SARSCoV2 into the community from overseas. This enabled it to eliminate community transmission of the virus for long periods of time^{1,2}. Overall incidence of COVID19 was kept very low until vaccines became widely available, with a total of approximately 3,000 confirmed cases (0.06% of the population) up to August 2021. New Zealand’s roll out of the Pfizer/BioNTech BNT162b2 vaccine began in February 2021, initially targeted to frontline border workers and highrisk groups^{3}. However, due to restricted supply of the vaccine, mass vaccination in the general population did not begin until July 2021.
On 17 August 2021, a new community case of COVID19 was detected with no known link to the border. The outbreak was subsequently confirmed by whole genome sequencing to be the B.1.617.2 (Delta) variant and was linked to an ongoing Delta outbreak in the Australian state of New South Wales^{4}. At this time, 32% of the population had received at least one dose of the vaccine, 19% had received two doses, and around 300,000 doses (6% of the population) were being administered per week. The government immediately moved the country to Alert Level 4, the most stringent level of restrictions, including stayathome orders with exceptions for essential workers only. This dramatically reduced transmission of the virus, with new cases falling to around 20 per day in September 2021 after an initial peak of 80 per day. However, unlike previous borderrelated incursions^{2,5,6}, the virus was not eliminated and daily case numbers started to grow as restrictions were relaxed. The government formally shifted away from the elimination strategy on 4 October 2021^{7,8}.
In the period between August 2021 and January 2022, the proportion of the population with two doses of the vaccine increased from 19 to 76% (corresponding to 93% of the eligible population over 12 years old). During the same period, restrictions and closures were progressively relaxed, while an intensive testtraceisolatequarantine system was used to suppress transmission. Continued strong border controls minimised importation of SARSCoV2 and the outbreak was largely contained to the Auckland region with travel restrictions^{4}. Locally acquired cases peaked at around 200 per day in midNovember 2021 before declining steadily to 25 per day in January 2022, with a total of 11,523 confirmed community cases between 17 August 2021 and 23 January 2022. The number of hospitalised cases peaked at 93 on 29 November 2021 and there were 30 deaths. The outbreak disproportionately affected Māori and Pacific people^{9}, who accounted for around 45% and 29% of cases and 39% and 34% of hospitalisations respectively, despite only making up 12% and 16% of the Auckland population. On 23 January 2022, the first community cases of the B.1.1.529 (Omicron) variant were reported and led to a rapidly growing outbreak, which required a different strategy and different set of modelling assumptions^{10}.
Mathematical modelling has been an important tool for understanding and responding to the pandemic. A major challenge for mathematical models is accounting for changes in the amount of mixing between individuals over time^{11}. These changes may occur as a result of government policy and spontaneous behaviour change in response to perceived risk or other factors. The timing, direction, and magnitude of these changes is usually difficult to predict in advance^{12}. However, their effect can be estimated retrospectively by fitting models to data on reported cases, deaths or other epidemiological data streams^{13,14,15,16}. This may help parameterise subsequent models and quantify uncertainty in model outputs.
Simulationbased inference methods, such as approximate Bayesian computation (ABC)^{17}, are a common approach to parameter inference in mechanistic epidemic models^{18}. At their simplest, these provide a way to perform inference on fixed epidemiological parameters, such as the basic reproduction number \({R}_{0}\). In reality, transmission rates are liable to vary over time due to changes in government policy, public health interventions and individual behaviour. In principle, simulationbased inference approaches extend to these more complicated settings; however, naïve ABC often performs poorly in high dimensions^{17}, motivating extensions to ABC for more complex models^{19,20,21}. A different approach is to empirically estimate the timevarying effective reproduction number in realtime while requiring minimal modelling assumptions^{22,23,24,25}. These more empiricallyoriented approaches can be used for nowcasting or forecasting. However, such methods typically cannot offer insights into the mechanisms driving changes in the epidemic dynamics, particularly the relative contributions of changes in contact rates and changes in population susceptibility, whether as a result of vaccination or immunity from prior infection.
In this paper, we combine a stochastic mechanistic epidemic model with an ABC sequential Monte Carlo (ABCSMC) method^{26,27,28} to estimate and interpret the timevarying effective reproduction number during New Zealand’s 2021 Delta outbreak. Our mechanistic model allows us to decompose the contributions to variations in the effective reproduction number from the ongoing vaccine rollout, relaxation of control measures and accumulation of infectionderived immunity. The model we use builds on a previously published agestructured stochastic model^{29}, generalised to include dynamic vaccination rates and a timedependent control function, representing changing contact rates in the community. Vaccine coverage is based on a combination of data on vaccines administered and projected future uptake. We use ABCSMC to estimate the timevarying control function from data on new daily cases. This allows the model to be fitted to data in real time and to project epidemic dynamics and health impacts forward in time under given assumptions about future contact rates. The inference algorithm could readily be applied to other epidemiological models as it takes as input a usersupplied routine to simulate the forward model under a given set of parameters and compute the distance function.
Our approach provides a bridge between statistical nowcasting/forecasting models and longerterm scenario models, producing mediumterm projections and enabling a datadriven approach to epidemic scenario modelling. The model was used in real time throughout New Zealand’s Delta outbreak to provide situational awareness and epidemic projections. These results informed policy advice via the crossagency COVID19 Modelling Government Steering Group.
Methods
We modelled transmission of SARSCoV2 using a discrete time, stochastic branching process model^{30}. We build on the agestructured model of^{29}, which assumed that susceptibility to infection, severe disease and death are age and vaccinationstatusdependent, and that contact rates between age groups are determined by a contact matrix^{31}. The model assumed that the susceptible population was homogenous within each age and vaccination status group. However, it explicitly tracks infected individuals, which allowed us to model the testtraceisolatequarantine system for symptomtriggered testing and contact tracing. The model assumed that symptomatic individuals have a 45% probability of being tested and returning a positive result, and that contacts of confirmed cases have a 70% probability of being traced and quarantined (see Supplementary Material Sects. 1.1 and 1.2). Here, we generalised the model to include timevarying vaccine coverage and contact rates. The model is comparable in structure and assumptions to other models of the Delta variant of SARSCoV2 used for policy advice internationally^{12,32,33,34,35}. MATLAB code to run the model and reproduce the results is available at https://github.com/michaelplanknz/modelinferencecovid19nz2021.
Vaccine effectiveness and coverage
The Pfizer/BioNTech BNT162b2 vaccine accounts for the overwhelming majority of vaccine doses administered in New Zealand. Vaccine effectiveness was characterised in the model by four parameters: effectiveness against infection (\({e}_{I}\)), effectiveness against symptomatic disease in breakthrough infections (\({e}_{S}\)); reduction in transmission in breakthrough infections (\({e}_{T}\)), and effectiveness against severe disease or death in breakthrough infections (\({e}_{D}\)) after either one or two doses of the Pfizer vaccine against the Delta variant. Vaccine effectiveness parameters were based on estimates available in October 2021 from^{36,37} – see Supplementary Table S1 and^{29} for a more detailed literature review. Vaccination was assumed to provide a fixed reduction in risk across all age groups.
The proportion of people in each age group who have received one or two doses of the vaccine was timevarying based on vaccinations administered up to that date, as well as Ministry of Health data on future bookings. Since the outbreak was largely contained to the Auckland region (86% of all reported cases between 17 August 2021 and 23 January 2022), we used vaccination data for the Auckland metropolitan area (Auckland, Waitematā and Counties Manukau District Health Boards). In addition, we assumed that everyone who had received their first dose or had booked an appointment for it would eventually receive their second dose. For those who had their first dose but did not have an appointment booked for their second dose, the time of the second dose was assumed to be uniformly distributed in the 8 week period following the date at which the data on vaccines administered was accessed. Population denominators for each age band were taken to be the estimated resident population (ERP) according to StatsNZ (see Supplementary Table S1). Note that model vaccine coverage was lower than official Ministry of Health statistics because the latter use the health service utilisation (HSU) population, which is typically smaller than the ERP, as denominators. To model the delay in the immune response to vaccination, all vaccine doses were assumed to take effect 14 days after being administered.
Agestructured transmission model
Transmission between age groups was described by a next generation matrix, whose \(\left(i,j\right)\) element is defined to be the expected number of secondary infections in age group \(i\) caused by an infected individual in age group \(j\) in the absence of control measures and given a fully susceptible population. This was modelled as the product of the average number of contacts an individual in age group \(j\) has with someone in age group \(i\) during their infectious period, the probability of transmission per contact, the relative infectiousness of individuals in age group \(j\), and the relative susceptibility of individuals in age group \(i\) based on the approach of^{29} (see Supplementary Material Sect. 1.3). The average number of contacts between individuals in given age groups was based on agestructured contact matrices estimated by^{31}, adapted for the New Zealand population by^{29}. The next generation matrix was normalised to give a basic reproduction number of \({R}_{0}=6\) representing the highly transmissible Delta variant of SARSCoV2.
Each age group \(j\) has three susceptible compartments representing people who have not been previously infected and have received 0, 1 or 2 vaccine doses at time \(t\) (see Supplementary Figure S1). Vaccinated individuals have their probability of infection given exposure reduced by \({e}_{I}.\) This is known as a leaky vaccine model as opposed to an allornothing vaccine model, where a proportion \({e}_{I}\) of vaccinated individuals are completely immunised and a proportion \(1{e}_{I}\) are completely susceptible^{34}. Reality may be somewhere between these idealised models (i.e. there may be some individual heterogeneity in the level of protection provided by the vaccine but not as extreme as allornothing). The allornothing and the leaky vaccine model behave similarly when the proportion of the population with immunity from prior infection is relatively small.
We ignored waning of vaccinederived immunity and infectionderived immunity. In reality, immunity wanes with time although for the Delta variant this can be counteracted to a large extent by a third (booster) dose of the vaccine^{38,39}. In New Zealand, a third dose was offered to all adults starting in December 2021, initially with a minimum 6 month interval between the second and third dose. Here, we only modelled the period up to mid January 2022, when the majority of vaccinated New Zealanders were still within 3 months of their second dose, so the effects of waning are likely to be relatively minor over the time frame considered. Therefore, we did not attempt to model the dynamics of waning and boosting of immunity, although we note that this can be accommodated within this model framework^{10}. The effects of seasonality in transmission rates were ignored.
Disease severity
The risk of hospitalisation following infection for unvaccinated individuals was based on the estimates of^{40} in five year age bands, adjusted for the increased severity of the Delta variant with an odds ratio of 2.26^{41} (see Supplementary Table S1). To model the Auckland Delta outbreak, we increased risk of hospitalisation by a further odds ratio of 2 to give a better match with observed hospitalisation rates. This is partly explained by the fact that the outbreak disproportionately affected Māori and Pacific populations^{9}, who are known to have a higher risk of hospitalisation with COVID19^{42}. The agespecific infection fatality ratio (IFR) was also based on the estimates of^{40}. We did not apply an adjustment to IFR for the Delta variant. Although some studies have found an increased risk of fatality with Delta relative to previous variants ^{43}, this may be offset somewhat by improved treatments for COVID19. For more details on the hospitalisation and fatality submodel see Supplementary Material Sect. 1.4.
Timedependent transmission and parameter inference
For simplicity, we assumed that vaccination, case isolation, and public health restrictions act independently to provide multiplicative reductions in \({R}_{eff}\). It is possible that vaccination and public health restrictions do not act independently if, for example, vaccination rates differ for those who are able to work from home during periods of restrictions. The effect of different Alert Level restrictions or different levels of the COVID19 Protection Framework (see Table 1) were unknown a priori and likely changing over time. To model this, we introduced a timevarying control factor \(C(t)\), which acts multiplicatively on the transmission rate at time \(t.\) This approach assumed that restrictions only change the next generation matrix \(M\) by an overall multiplicative factor. This is not completely realistic as contact rates between different age groups are likely to respond differently, but was a necessary model assumption in the absence of specific data to parameterise a timedependent contact matrix.
Although public health measures are likely to be strongly correlated with \(C(t)\), other factors will influence contact rates such as compliance levels and behavioural changes in response to perceived risk. Rather than explicitly tying changes in \(C(t)\) to changes in public health restrictions, we allowed \(C(t)\) to change in weekly time periods by defining \(C\left(t\right)\) to be a piecewise constant function: \(C\left(t\right)={C}_{k}\) when \({t}_{k1}\le t<{t}_{k}\), with \({t}_{1}\) corresponding to 18 August 2021 (the first day of Alert Level 4), \({t}_{2},\dots {t}_{K1}\) increasing in 7day increments, and \({t}_{K}\) corresponding to the last day of the simulation. The number of time periods was chosen such that there was a minimum of 21 days between \({t}_{K1}\) and the final day for which data was available. This ensured sufficient data was available to estimate the value of \(C\left(t\right)\) in the final time period, allowing for the time lag between changes in \(C(t)\) and its effect in reported case numbers.
We estimated the values of \({C}_{k}\) by fitting model output to data on new daily cases, using an approximate Bayesian computation (ABC) approach. We used a logtransformed Gaussian random field as the prior for \(C=[{C}_{1},{C}_{2},\dots {C}_{K}\)], which encodes correlation structure between neighbouring control function values. We sampled from the prior by generating random deviates \({\theta }_{k}\) from a standard multivariate normal distribution and transforming them according to \(C=\mathrm{exp}(m+\theta L)\) where \({m}_{k}\) is the mean of \(\mathrm{ln}({C}_{k})\), \(L\) is the Cholesky decomposition of the covariance matrix \({\Sigma }_{0}=DAD\), \(D\) is a diagonal matrix of standard deviations of \(\mathrm{ln}({C}_{k})\), and \({A}_{kl}=\mathrm{exp}\left({\left(kl\right)}^{2}/2{L}^{2}\right)\) is the correlation matrix. This matrix has squared exponential form with correlation length \(L=2\), reflecting an a priori assumption that the control function is temporally autocorrelated with a characteristic timescale of 2 weeks. The parameters \({m}_{k}\) and \({D}_{kk}\) are related to the mean \({\mu }_{k}\) and variance \({\sigma }_{k}^{2}\) of \({C}_{k}\) via the usual lognormal distribution parameterisation. For time periods \(k=2,\dots K\) we set \({\mu }_{k}=0.5\) and \({\sigma }_{k}=0.5\). For the first time period (\(k=1\)), we set \({\mu }_{k}=1\) and \({\sigma }_{k}=0.2\) as transmission is expected to be higher during this period prior to outbreak detection and the move to Alert Level 4. We set the offdiagonal elements in the first row and column of \(A\) to be zero so that \({C}_{1}\) is independent of \([{C}_{2},\dots {C}_{K}\)]. Together these choices represent a relatively uninformative prior for the transmission rates during the period when public health restrictions were in place (see Supplementary Figure S2).
Given the above prior, we computed an approximate posterior distribution for \(\theta\) by conditioning on data on the number of new daily community cases of COVID19 reported by the Ministry of Health. We did this using an ABC method with sequential Monte Carlo (ABCSMC) based closely on the replenishment algorithm of^{26} – see Algorithm 1. Like all ABC methods, this involves drawing proposal values for the parameters \(\theta\) from the prior \(\pi (\theta )\) defind above and running the model to generate a simulated dataset \(x \sim \pi (.{\theta })\), in this case representing a time series of new daily cases. These are compared to the real data \({x}^{data}\) using a distance function \(\Delta \left(x,{x}^{data}\right)\) (see below) and the proposal values satisfying \(\Delta \left(x,{x}^{data}\right)<{\epsilon }_{0}\) for some threshold \({\epsilon }_{0}\) are retained. This is known as an ABC rejection step^{17} and provides a sample \(\left\{{\theta }_{i}\right\}\) from the distribution \(\pi \left(\theta \right\Delta \left(x,{x}^{data}\right)<{\epsilon }_{0})\). However, naive ABC rejection is typically very inefficient, especially with a highdimensional parameter space. ABCSMC improves efficiency by propagating the set of particles \(\left\{{\theta }_{i}\right\}\) through a series of intermediate distributions \(\pi \left(\theta \right\Delta \left(x,{x}^{data}\right)<{\epsilon }_{t})\) with \({\epsilon }_{0}\ge \dots \ge {\epsilon }_{T}\). The replenishment algorithm does this by retaining a proportion \(\alpha\) of the previous set of particles \(\left\{{\theta }_{i}\right\}\) with the smallest values of \(\Delta \left(x,{x}^{data}\right)\) and maintaining a sample of size \(N\) by resampling from the retained \(\left\{{\theta }_{i}\right\}\) and perturbing each resampled particle \({R}_{t}\) times via a MCMC kernel. To maintain sample diversity, the number of MCMC iterations \({R}_{t}\) is chosen adaptively in terms of the MCMC acceptance rate \({p}_{acc}\) (see line 29 of Algorithm 1) such that there is a probability \(1c\) that all resampled particles are moved at least once^{20,26}, where \(c\) is a tuning parameter. This process is repeated until all \(N\) particles meet the specified distance threshold \({\epsilon }_{T}\), or the MCMC acceptance rate drops below a specified minimum value \({f}_{acc}\).
We found this method produced similar results to the ABCSMC algorithm of^{27}, but was more computationally efficient, required less hyperparameter tuning, and avoided the need to weight particles which tended to cause problems with sample degeneracy. In addition, precalculating the Metropolis–Hastings ratio for a proposed value of \(\theta\) prior to simulation of the model (see line 21 of Algorithm 1) reduced the amount of time spent sampling regions of parameter space where the prior probability density is low^{26}.
We defined the distance function on time series of daily reported cases \(x=\left\{{x}_{i}\right\}\) to be the sum of squared errors on squareroot transformed data:
The squareroot transformation is a variancestabilising transformation suitable for data in which the variance increases with the mean, e.g. Poissonlike data^{44}, and we found this appropriate here. However, using the sum of squared errors without the squareroot transform (which is equivalent to using a Euclidean distance function) also led to very similar results. We generated \(N=500\) particles using an acceptance rate of \(\alpha =0.5\) per SMC step, minimum MCMC acceptance rate of \({f}_{acc}=0.005\), and tuning parameter \(c=0.01\). When fitting to the complete dataset, we used a target threshold of \({\epsilon }_{T}=1200\), with smaller threshold values used when fitting to data from a subset of the time period (see Algorithm 1). Using a smaller target threshold produced a more accurate approximation to the true posterior at the expense of longer computation time. This combination of hyperparameters was found to give a reasonable combination of runtime and model fit, although the precise choice of hyperparameters did not have a major impact on results. Any simulations that exceeded the acceptance threshold before completion were terminated. This early rejection step required calculation of the partial sums of the distance function at each time step within the forward model, but was essential for computational efficiency. We additionally specified a maximum distance threshold \({\epsilon }_{0}=6500\) for the initial ABC rejection step. This is optional but allows early rejection of particles that have very poor fit to the data.
The data \({x}_{data}\) was defined to be the number of new reported community cases of COVID19 on each day between 17 August 2021 and a specified cutoff date, using the Lab confirmed date field in EpiSurv (or Date reported field if Lab confirmed date is missing). Cases in recent international arrivals detected in managed isolation and quarantine were excluded.
Projections of epidemic dynamics
Once the fitting routine was complete, we projected the model forwards in time by performing \(n=2500\) independent model simulations with values of \({C}_{k}\) drawn from the estimated posterior distribution. For the final period (\(t\ge {t}_{K1}\)), the control function \(C(t)\) was assumed to remain constant at its final inferred value \({C}_{K}\). This corresponds to a projection of the epidemic dynamics under the assumption that future contact rates remain equal to the inferred contact rates in the most recent time period. These simulations were additionally filtered to retain the \(n=500\) simulations with the smallest value of the distance function \(\Delta (x,y)\). As well as improving model fit, this filtering step excluded stochastic realisations in which the epidemic went extinct during the period of very low reported case numbers in September 2021. Performing fewer simulations means more statistical noise in the results, whereas requiring more simulations increases the computational cost; retaining \(n=500\) simulations was found to provide a reasonable balance between these considerations.
Results and discussion
To investigate the fit of the model to data and the performance of model projections, we consider results fitted to data on daily reported cases from 17 August 2021 up to one of three different time points: 24 October 2021, 28 November 2021, and 9 January 2022. The first two dates correspond to times at which model results were communicated to policymakers to inform decisions about relaxing public health restrictions that were in force in Auckland at the time. The final date is towards the end of the Delta outbreak, when case numbers had fallen to very low levels and shortly before the B.1.1.529 (Omicron) variant became dominant in New Zealand.
Vaccine coverage in the Auckland region rose rapidly during the modelled time period, with the proportion of those aged over 12 years who had received two doses increasing from 20% in midAugust 2021 to 91% by midJanuary 2022 (Fig. 1a). Due to the age prioritisation of the vaccine rollout, coverage was generally higher in older age groups (Supplementary Figure S3). Based on data available at the first fitted time point (15 October 2021), twodose vaccine coverage was projected to reach around 87% of over12yearolds by mid December 2021 (Fig. 1a, dashdot curves). In fact, vaccine coverage subsequently increased slightly faster and to a higher level than projected at this time, as seen in results based on data available at the second and third fitted points (Fig. 1a, dashed and solid curves respectively).
We used the model to calculate the effect of vaccinederived immunity on the reproduction number, independently of other effects (Fig. 1b). At the start of the outbreak, the model estimated that vaccination was reducing the reproduction number by around 14%. Vaccination was projected to eventually reduce the reproduction number by around 67% (according to data available on 14 October 2021) and 72% (according to data available on 17 January 2022).
After fitting to data on new daily cases up to 9 January 2022, the model provided a reasonable fit to the outbreak as a whole, although it slightly underestimated the number of cases towards the end of the time period (Fig. 2). The control function \(C(t)\) (Fig. 2a), representing relative contact rates, was estimated to be around 1 prior to outbreak detection on 18 August 2021, corresponding to uncontrolled levels of transmission. Following outbreak detection and the move to Alert Level 4, the estimated control function dropped sharply. In the subsequent two months, the estimated control function steadily increased, suggesting progressively greater contact rates. Some of the observed increase in \(C(t)\) may be explained by relaxation of restrictions to Alert Level 3 on 22 September and “Step 1” on 6 October (see Table 1). However, some of the increase in \(C(t)\) predates these changes suggesting a possible drop in compliance and/or voluntary behaviour change. It may also reflect the fact that, around this time, the outbreak was increasingly affecting parts of the population that were difficult to reach from a public health perspective and had limited ability to selfisolate – see also^{4,8,9}. The estimated control function \(C(t)\) was relatively steady from midOctober to midNovember, despite a relaxation of restrictions to “Step 2” on 10 November.
Surprisingly, the control function decreased around the time of the switch from the Alert Level system to the COVID19 Protection Framework (CPF red in Fig. 2), a significant further relaxation of restrictions. It then remained at relatively low levels for the remainder of the time period, even after further relaxation to CPF orange. This may be partly explained by reduction in indoor mixing during the summer school holidays and Christmas period. However, as noted above, there are also some signs that the model is underfitting somewhat towards the end of the time period, with the data showing a slight uptick in case numbers while the model numbers continue to fall. This slight model misfit may be enough to keep the control function estimates too low and is likely due to a combination of the difficulty of sampling a relatively highdimensional parameter space and the small number of cases during this time period.
Given an estimated control function \(C\left(t\right)\), the corresponding timevarying effective reproduction number \({R}_{eff}(t)\) is a model output that depends on this control function as well as the effects of vaccinederived and infectionderived immunity, and testtraceisolatequarantine (TTIQ) measures (Fig. 2b). For this outbreak, the contribution of infectionderived immunity was small as only a small proportion of the population was infected; our modelbased \({R}_{eff}(t)\) hence has a similar shape to the control function, although is affected by the increasing levels of vaccinederived immunity as shown in Fig. 1b. In contrast, the reproduction number estimated using the nowcasting package EpiNow2^{23,45} appears more sensitive to slight variations in cases and shows a small corresponding increase in \({R}_{eff}\left(t\right)\) after the shift to CPF red and a further increase after the shift to CPF orange. This highlights the potential impact of model (mis)specification or a poorly sampled parameter space on modelbased projections and \({R}_{eff}\left(t\right)\) estimates. Despite these differences, however, the model reproduction number followed a reasonably similar trajectory to that estimated by EpiNow2 using daily cases up to 26 January 2022^{45} and the 90% credible bands overlapped for the duration of the simulation.
The model gave a reasonable match with the time series for hospital occupancy and deaths (Fig. 2df), which were not used in fitting the model. The age distribution of cases in the model was also qualitatively similar to the data (Fig. 3a), although the model underestimated the proportion of cases in the under 25 year age group and overestimated the proportion in the 35–60 year age group. The match to the age distribution of hospitalisations (Fig. 3b) was more variable, partly because the number of hospitalised cases was smaller. There have been more hospitalisations of under5yearolds than the model estimates (although a significant proportion of these may have been social admissions or for nonCOVID19 related treatment). The bulk of hospitalised cases were in the 20–60 year age group in both model and data.
We retrospectively investigated the results of fitting the model to data on cases in the first part of the outbreak and comparing with the future epidemic trajectory. These model results are not predictions because they do not take account of likely future changes in restrictions and/or behaviour. Rather, they are projections of the epidemic dynamics under the assumption that contact rates, as quantified by the control function \(C(t)\), remain constant subsequent to the fitted time period. After fitting to case data up to 28 November 2021, approximately coinciding with the peak in reported cases, the fit of the model to insample data was good, but the model projection tended to overestimate the number of future cases in outofsample data (Fig. 4). In reality, cases fell faster following the peak than the model projected. This is related to the observation above that there was an unexpected decrease in the fitted control function in late November and early December when fitted to data through to January. However, hospital occupancy and deaths (Fig. 4ef) remained close to the median projection and well within the 80% credible band for most of the simulated time period.
After fitting to case data up to 24 October 2021, the model projection again provided a good fit to insample data, and also provided a good match with the size and timing of the subsequent peak in reported cases (Fig. 5). This is because a constant control function during late October and November 2021 was a reasonable approximation to the estimated control function fitted to subsequent data (Fig. 2a). This suggests that there was not a significant increase in contact rates during this period, despite the easing of restrictions to Alert Level 3, Step 2 on 10 November (see Table 1). The peak in cases was primarily driven by increasing vaccinederived immunity, which was already built into the model in October 2021 via bookings for future vaccine appointments and projected uptake of second doses (see Fig. 1). The model again failed to predict the speed of the drop in cases following the peak in late November, although most observed variables remained within the 80% credible band for the duration of the simulation.
One general message to take away from these results is that, although the model can be used for shortterm projections (< 1 month), it cannot generally be used to produce accurate medium or longterm (> 1 month) predictions. The essential difficulty is that there is too much uncertainty in specifying the control function out of sample as it depends on potential future changes in public health policy and spontaneous behaviour change in response to perceived risk. The flexibility of the control function generally allows for good insample fitting (though even then it can be difficult to avoid slight underfitting), but this flexibility makes it difficult to specify for future scenarios given these many sources of uncertainty.
Nevertheless, our method for fitting the control function to data provides an avenue to better link shortterm epidemic projections and longterm scenario modelling. For example, the retrospective estimate of the contact function under specific conditions may be useful for parameterising scenarios with different levels of public health measures or voluntary precautionary behaviour in place. It also ensures that models used for future scenario planning are capable of quantitatively explaining past observations. Linking retrospective estimates of the control function to correlates of contact rates such as mobility data or social survey data^{16}^{,}^{11} would also help integrate a range of data sources relating to behavioural change into epidemic models. We projected epidemic dynamics forward in time under the assumption that the control function remained at the current inferred level. It would also be possible to use the model to consider specific scenarios where the control function changed by a specified amount on certain dates, for example to model the anticipated effect of a potential future change in policy or behaviour. This can be useful to inform decisions about easing public health restrictions.
The model we used has the advantage of being a relatively simple representation of the epidemic dynamics, focusing on age and vaccination status as the most important variables affecting transmission and disease. Its relative simplicity means that the reasons the model produces a particular result can be explained and understood in terms of epidemiological mechanisms rather than being a black box. We found this to be advantageous for communicating the results and building an understanding the model and its limitations with health officials and policymakers. The model explicitly treats infected people as individuals rather than a homogeneous compartment, which enables the testtraceisolatequarantine system to be modelled at the individual level. However, treating the susceptible population as homogeneous (within each age and vaccination status group) means it does not have an unduly large number of unknown parameters and can reasonably be calibrated using routinely collected epidemiological data such as cases, hospitalisations and deaths. As we have demonstrated, the model can be fitted to epidemiological data streams to produce projections of epidemic dynamics in real time.
The model has a number of important limitations. The model assumes that relative contact rates between age groups are described according to the contact matrix estimated by^{31}. In reality, contact rates may differ from these prepandemic estimates and are also likely to be affected by behavioural change and public health restrictions imposed in response to the outbreak. This could have a significant impact on model results due to the strong agedependence in vaccine coverage and risk of severe disease. The assumed contact matrix provided a reasonable match with the age structure of confirmed cases in the outbreak. Nevertheless, social survey data collected in New Zealand under different conditions would help parameterise more realistic contact matrices and how these may respond to changing epidemiological situations^{11,46}. The model ignores the effects of waning immunity, and so is only suitable for modelling an outbreak over a relatively short period of time, although we note the model framework can be generalised to include the effects of waning^{10}. The model assumes that vaccine effectiveness is independent of age, which potentially ignores reduced effectiveness in older groups^{47}. The model assumes that a stable fraction of infections are reported as cases. This is a reasonable assumption given that there was intensive case finding, source investigation, testing and contact tracing throughout the period modelled. However, it is possible that case ascertainment reduced as the outbreak spread into harder to reach parts of the population^{4,8,9}. The model makes assumptions about the effectiveness of case isolation and contact quarantine. However, one advantage of fitting the model to data is that the main results are robust to these assumed parameters. For instance, if the effectiveness of these measures was consistently greater than assumed then, in order to preserve the fit with the data, the inferred value of the control function would have to be consistently larger and, therefore, the reproduction number and epidemiological time series output by the model would be similar. Model projections are sensitive to the assumed values of the vaccine effectiveness parameters because, given the low levels of infectionderived immunity, increasing vaccine coverage is the main mechanism causing the outbreak to peak. A sensitivity analysis of the model to vaccine effectiveness parameters was carried out by^{29}.
The model ignores spatial and demographic heterogeneity in transmission and vaccination rates. The effects of this heterogeneity are likely to be more pronounced in a relatively small outbreak such as the one studied here. Some of this heterogeneity may be effectively subsumed into the fitted control function \(C(t)\). In other words, \(C(t)\) represents average contact rates in the subpopulation infected with the virus at time \(t\), which may differ from contact rates the population as a whole. We have fitted a single timevarying parameter to data on daily cases only. It would be possible to fit to other data streams such as hospitalisations and deaths, which have the advantage of being less dependent on testing patterns. It would also be possible to treat other model parameters as targets for inference, for example probability of testing. However, care is needed to avoid overfitting and identifiability issues.
We have used a stochastic, individualbased model which is appropriate for a relatively small outbreak such that experienced in Auckland from August 2021. For a large outbreak involving a significant fraction of the population, this modelling approach wold be computationally inefficient. However, our ABC method for inferring the timevarying control function would naturally extend to more efficient deterministic compartment models. Epidemic models take a variety of forms depending on which variables and processes are included (e.g. age, vaccination, waning of immunity, population structure, testing and isolation). However, most epidemic models typically include a coefficient that scales the force of infection and is proportional to effective reproduction number at time \(t\). If this coefficient is timevarying, it plays an equivalent role to the control function \(C(t)\) in our framework and can be treated as a target for inference using our method. Future work modelling COVID19 in New Zealand will need to include waning of vaccinederived and infectionderived immunity, the effects of additional doses of the vaccine, and the effects of different variants of SARSCoV2.
Data availability
The datasets analysed during the current study and MATLAB code to run the model and reproduce the results are available in the Github repository, https://github.com/michaelplanknz/modelinferencecovid19nz2021.
References
Baker, M. G., Wilson, N. & Anglemyer, A. successful elimination of covid19 transmission in New Zealand. N. Engl. J. Med. 383, e56 (2020).
Douglas, J. et al. Realtime genomics for tracking severe acute respiratory syndrome coronavirus 2 border incursions after virus elimination, New Zealand. Emerg. Infect. Dis. 27(9), 2361–2368 (2021).
Ministry of Health. Border worker vaccinations  an important step in New Zealand’s pandemic response. https://www.health.govt.nz/newsmedia/mediareleases/borderworkervaccinationsimportantstepnewzealandspandemicresponse (2021).
Jelley, L. et al. Genomic epidemiology of delta SARSCoV2 during transition from elimination to suppression in Aotearoa New Zealand. Nat. Commun. 13, 4035 (2022).
Hendy, S. et al. Mathematical modelling to inform New Zealand’s COVID19 response. J. R. Soc. N. Z. 51, S86–S106 (2021).
Grout, L. et al. Failures of quarantine systems for preventing COVID19 outbreaks in Australia and New Zealand. Med. J. Aust. 215(7), 320–324 (2021).
New Zealand Government. Auckland roadmap – restrictions eased in steps. https://www.beehive.govt.nz/speech/aucklandroadmap%E2%80%93restrictionseasedsteps (2021).
Baker, M. G. et al. The next phase in Aotearoa New Zealand’s COVID19 response: A tight suppression strategy may be the best option. N. Z. Med. J. 134(1546), 8–16 (2021).
Smith, A., Fereti, S. & Adams, S. Inequities and perspectives from the coviddelta outbreak: The imperative for strengthening the pacific nursing workforce in Aotearoa New Zealand. Nurs. Prax. Aotearoa N. Z. 37, 94–103 (2021).
Vattiato, G. et al. An assessment of the potential impact of the omicron variant of SARSCoV2 in Aotearoa New Zealand. Infect. Dis. Modell. 7, 94–105 (2022).
Gimma, A. et al. Changes in social contacts in England during the COVID19 pandemic between March 2020 and March 2021 as measured by the CoMix survey: A repeated crosssectional study. PLoS Med. 19(3), e1003907 (2022).
Keeling, M. J., Dyson, L., Tildesley, M. J., Hill, E. M. & Moore, S. Comparison of the 2021 COVID19 roadmap projections against public health data in England. Nat. Commun. 13(1), 1–19 (2022).
Flaxman, S. et al. Estimating the effects of nonpharmaceutical interventions on COVID19 in Europe. Nature 584(7820), 257–261 (2020).
Hsiang, S. et al. The effect of largescale anticontagion policies on the COVID19 pandemic. Nature 584(7820), 262–267 (2020).
Jaouimaa, F.Z. et al. An agestructured SEIR model for COVID19 incidence in Dublin, Ireland with framework for evaluating health intervention cost. PLoS ONE 16(12), e0260632 (2021).
Golding N, Price DJ, Ryan GE, McVernon J, McCaw JM, Shearer FM. Estimating the transmissibility of SARSCoV2 during periods of high, low and zero case incidence. medRxiv. 2021:2021.11.28.21264509.
Sunnåker, M. et al. Approximate Bayesian Computation. PLOS Computat. Biol. 9(1), e1002803 (2013).
McKinley, T., Cook, A.R., Deardon, R. Inference in epidemic models without likelihoods. Int. J. Biostat.5(1) (2009).
Marjoram, P., Molitor, J., Plagnol, V. & Tavaré, S. Markov chain Monte carlo without likelihoods. Proc. Natl. Acad. Sci. 100(26), 15324–15328 (2003).
Drovandi, C. C. & Pettitt, A. N. Estimation of parameters for macroparasite population evolution using approximate Bayesian computation. Biometrics 67(1), 225–233 (2011).
Sisson, S. A., Fan, Y. & Tanaka, M. M. Sequential monte carlo without likelihoods. Proc. Natl. Acad. Sci. 104(6), 1760–1765 (2007).
Cori, A., Ferguson, N. M., Fraser, C. & Cauchemez, S. a new framework and software to estimate timevarying reproduction numbers during epidemics. Am. J. Epidemiol. 178(9), 1505–1512 (2013).
Abbott, S. et al. Estimating the timevarying reproduction number of SARSCoV2 using national and subnational case counts. Wel. Open Res. 5(112), 112 (2020).
Wallinga, J. & Teunis, P. Different epidemic curves for severe acute respiratory syndrome reveal similar impacts of control measures. Am. J. Epidemiol. 160(6), 509–516 (2004).
Gostic, K. M. et al. Practical considerations for measuring the effective reproductive number, Rt. PLoS Comput. Biol. 16(12), e1008409 (2020).
Carr, M. J., Simpson, M. J. & Drovandi, C. Estimating parameters of a stochastic cell invasion model with fluorescent cell cycle labelling using approximate Bayesian computation. J. R. Soc. Interface 18(182), 20210362 (2021).
Toni, T., Welch, D., Strelkowa, N., Ipsen, A. & Stumpf, M. P. Approximate Bayesian computation scheme for parameter inference and model selection in dynamical systems. J. R. Soc. Interface 6(31), 187–202 (2009).
Marin, J.M., Pudlo, P., Robert, C. P. & Ryder, R. J. Approximate Bayesian computational methods. Stat. Comput. 22(6), 1167–1180 (2012).
Steyn, N. et al. A covid19 vaccination model for Aotearoa New Zealand. Sci. Rep. 12, 2720 (2022).
Haccou, P., Haccou, P., Jagers, P., Vatutin, V. A. & Vatutin, V. Branching processes: Variation, growth and extinction of populations (Cambridge University Press, Cambridge, 2005).
Prem, K., Cook, A. R. & Jit, M. Projecting social contact matrices in 152 countries using contact surveys and demographic data. PLoS Comput. Biol. 13(9), e1005697 (2017).
Doherty Institute. Doherty Modelling Report For National Cabinet. Doherty Institute Modelling Reports. 2021: https://www.doherty.edu.au/uploads/content_doc/DohertyModelling_NationalPlan_and_Addendum_20210810.pdf (2021).
Barnard RC, Davies NG, Jit M, Edmunds WJ. Interim roadmap assessment: prior to steps 3 and 4. Scientific Advisory Group for Emergencies, SPIMO modelling reports: https://www.gov.uk/government/publications/lshtminterimroadmapassessmentpriortosteps3and45may2021 (2021).
Moore, S., Hill, E. M., Tildesley, M. J., Dyson, L. & Keeling, M. J. Vaccination and nonpharmaceutical interventions for covid19: A mathematical modelling study. Lancet Infect. Dis 21(6), 793–802 (2021).
Bubar, K. M. et al. Modelinformed covid19 vaccine prioritization strategies by age and serostatus. Science 371(6532), 916–921 (2021).
Public Health England. Vaccine effectiveness expert panel  consensus narrative 2021 [updated 27 August 2021. Available from: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/1017253/S1359_VEEP_Vaccine_Effectiveness_Table__1_.pdf (2021).
SPIMO. Summary of further modelling of easing restrictions – Roadmap Step 4 on 19 July 2021 [updated 7 July 2021. Available from: https://www.gov.uk/government/publications/spimosummaryoffurthermodellingofeasingrestrictionsroadmapstep4on19july20217july2021 (2021).
Tartof, S. Y. et al. Effectiveness of a third dose of BNT162b2 mRNA COVID19 vaccine in a large US health system: A retrospective cohort study. Lancet Reg. HealthAm. 9, 100198 (2022).
Thompson, M.G., Natarajan, K., Irving, S.A.. Effectiveness of a third dose of mRNA vaccines against COVID19–associated emergency department and urgent care encounters and hospitalizations among adults during periods of Delta and Omicron variant predominance—VISION Network, 10 States, August 2021–January 2022. Morb. Mortal. Wkl Rep. 71 (2022).
HerreraEsposito, D. & de Los Campos, G. Agespecific rate of severe and critical SARSCoV2 infections estimated with multicountry seroprevalence studies. BMC Infect. Dis. 22, 311 (2022).
Twohig, K. A. et al. Hospital admission and emergency care attendance risk for SARSCoV2 delta (B. 1.617. 2) compared with alpha (B. 1.1. 7) variants of concern: A cohort study. Lancet Infect. Dis. 22, 35–42 (2021).
Steyn, N. et al. Māori and pacific people in New Zealand have higher risk of hospitalisation for covid19. N. Z. Med. J. 134(1538), 28–43 (2021).
Fisman, D. N. & Tuite, A. R. Evaluation of the relative virulence of novel SARSCoV2 variants: A retrospective cohort study in Ontario, Canada. Can. Med. Assoc. J. 193(42), E1619–E1625 (2021).
Bartlett, M. S. The use of transformations. Biometrics 3(1), 39–52 (1947).
Binny, R. N. et al. Realtime estimation of the effective reproduction number in Aotearoa New Zealand. PeerJ 10, e14119 (2022).
Verelst, F. et al. SOCRATESCoMix: A platform for timely and opensource contact mixing data during and in between covid19 surges and interventions in over 20 European countries. BMC Med. 19(1), 254 (2021).
Andrews, N. et al. Duration of protection against mild and severe disease by Covid19 vaccines. N. Engl. J. Med. 386(4), 340–350 (2022).
Acknowledgements
The authors acknowledge the support of the New Zealand Ministry of Health, StatsNZ, and the Institute of Environmental Science and Research in supplying data in support of this work. The authors are grateful to Samik Datta, Nigel French, Markus LuczakRoesch, Melissa McLeod, Anja Mizdrak, Matt Parry, the COVID19 Modelling Government Steering Group, and three anonymous reviewers for feedback on earlier versions of this manuscript, and to Kannan Ridings for help with data management, and to Chris Drovandi and David Warne for discussions about sequential Monte Carlo methods. This work was funded by the New Zealand Department of Prime Minister and Cabinet.
Author information
Authors and Affiliations
Contributions
M.J.P., S.C. and O.M. designed the study. M.J.P. wrote the code and prepared the Figures. M.J.P. and O.M. wrote the main manuscript text. R.N.B., G.V. and A.L. helped test the code and prepare the Supplementary Text. G.V. helped with data management. All authors reviewed the manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher's note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary Information
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Plank, M.J., Hendy, S.C., Binny, R.N. et al. Using mechanistic modelbased inference to understand and project epidemic dynamics with timevarying contact and vaccination rates. Sci Rep 12, 20451 (2022). https://doi.org/10.1038/s41598022250183
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598022250183
This article is cited by

Estimating the risk of SARSCoV2 infection in New Zealand border arrivals
BMC Global and Public Health (2024)
Comments
By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.