{'fraction_non_alphanumeric': 0.025664251207729468, 'fraction_numerical': 0.008182367149758453, 'mean_word_length': 4.748177716070809, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modelling provincial Covid-19 epidemic data in Italy using an adjusted time-dependent SIRD model

In this paper we model and predict the spread of COVID-19 infection at a provincial (i.e. EU NUTS-3) level in Italy by using official data from the Italian Ministry of Health integrated with data extracted from daily official press conferences of regional authorities and from local newspaper websites. This integration is mainly concerned with death data which are not available at NUTS-3 level from official data channels. An adjusted time-dependent SIRD model is used to predict the behaviour of the epidemics, specifically the number of susceptible, infected, deceased and recovered people. Model performance is evaluated using comparison with real data.


Introduction
The outbreak of the Covid-19 epidemics in early 2020 has caused an unprecedented effort of the scientific community to produce models that could monitor and predict the evolution of the epidemics in a reliable way, also to advice governments to take actions which could mitigate the burden of hospitals to treat the affected patients, and thus reduce the mortality rate of the infection.
The first reported case of Covid-19 in Italy dates back to February 20th, 2020 [11], in the city of Codogno, in southern Lombardy, and from there the epidemics diffused particularly in Italian northern regions, that is those most commercially connected with China, where the epidemics had its origin. The Italian government took subsequent measures to contain the epidemics [9], ending soon with a full national lockdown on March 11th, 2020, to drastically reduce the mobility of citizens and the consequent infectious contacts.
We decided to focus on the modelling of the epidemics in Italian provinces (i.e. at EU NUTS-3 level), rather than in Italian regions (i.e. at EU NUTS-2 level). This choice was dictated by the fact that the Covid-19 outbreak in Italy has been not homogeneously spread within regions, with many differences from province to province in the same region.
According to the characteristics of the virus spreading, it seems difficult to think of a uniform virus propagation behavior at the regional level. Even the timing of the initial stages of the infection and its dynamics seem to have been very different even among contiguous provinces, as clusters of Covid-19 contagion have been often located in very restricted areas. One of the proof of this lack of spread homogeneity is in the initial stage of the virus outbreak which was located at the border between Lombardy and Emilia-Romagna regions, namely in the Lodi province (Lombardy) and in Piacenza province (Emilia-Romagna). The provinces of Varese in Lombardy and Ravenna in Emilia-Romagna are not in the least comparable with the provinces of Lodi and Piacenza in terms of intensity of the contagion. Moreover, antigen testing had been initially conducted depending on the choices of the local health authorities, and hospital admissions in the early stages of the emergency depended on the management and absorption capacity of the local health units, resulting in many differences in practising hospital care at a local level. Also the management of elder people, in particular those living in retirement homes, was quite different locally, causing in some cases the development of local sites of the infection, and a local increase of the mortality, since the illness was particularly severe on elder people.
The spread of epidemics is often effectively modelled by compartmental deterministic models [3,5], where a population of susceptible individuals evolves into other categories representing the different stages of the infection. We consider here a model consisting of 4 compartments: susceptible (S), infected (I), recovered (R) and died (D), that were the only compartments for which we could find available data at NUTS-3 level in Italy. In the case of SARS-Cov-2 virus, it was proven that the infection has an incubation period of about 5 days and that a significant percentage of the infected people are asymptomatic [7,6,13], thus actually more compartments should and have been considered both in deterministic and stochastic models (see e.g. [1,2,9,10,15,21]). Unfortunately the data unavailability at NUTS-3 level would cause problems in the parameters identification [20]. Furthermore we decided to keep the model as simple as possible in order to make it more accountable and, at the same time, robust to the variation in time of the parameters.
The parameters of the epidemics are actually evolving in time. In fact the rate of infection depends implicitly on the limitation of the mobility of the citizens; on the measures of protection of the healthcare personnel and of the workers who kept on doing jobs which were considered essential services to the community; on the number of antigen tests performed locally to detect the infected subjects in order to put them in strict quarantine. Also the recovery rate and the death rate are changing in time and in space because of the different burden of the local healthcare systems and the new insights in the pulmonary illness caused by the SARS-Cov-2 virus and its possible pharmacological and medical treatment. We thus studied a SIRD model whose parameters are evolving in time, and able to automatically adapt to the factors which are implicitly causing their changes. This makes our model able to predict with a good reliability the short term evolution of the epidemics, in particular in absence of sudden big changes of the population behaviour or the health policy. We leave the detection of major change points in the parameters behaviour to subsequent papers, using time series or stochastic processes techniques like the one described in [17] In the following sections we describe our main data sources, the model that we implemented and its parameters estimation and provide a detailed study of the fitting of the predictions made by our model with real data.
The rest of the paper is organized as follows. Section 2 describes the data extraction we performed, including the extra-data on deaths not available at a province level from official authorities, together with a short discussion on issues in the data collection. Section 3 presents the model we used and some necessary adjustments on it in order to include time-depending events such as central government and local authorities lockdown decisions all along the outbreak. Section 4 describes an adjusted training process for the model we adopted to ameliorate the estimates. Section 5 is about the estimation performance of the model and Section 6 concludes the paper and outlines some possible future work.

Data on Covid-19 in Italy
Only data on Covid-19 daily cases were made available for each province (i.e. NUTS-3) by the Italian Civil Protection Agency (CPA), the Italian Ministry of Health and the Italian National Institute of Health, which are the official data providers for the Covid-19 outbreak in Italy. No data about deaths and recovered patients were provided 1 . Therefore, we decided to integrate the official data on cases with data on deaths derived from press conferences and reports published online by regional authorities or local newspapers. The number of the cumulative recovered individuals at a provincial level has been estimated using the recovery rate at the regional level, computed as the ratio of recovered people and the total number of cases in each day. Data on deaths have been scraped using the daily press conferences and Covid-19 bulletins for a vast majority of the Italian provinces.
Regions for which we were not able to obtain provincial death data from official bulletins or press conferences were Liguria, Lombardia, Veneto, Friuli-Venezia-Giulia and Campania. However, for Imperia province in Liguria region and Cremona province in Lombardy we were able to obtain data on Covid-19 deaths from local newspapers. Another series not available at a provincial level was that of the number of recovered people at time t. We estimated it proportionally to that of the region where the province is in, taking into account the population of the province. The reason for this choice is that patient treatment for the illness due to Covid-19 could be considered more uniform across the various provinces (with almost the same recovery rate across provinces within the region) than for the number of deaths.
Official data on the Covid-19 outbreak in Italy present many issues mainly related to delays in reporting new cases and deaths, incongruities (for example, negative values in the series of new cases due to post-event recounts), and missing data. Menchetti and Noirjean [16] reported widely on the flaws and biases of these official data. The problem of unreliable data becomes even more cogent with epidemiological models, both deterministic and stochastic, when many parameters should be estimated on the basis of unreliable data, especially for long-range estimates which are even more important for an outbreak with such dramatic consequences the whole world is experiencing. This inevitably results in a few more uncertainty on the estimates. Figure 1 reports on the differences between the sum of province deaths and the corresponding total regional deaths for each region for which we have all the province deaths from regional authorities in the February 24th -May 10th, 2020 time-span. The

An adjusted time-dependent SIRD model
The SIRD model is a compartmental model used in epidemiology to design the spread of a disease [3,14,18]. The model divides the population into four different groups: susceptible, infected, recovered, and deaths. This kind of design is appropriate when the disease of interest respects the following two assumptions: infected individuals must be infectious and recovered individuals receive lifelong immunity. COVID-19 definitely respects the first assumption and some preliminary studies show that recovered individuals receive at least short-term immunity. Other important assumptions concern the population: its size is considered fixed and individuals are identical to one another (i.e. demographic factors or health condition are not considered). In Figure  2 a schematic of the compartments and flows forming the model is shown.

Figure 2: SIRD model compartments and flows
The SIRD model is based on four variables S(t), I(t), R(t), and D(t), that are respectively the number of susceptible people, currently infected, total recovered and total deaths at time t. The size of the population is given by the sum of these four variables and it is represented by n. The parameters governing the model are the transmission rate, the recovery rate, and the mortality rate, that are respectively represented by β, γR, γD. Being rates, these parameters can also be seen respectively as the average time between effective contagious contacts (β −1 ) and the average time before removal from the infectious class ((γR + γD) −1 ).
Another important parameter that wholly describes the spread of an outbreak is the basic reproduction number, R0, that is computed as the ratio between the transmission rate and the sum of recovery and mortality rate. R0 represents the expected number of individuals that are directly infected by one infected individual, in a population where everyone is susceptible to infection. If R0 is less than 1, the epidemic will eventually be controlled. If it is larger than 1, the transmission of the disease will increase in the population.

R0
= β γR + γD Building on Chen et al. (2020) work [4], in this paper a time-dependent model is proposed in order to let the parameters be free to change over time. This kind of model is chosen because in Italy, as well as in various other countries facing the virus, containment measures have been adopted and incremented over time. In particular, a national lockdown was introduced in Italy on March 11th, 2020 and lasted until May 4th, 2020. By allowing the parameters, and especially the effective transmission rate, to vary over time, the effect of control measures can be somewhat included in the model. On the other hand, recovery and mortality rate are likely to depend on the pressure under which hospitals and, in particular, intensive care units are in, which increases sharply at the beginning of an epidemic (i.e. when a high mortality rate is reported) and then relaxes after the health system capacity is enhanced.
The differential equations of the typical SIRD model are transformed into discrete time difference equations and result as follows: From the records of the four variables of interest in a specific province, the evolution each parameters can be retrieved using the equations above. The time series are then used to predict the future values of transmission rate, recovery rate, and mortality rate. The method used in [4] is a Finite Impulse Response (FIR) filter. The following equations describe the regression model used for each parameter and the cost function to be minimized, in order to find the optimal coefficients.
where Y (t) is one of the evolving parameters of the model, i.e. β(t), γR(t), γD(t). The FIR filter requires the choice of a single hyper-parameter (J) which represents the number of lag days to include in the regression. The cost function consists in a regularized least squares method in which the penalty (λ) is applied to the sum of squares of the regression coefficients (Ridge regression regularization, based on a 2 norm). The regularization is included so that the model does not overfit on the training set.
Once the models have been trained using historical data, future predictions can be done on the parameters and, therefore, estimates for the evolution of S, I, R, and D can be computed using the SIRD model equations.

Adjusted training process
The aim of our model is to make predictions about the evolution of the COVID-19 outbreak in Italy at the local level, particularly using historical data on each province. The model presented here differs from [4] in that the hyperparameters are not fixed but optimized using different approaches. The model is composed by three different autoregressions based each on a SIRD model's parameter. Each of the regressions requires the choice of two hyperparameters: the number of lags (J) and the penalty for the regularization process (λ). As the transmission rate is the parameter that most depends on policy decisions and therefore the most likely parameter to change over time, the number of lags for the other parameters has been set equal to the optimal number of lags for β(t), so as to have three homogeneous time series. The method that was employed to choose the optimal number of lags is the Akaike Information Criterion (AIC): the number of lags that minimizes the AIC is chosen within a given range. On the other hand, the regularization parameters were set free to change within a range for each of the parameters and cross-validation was employed to find their optimal values.
However, the deterministic model described above might struggle in producing reliable estimates in contexts where the number of cases is very low and there is considerable fluctuation or inconsistency in the data, as it happens in some provinces where the outbreak was not so intense (see Figure 3, where the heterogeneity of the outbreak is clearly shown at provincial level, at least in the first-medium stages of its evolution), whilst it seems to give more robust results when data are aggregated at a higher level, as in the entire country's time series. This happens because the model is based on the smoothing of the sequential values of the variables that becomes less precise as the numbers became smaller. Therefore, different approaches for training were developed.
Firstly, a local-based training was considered; however this choice did not lead to robust results due to the issues highlighted above. Secondly, a training at the national level was suggested, as the lockdown was declared almost simultaneously in every Italian province. Nevertheless, the virus has spread irregularly in different geographical zones, with the southern areas reporting considerably fewer cases as well as a delay in the spread of COVID-19. A nation-based training process would have been highly influenced by the northern regions' critical situation and would have overestimated the development of the epidemic in the central and southern regions, far less affected from the virus. Therefore, these two first methods were discarded.
Therefore, in a second attempt to use local data, the regional level was considered the most suitable option in order to balance the heterogeneity found in the epi- Green pins are for 0 ≤ R 0 < 0.5, orange pins for 0.5 ≤ R 0 < 1, red pins for 1 ≤ R 0 < 2 and black pins for R 0 ≥ 2 demic evolution among different territories and the need for aggregated data. For each province, the corresponding region is selected. In order to choose the regions whose situation most resembles the one of the selected region, a correlation measure between all of the regions was computed: this correlation was based on the new cases' daily time series divided by the regions' population and therefore was time-weighted so that the most recent days have a much bigger impact than the days at the beginning of the epidemic. The weighting process has been developed as follows: where t is the current day, d = 0, ..., t − 1 is the number of days between the observation of interest and the current day, and w t−d is the weight assigned to that observation. The weights are then normalized so that their sum equals 1. The regions showing a high correlation with the region containing the province of interest (i.e. higher than the median value) are selected and their data is aggregated to compose the training set.
A final approach that was adopted exactly replicated the previous one but used provinces instead of regions as geographical units. This was not a viable solution at the beginning since data were only available for a few provinces and is still not accessible for some of the worst-hit, and therefore more informative, territories.
These two proposed training processes, called respectively regional aggregation training and provincial aggregation training provide both acceptable results and, therefore, are both considered suitable to make short-term predictions. Model coefficients resulting from the training process are then applied to the local data in order to make predictions for each province with the same procedure followed previously: given the predictions about the future values of the parameters, the future values of the variables S,I,R, and D, are computed using the discrete time difference equations (1)-(4).
In Figures 4 and 5, an example on applying this model to the Piacenza province is shown. Piacenza is one of the provinces in northern Italy with the highest cumulative rate, since its main hospital is located very close to Codogno, the town with the first cluster of observed Covid-19 cases in Italy. In this case, the model is trained using regional aggregation. The vertical dashed lines represent the dates in which the containment measures were implemented.
Results for other provinces can be seen on a dashboard developed for this model, available at https://ceeds.unimi.it/covid-19-in-italy/ (see also [8] for a detailed description of this app).

Comparison of training processes
Due to the gradual decentralization of the health system competences to regional governments in the last years, the health policies implemented during the pandemic varied greatly throughout the country as well as over time. Moreover, the state of emergency during the pandemic in Italy has been detrimental to the data consistency: there has been numerous adjustments, corrections, and delays in the collection of the data, as well as changes in the definitions of the variables. The issue of data inconsistency is even more crucial to the sake of our model predictive power as it is focused on a quite disaggregated level.
Our model's accuracy is evaluated using both the training approaches presented above. The Mean Absolute Percentage Error [12] (MAPE) is chosen as the accuracy metric to assess the error in model's predictions: where h is the prediction horizon, P is the number of provinces in the sample, D is the number of days in the sample,Ŷ h is the resulting prediction and Y h is the real value for the variable.
The model is applied to all the provinces and within a fortnight period going from April 8th, 2020 to April 22nd, 2020 (D = 15). For each day of the period, the model predicts the values of the variables using a time horizon from 1 to 15 days ahead in the future (i. e. h = 1, ..., 15). The model's hyper-parameters are free to change (i.e. λ and J vary among provinces and among days). The model's predictions are then compared with the real values and the results are shown in Tables 2 and 3. In these tables, T stands for "Total cases".  The MAPE is relatively low and acceptable for all of the variables in the short term. As in all time series, the error increases as the horizon for the prediction becomes larger: nevertheless, our model performance remains acceptable even in the longer-term, at least for the regional aggregation training approach. The estimate whose MAPE is the highest is for R in both methods: note that R has been estimated using regional data since reports about recovered at the provincial level are seldom published. The regional approach seems to perform slightly better than the provincial aggregation one, and its higher accuracy is enhanced in the long term. The model is therefore considered the optimal training process and the analysis of its forecasting accuracy is further developed.

Error distribution
We can look also at the distribution of the Mean Percentage Error (MPE) [12] for each province to understand more about the prediction accuracy of our model, given different time horizons, and highlight whether or not major bias issues arise: The mean is computed all along the period so that each value represents the average error the model makes in the specific context of a province ( Figure 6).

Figure 6: MPE Distribution on different time horizons
The distributions of the error for the total cases and the currently infected are similar. They both show mean values close to 0, low variances, and their errors are slightly negatively skewed. This means that the model tends to underestimate their values. However, the I variable, since it depends not only on β but also on the other two parameters, shows signs of higher uncertainty and its variance grows faster as the time horizon goes ahead in the future.
With regard to the recovered variable, its distribution is also negatively skewed meaning that the model tends to underestimate recovered as well, even though this could also be a consequence of the currently infected biased estimates. Moreover, R shows signs of high uncertainty, being the variable with the highest variance at low time horizons. As noted before, the values used for R are not actually reported real data points but estimated computed using regional data. The distributions show that the lack of real data for this variable could be one of the major issues in the model results.
The deceased variable shows the best results in terms of accuracy in forecasting. Its mean is quite constant and close to 0 even as the time horizon grows. Its variance is still acceptable when the predictions are 15 days ahead in the future. Contrary to all the other variables, the MPE on D show positive values for the mean as well as a positive skewness, meaning that, on average, the actual deaths are higher than the ones predicted. However, the skewness is not considered relevant and, in general, the model's performance for this variable is good. Detailed values for the MPE distribution analysis are reported in Table 4. The underestimation issue is probably due to an optimistic (i.e. lower) prediction of the model about the future development of β, the transmission rate. One factor that could explain this issue and that is proved to be highly correlated with the number of new cases is the number of Covid-19 antigen tests conducted daily, which has been increasing since the beginning of the epidemic. This variable could not be included in the model due to data unavailability at the NUTS-3 level. In addition to that, the policy concerning the reporting of each of the category might have changed over time and throughout the country, making it difficult for the model to adjust to those changes.
Although the model shows good results in the short-term, the mean values, as well as the variances, of the MPE tend to diverge from 0 as the time horizon widens. In order to choose a maximum reasonable time horizon for which the model's predictions can still be considered reasonable, the distribution of the error on currently infected is studied, since I is the pivotal variable of the model. The MAPE is used again because the relevance is on the weight of the error. Figure 7 shows the evolution of the error with the growing days of prediction for each province using the regional aggregation training. The majority of the provinces shows low level of error even when the day of the prediction is 15. The plot in Figure 7 also shows similar slopes in the growth of the MAPE for almost all of the provinces as the time horizon grows, with only few having unacceptable levels of MAPE displaying exponential growth. The boxplot in Figure 8 provides an insightful summary about the MAPE by province distribution for each day with respect to multiple horizons. For a time horizon lower than 5 days, 75% of the provinces are accurately predicted with percentage errors lower than 10%. A time horizon equal to 6 days still shows an acceptable level of error with almost all of the provinces below the 20% threshold. Even when the time horizon covers 13 days, half of the provinces show errors below 25%, meaning that although the overall accuracy decreases, the model still performs pretty well on some provinces. The maximum reasonable time horizon is chosen using the value of the 3rd quartile metric and setting the upper bound to 20%, so that at least 75% of the provinces would show acceptable levels of prediction errors. Using this method, the resulting maximum time horizon is 9 days. We consider predictions within a 7 to 9-day period as being still accurate enough, while any consideration based on the model beyond this horizon may be misleading and should be carefully assessed.

Clustering the provinces by one-week errors on I
On the basis of the conclusions in Section 5.2, weekly predictions are considered the optimal context of application for our model. Here, the MAPE on currently infected is used using a one-week horizon. Figure 9 shows how the one-week prediction error varies when we start to forecast the currently infected in different days. We can see that there are no alarming shifts in the model accuracy and that the large majority of the provinces are always below the 20 % threshold. Although this happens in the sample period of our choice, it is likely that the model accuracy has improved since the beginning of the epidemic, when most provinces reported very low numbers of cases, making the predictions harder.

Figure 9: MAPE on weekly predictions over time
We now present the results on the average weekly MAPE by province for the currently infected I (the variable used to select the correlated time series) using regional correlation. Almost half of the provinces show an average MAPE below 10% and only 8 perform badly on average, with a weekly MAPE above 20% (Figures 10, 11 and 12). There are different reasons why the model is unable to accurately forecast the development of the disease in these provinces. For example, some of them, such as Oristano and Matera, are among the least-hit provinces in Italy. On the other hand, there are some provinces like Imperia that show quite inconsistent time series on the official reported total cases, with frequent later adjustments. The following is the complete list of provinces with a MAPE less than 10%, between 10% and 20% and more than 20%.

Bootstrap prediction intervals
Another way to assess the model accuracy and the confidence level at different time horizons is by estimating prediction intervals for the parameters, and in turn, for the variables. In order to build prediction intervals for the model's parameters, a forward bootstrap algorithm using fitted residuals was used [19]. A zero lower bound was imposed for all the parameters so as to avoid results that contradict the compartmental logic of the SIRD model. The number of lags in each regression is kept constant during the bootstrap re-training repetitions. The same procedure is applied to the three regressions of the model, respectively used for β, γR, and γD. The lower (low) and upper (up) bounds for the basic reproduction number are computed using Equation (5). However, when all the three parameters have a zero lower bound, the upper bound of R0 cannot be computed since the denominator will be equal to 0. Bootstrap interval for each parameter are shown in Figure 13. Figure 13: Parameters' prediction intervals with α = 10 % -Torino Each of the model's variables depends on all of the parameters so that the obtained error range for a parameter must be combined with the other two parameters' intervals: thus, the intervals for the variables are subject to the uncertainty of three different parameters and can be composed in different ways.
Combining lower and upper bounds of the parameters can be misleading since the variables of the SIRD model develop in different directions and, especially, each variable depends on the past value of I(t) which in turn depends on S(t − 1), R(t − 1), and D(t − 1). Nevertheless, combinations of interest can be used to describe the epidemic development in particular scenarios. The method proposed here is to use the prediction interval for the parameter of interest and use point estimates for the other two parameters. Thus, the effects of the variability of the parameter can be easily displayed on each variable. According to this method, when the parameter of interest is β, the following equations are used to compute the prediction intervals for each variable: S(t + 1) low/up = S(t) low/up 1 − β(t) up/low I(t) up/low n R(t + 1) low/up = R(t) low/up + γD(t)I(t) low/up D(t + 1) low/up = D(t) low/up + γR(t)I(t) low/up I(t + 1) low/up = n − S(t + 1) up/low − R(t + 1) low/up − D(t + 1) low/up Bootstrap interval for each variable are shown in Figure 14.

Conclusion and further developments
The model presented in this paper can be applied at the NUTS-3 region level in Italy in order to predict the future development of the epidemic in the specific provincial con-text. Although two main training approaches were presented, the regional aggregation training has proved more accurate and it is therefore recommended.
The main issue found during the building of our model was the lack of detailed and consistent data about the epidemic at the provincial level: if more variables had been available, the model could have been extended to include other compartments, such as the hospitalized cases or the number of tested individuals. The recovered individuals data was also not available and, therefore, an estimate using regional data was necessary. Finally, the state of emergency in which the data was collected is likely to have affected its quality and its consistency. The sum of these issues has definitely been detrimental to the model predictive power. Nevertheless, the model seems to perform relatively well in the short-term up until a 9-day horizon and with the variable we were able to scrap from regional authorities and local newspaper websites.
Predictions about the peak day or the "0 new cases" day can also be done but they are likely to be far less accurate than the ones made with a wider geographical perspective, such as the national level, given the local context and the low numbers our model faces. Nonetheless, the model presented can be useful to gain a general understanding about the epidemic development in the short-term at the local level. Particularly, it could be implemented to monitor and signal the provinces at greater risk in the near future.
Along with the forecasting of the SIRD variables, the model offers other insights about the epidemic development. The computation of the parameters provide three informative time series about the evolution of the disease in each specific context. For example, the analysis of the transmission rate β(t) evolution within a province or the comparison among multiple ones can be extremely useful to gain additional information about which and how containment measures have been effective. On the other hand, the values of recovery rate and mortality rate can highlight issues and strengths of the health system across the country in small areas.