{'fraction_non_alphanumeric': 0.03180495635597472, 'fraction_numerical': 0.013979465569713388, 'mean_word_length': 4.737145049884881, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modelling COVID-19 -- I A dynamic SIR(D) with application to Indian data

We propose an epidemiological model using an adaptive dynamic three compartment (with four states) SIR(D) model. Our approach is similar to non-parametric curve fitting in spirit and automatically adapts to key external factors, such as interventions, while retaining the parsimonious nature of the standard SIR(D) model. Initial dynamic temporal estimates of the model parameters are obtained by minimising the aggregate residual sum of squares across the number of infections, recoveries, and fatalities, over a chosen lag period. Then a geometric smoother is applied to obtain the final time series of estimates. These estimates are used to obtain dynamic temporal robust estimates of the key feature of this pandemic, namely the"reproduction number". We illustrate our method on the Indian COVID-19 data for the period March 14 - August 31, 2020. The time series data plots of the 36 states and union territories shows a clear presence of inter-regional variation in the prognosis of the epidemic. This is also bourne out by the estimates of the underlying parameters, including the reproduction numbers for the 36 regions. Due to this, an SIR(D) model, dynamic or otherwise, on the national aggregate data is not suited for robust local predictions. The time series of estimates of the model enables us to carry out daily, weekly and also long term predictions, including construction of predictive bands. We obtain an excellent agreement between the actual data and the model predicted data at the regional level. Our estimates of the current reproduction number turn out to be more than 2 in three regions (Andhra Pradesh, Maharashtra and Uttar Pradesh) and between 1.5 and 2 in 13 regions. Each of these regions have experienced an individual trajectory, which typically involves initial phase of shock(s) followed by a relatively steady lower level of the reproduction number.


Introduction
The basic deterministic SIR(D) (susceptible-infected-removed) model for the evolution of an epidemic over time was proposed by Kermack and McKendrick in 1927 and has been widely used and accepted. It is a three compartment model that focuses on the effective contact rate β, the recovery rate ν, and the fatality rate µ, which are all assumed to remain constant throughout the epidemic. While this model has been very fruitful, there have been numerous variations of it, spurred by a need to accommodate factors specific to a given epidemic.
Like all models, SIR(D) envisages an ideal situation and hence some of the primary assumptions governing the spread would always be violated in any real-life epidemic, and COVID-19 is no exception. For instance, there have been periodic local and national interventions as well as different levels of compliance to safety precautions. Many variations of the SIR(D) have been proposed and used in the context of COVID-19. See for example, Kucharski et al. (2020), Liu et al. (2020) and Sun et al. (2020).
In particular, for India, there is clear evidence that the nature and extent of spread of COVID-19 has been varied widely across its 36 states and union territories (henceforth collectively referred as "regions"). This is evident from the various time series plots that we shall exihibit later. See also, for example, the recent article of Ranjan (2020). As a consequence, any modelling and analysis must be done at least region-wise, which is what we attempt in this article.
It is also important to investigate the spatio-temporal dependence in COVID-19 data. Cliff and Ord (1981) showed how taking spatial dependence into consideration can be useful in the statistical analysis of epidemics. One may be able to "borrow strength" from connected (not necessarily geographically) regions for an improved analysis. This significantly more challenging issue is not addressed in the present article.
We stick to the basic tenets of the time tested SIR(D) model. However, as mentioned above, there are underlying movers that disturb the ideal SIR(D) world. For India, primary among these are-various lockdowns and unlocks, migration of people at different levels and, level of compliance with the guidelines. Further, there are issues with the collected data-under-reporting; delayed reporting; change in the methodology of reporting; evolution of medical/clinical methods for case identification over time, including method of sample collection and laboratory testing procedure. There have been attempts by researchers to incorporate at least some of these factors into an SIR(D) model. See for example Ansumali and Meher (2020) and Kotwal et al. (2020).
However, we do not try to delineate the effects of these external factors. We take a parsimonious approach and do not add further controlling parameters. We continue with the SIR(D) model but let it evolve adaptively with the temporal data. It is possible to do so in this case since, unlike other epidemics, for COVID-19, in addition to number of infections, time series data is also available on number of recoveries and fatalities. In a broad sense our approach is akin to non-parametric curve fitting.
In Section 2, we give a brief background on the history and nature of spread of COVID-19 in India. In Section 3 we first introduce the concept of the reproduction number. Then we explain briefly the basic SIR(D) model and the formula for the reproduction number for this model in terms of the model parameters. We also present our extension of this model, inspired by non-parametric curve fitting techniques, and present methods of estimating the relevant parameters. In Section 4 we provide a detailed description of the findings based on our analysis of the region-wise Indian data. Section 5 concludes with discussions and some observations for future work.

Material: COVID-19 in India
We have used the daily data on number of confirmed, recovered and deceased cases from the 36 states and union territories (in short, regions) of India, for analyses and illustrations of our proposed model. Our primary data source is the volunteer-driven, crowd-sourced database https://api.covid19india.org for COVID-19 statistics and patient tracing in India. We have used the same abbreviated initials for the names of the regions as in this website. The full names are given in Table 1. The first infection in India was reported on January 30, 2020. Prior to March 14, there were only sporadic and stray appearances, of at most 100 confirmed cases across entire India, whose conclusive regional breakup is not clear. An overwhelming number of regions had none to a very low number of infections till then. Figure 1 gives the dates of "first appearance" and the counts for different regions in the early period since March 14, when the number of infections saw a rapid increase. The extent and speed of spread across regions have been quite varying. See Figures 2 and 3. We thus restrict our analysis to daily regional data for the period March 14-August 31, 2020.
It is not the goal of this paper to identify and quantify the factors governing this regional heterogeneity. Nevertheless, we present a short review of some of the more important factors that are relevant, borrowing from Wikipedia (2020), The Print (2020) and HT (2020a).
(i) Lock and unlock: salient features. The Central and State Governments announced and implemented different containment measures such as complete and partial national lockdowns, local lockdowns, closure and re-opening of certain offices, businesses, schools, closure and partial reopening of domestic and international transport, prohibition on travel and outdoor activities. Table 2 summarises the key intervention dates. We give some of the salient features of these interventions below.  zone" which had infection hotspots, "orange zone" with moderate amount of infection, and "green zone" with no infections. On April 20, reopening was allowed for: agricultural businesses, aquaculture, plantations and farming supplies shops; public works programmes with social distancing; cargo transportation; banks and government centres distributing benefits. On April 25, opening of small retail shops was allowed with half the staff and social distancing. On April 29, inter-state movement of stranded persons were allowed under suitable guidelines.
Phase 3 (May 04 to May 17): The three zones were redefined: red (130 districts) with high COVID-19 cases and a high doubling 1 rate; orange (284 districts) with comparatively fewer cases than red; green (319 districts) without any cases in the past 21 days. The red zones remained under lockdown, only private and hired vehicles were allowed in orange zones, and normal movement was permitted in green zones with buses limited to 50% capacity. The zone classification was monitored once a week.
Phase 4 (May 18 to May 31): Regions were given a larger say in the demarcation of the three zones and their implementation. Red zones were further divided into containment and buffer zones and local bodies were given the authority to demarcate these.
Unlock 1.0 (June 01 to June 30): Lockdown restrictions were imposed only in containment zones, while activities were permitted in other zones in a phased manner. From June 08, there was reopening of shopping malls, religious places, hotels and restaurants. Large gatherings were not permitted. Inter-state travel was permitted. Nightly curfew was imposed from 9 p.m. to 5 a.m. in all areas. State governments were allowed to impose suitable restrictions on all activities.
Unlock 2.0 (July 01 to July 31): Lockdown measures were imposed only in containment zones. In all other areas, most activities were permitted. Nightly curfew period was modified slightly. State governments continued to be at liberty to impose suitable restrictions. State borders remained open. Inter-and intra-state travel was permitted. Limited international travel was permitted as part of the Vande Bharat Mission (see below). Shops were permitted to allow more than five persons at a time. Educational institutions, metros, recreational activities remained closed till July 31. Only essential activities were permitted in containment zones, while maintaining strict parameter control and "intensive contact tracing, house-to-house surveillance, and other clinical interventions".
Unlock 3.0 (August 01 to August 31): Night curfews were removed and gymnasiums and yoga centres were permitted to reopen from August 05. Educational institutions remained closed till August 31. All inter-and intra-state travel and transportation was permitted. Independence Day celebrations was permitted with social distancing. Maharashtra and Tamil Nadu imposed a lockdown for the whole month, while West Bengal imposed lockdowns twice a week and later made some adjustments.
In addition to the above, there have been other restrictions and guidelines that have affected the spread. For instance, the movement across Myanmar border along Mizoram and Manipur was restricted since March 09.
(ii) Migration: It appears that no definitive data is available on the (reverse) migration of workers who were left stranded in their places of work as businesses and other activities came to a standstill after the first lockdown was announced.
We gather from different news sources that soon after the national lockdown was announced, a first wave of migration begun around March 24, 2020 and lasted for about two weeks. Much of the inter-region migration appears to have taken place initially from Delhi, Gujarat, Haryana, Maharashtra and Punjab, to Assam, Bihar, Madhya Pradesh, Orissa, Rajasthan, Uttar Pradesh, and West Bengal.
Later the migration occurred between additional states; for example from Karnataka, Maharashtra, Tamil Nadu and West Bengal to Assam, Manipur, Meghalaya and Tripura. This wave started around May 04, 2020 and again lasted for about two weeks.
After the first phase of unlock, many of the returnees began to go back to their places of work in different regions.
Estimates of the total number of people that moved during these migrations in the last six months vary widely, but all of these run into several hundred thousands. There is evidence that the first group of returnees had an extremely low percentage of infected persons and hence had extremely low risk of spreading the virus. The later group of returnees had a much higher percentage of infected people and the risk of spread increased significantly. See for example Mohan and Amin (2020) for a report on a limited study in Rajasthan and The Wire (2020) for news on spike in cases in the North-eastern states after May 04, 2020.
(iii) International flights: Vande Bharat Mission: Regular international flights to and from India remain suspended since March 22 till August 31, 2020 (see HT (2020b)). However, later about 2500 flights of foreign carriers were allowed to and from India, particularly for stranded foreign passengers.
The Vande Bharat mission of the Government of India was launched on May 07, 2020 to bring back stranded Indians from around the world. Special flights, both of Government and private airlines, to and from designated cities, were flown for this purpose in five phases-May 07-15, 2020; May 17-June 10; June 11-July 02; July 15-31; August 01-31. A sixth phase is planned from September 01-October 24, 2020. Economic Times (2020) reports that as of August 20, over 11.2 lakh Indian nationals have returned from abroad on these flights. Stranded Indians have also returned by land from the neighbouring countries.
Again, the regional variation in the count of returning Indians have been significant. While quarantine protocols have been in place for incoming passengers, there have been laxity of varying degrees in adherence to the restrictions, thereby introducing another level of variation between the regions.
Additionally, there have been other measures such as, mandatory quarantine for interstate travellers, home isolation for infected individuals and restriction of human movement around places of infections. Orders and advisories issued by local authorities were guided by local situations and hence were also varied. There have also been variations in the implementation of, and compliance to, all the different orders over time. Moreover, it is commonly accepted that there is non-uniformity in the manner the data has been collected as well as in its coverage and quality. Thus, the growth and spread has been quite varying across the 36 regions. The models we shall propose shortly, are thus going to be implemented regionally.

Model
Before we explain our model and procedures, we give a brief introduction to the basic SIR(D) model, including how the crucial concept of the reproduction number relates to 7 the model parameters.

Reproduction number and the SIR(D) model
We may consider three essential parameters that drive any epidemic: -the transmissibility parameter τ . This is the probability of infection, given contact between a susceptible and an infected individual; -the average rate of contact between susceptible and infected individuals, sayc; -the duration of infectiousness, d.
Simply put, the basic reproduction number, usually denoted by R 0 is the expected number of secondary cases produced by a single (typical) infection in a completely susceptible population. It is a dimensionless quantity and can be interpreted as Its importance stems from the fact that it can be related to key quantities that dictate whether an epidemic progresses or dies off.
The reproduction number has a direct interpretation in an SIR(D) model (Susceptible-Infected-Removed (Deceased)). The "removed" group consists of those individuals who have recovered or have succumbed. This model for the propagation of an epidemic was originally introduced by Kermack and McKendrick in 1927, and along with several variations, have been reprinted as Kermack and McKendrick (1991a, b, c) due to their immense importance and use. Here is a brief introduction to this model. Often these counts are expressed as proportions and then we can assume that N is normalized to 1.
The SIR(D) model governing the propagation (over continuous time) of the epidemic honouring Assumption I is given by a simultaneous differential equation: Note that the four equations (1)-(4) add up to 0, reflecting Assumption I(a). The parameters β, ν and µ which govern the nature of the epidemic are constants, reflecting Assumption I(b). They are known as the effective contact rate, recovery rate and the fatality rate respectively. It is clear that the epidemic shall progress if the number of infected individuals increases over time: Initially, everyone, except the first infected case is susceptible. Hence S(0) ≡ 1 So from (6), for the epidemic to progress we must necessarily have β ν + µ > 1.
On the other hand, it is easy to see that in this SIR(D) model, τc = β, and d = (ν + µ) −1 .
This implies that in the SIR(D) model, the reproduction number is nothing but and thus the epidemic progresses if this quantity is > 1. Therein lies the importance of the reproduction number.
Note that for the SIR(D) model, the reproduction number is a function of the three parameters and does not change over time. For more complicated models, the definition and interpretation of the reproduction number is necessarily much more involved. It may also evolve over time, specially if there are interventions (such as locks and unlocks).

Estimation, model fitting and prediction
As mentioned earlier, we do not try to build a model with components that explicitly accounts for the factors inducing changes to the underlying epidemiological system. Our approach is to start with the standard SIR(D) model and allow it to automatically respond and adjust to the underlying dynamics that arise from such factors.
With respect to the SIR(D) model, note that the data is obtained only at discrete points (in our case daily). Let s(t) = increment in susceptible individuals in the tth time period, Estimate of the parameters β, ν and µ. As mentioned above we use the RSS. This is done adaptively over a few lagged time points. Since there are three parameters, one needs data for at least three periods. However, since the data in the initial time periods are sketchy, and also there are smoothness issues, as a general principle, we use a window of past seven days in our estimation procedures. When we are at time point T , the initial estimates are obtained by using the least squares on the data for the periods, T − 6, T − 5, T − 4, T − 3, T − 2, T − 1, T -minimizing the sum of squares: whereî(t),r(t) andd(t), are the observed values of infections, recoveries and fatalities in the t-th period. The values of i(t), r(t) and d(t) for given parameter choices (over a grid) are obtained by numerically solving the differential equations as mentioned above.
The various shocks that the system experiences would also be reflected in the time series of the underlying parameters and hence in their estimates. Thus, after obtaining the initial estimates, we use a smoother: we chose a weighted average over the last 7 days' estimates with geometrically decreasing weights 0.75 T −j at time points j = T − 6, . . . , T . Other smoothers could also be used. After trial and error, we settled on the value 0.75. We thus arrive at our robustified final estimates say, β T , ν T and µ T at the time point T .
Estimate of the reproduction number R 0 : As mentioned earlier, the reproduction number R 0 is a key quantity that governs the spread of an epidemic and provides a one number summary of the state of the epidemic-even in a situation such as ours where we apply penalization methods and work with a modification of the basic model. The magnitude of this number indicates whether the epidemic shall spread or die down, and how fast. Due to the dynamic nature of our model and estimation process, this parameter too is now a time series and requires appropriate estimation procedure.
Recall the relation (7) between R 0 and the three SIR(D) model parameters. Once estimates of β, ν and µ are obtained as described above, an estimate of R 0 at any time point can be obtained from (7) by plugging in the above estimated SIR(D) parameters. However, this produces a lot of spikes in the estimates. We robustify this estimate by using the median of a moving window of seven past values to obtain our final estimate R 0T . This window can be the entire past (conservative) or the recent past (more adaptive but less conservative). We could have used other means of robustification too.
This completes our estimation procedure. Note that the final estimates β T , ν T , µ T and R 0T continue to evolve over time. Moreover, at any given time T , they do not necessarily satisfy equation (7). This should not be a cause for concern since after all, the SIR(D) model is not expected to be a perfect model for the epidemic and hence equation (7) is not sacrosanct.
Point prediction of I(·), R(·) and D(·): Given the estimated parameters, the SIR(D) model can then be solved numerically. So, we use our estimates β T −1 , µ T −1 and ν T −1 obtained at time T − 1 to calculate the 1-step ahead predicted (solved) values of I(T ), R(T ) and D(T ). We can also calculate the k-step ahead predicted values. While solving this, we found it extremely useful to add the obvious but crucial constraint R(T ) + D(T ) ≤ I(T ).
Prediction bands for I(·), R(·) and D(·): Our SIR(D) model, even though dynamic, has no random component. Thus it does not automatically facilitate calculation of prediction bands. We fall back on a non-parametric method for this purpose. At any given time point T , and for any specific variable (infection/recovery/death), we have the past errors (say, from one-step prediction). We can consider the empirical distribution of these T −1 error values (or some suitable robust version). A predictive interval is then obtained by building an interval around the point prediction value using this empirical distribution.
It may be noted that if we wish to have a predictive band for the k-step ahead predicted value, the width of the band remains same as there is no updated empirical distribution available. In contrast, with regard to data availability, regional data for finer administrative units (for example the 739 districts of India) is scattered in heterogeneous and/or incompatible formats across numerous local sources. It can be an onerous task to authenticate, clean and collate this data to bring it to a common platform for analysis. Thus, we have used regional data available from https://api.covid19india.org. While this data is updated daily, it has idiosyncrasies such as, missing values, negative counts, delay in updating, change in the reporting format, all of which are expected in a situation as complex as COVID-19. Thus some preliminary consistency checks and cleaning were carried out before proceeding to analyse the data. In Figure 5 we have plotted the daily count data after dividing the regions into three groups with cumulative infections till August 31, 2020 as: less than 10,000 (12 regions), between 10,000 and 100,000 (13 regions) and above 100,000 (11 regions).
As mentioned earlier, due to known and hidden factors, a simple SIR(D) model cannot be a good fit and one needs to be adaptive to the changes in the spread. Figure 6 illustrates this on Delhi data. The solid line in the left panel corresponds to the fitted values obtained using a single SIR(D) and overlayed with the observed data clearly shows model inadequacy. The middle and right panels use a modified SIR(D) to accommodate a single (known) change point-at the 100th day (middle panel) and at the 101th day (right panel). While the fit improves somewhat, vulnerability to the choice of change point is evident and moreover, the fit is still unsatisfactory.  Left and right panels: number of daily infections and recoveries respectively.
As already pointed out, making the model dynamically adaptive alone may not be sufficient. Figure 7 on the Delhi data illustrates the improved performance as we incorporate additional penalties for lack of model fit. The plots in the bottom panel, obtained by our proposed method, are in sharp contrast to those in the top panels which were obtained by commonly used partial penalty methods. These plots clearly demonstrate the advantage of optimising over the combined RSS with respect to all three variables, over a window of data, yielding a dynamic SIR(D) model. The observed and the fitted values are seen to be in excellent agreement while this dynamic SIR(D) continues to be parametric.
Since the proposed SIR(D) model is allowed to evolve over time, estimate of these parameters are updated daily by refitting the model taking into account the additional observations for the day.
As explained in Section 2, there are several local and general shocks and perturbations that the underlying epidemiological system experiences. These are naturally reflected in the time series of the underlying parameters. Our dynamic model captures these and we notice some changes in the parameter estimates as well. Thus, after obtaining the initial estimates, we use a weighted average over the estimates from the past week with decreasing weights. As an illustration, the spiky and smoothed estimates of the three parameters and the robust estimate of R 0 for Delhi are plotted in Figure 8. We implemented the above in the software R. For solving the primary differential equations of the SIR(D) model numerically, we used the standard library, desolve within R. Additional codes required to carry out robust estimation and prediction were also implemented in R. The entire programme takes a few minutes to run on an Intel core i3, 2.4GHz computer with past 6 months data on all 36 Indian regions. Detailed plots and figures are given in the Supplementary file. We present briefly the highlights: (i) Reproduction number: Figure 9 gives the estimate for the current reproduction number, as on 31-Aug-2020, for all the regions.   Plots for the time varying estimates of R 0 for nine regions with highest number of infections are given in Figure 10. Plots for all the regions can be found in the Supplementary file. We have robustified our basic estimate by considering the median over the previous two weeks. We also tried a more conservative version by taking the median over the entire past. We have already noted that most regions seem to have evolved in their individual ways and this observation continues with respect to R 0 . However there are similarities. For instance, there is typically an initial phase of shock(s) followed by a relatively steady (and lower) level of R 0 . For some regions it appears that there is a gradual decreasing trend as well, indicating that the peak of the pandemic may be in sight over the coming months in these regions.
As we mentioned above, the regions have evolved differently over time and this becomes evident when we carry out a time series clustering. We use the method of Ward (1963) which minimises the between-cluster Euclidean distance at each sequential step. The height of the fusion given on the Y -axis, indicates the dissimilarity between two observations. The proximity of two observations along the horizontal axis does not signify any closeness. Figure 11 shows the clusters of regions based on the time series of reproduction numbers. (ii) Prediction: We have calculated the daily predicted values of the infected, recovered and deceased, along with 99% predictive intervals. Note that the derivation of the predictive interval requires estimation of the error distribution. This has been done non-parametrically by using the past errors in prediction. We illustrate this with the Delhi data since this region shows sharp turns in the daily values and thus is relatively difficult to predict. Prediction for all the regions is available in the Supplementary file, along with the estimated predictive error distribution in each case. We have also carried out one full year's prediction to assess the time and extent of future peaks. Figure 13 gives the plots for nine regions. These regions were chosen since they have the maximum number of infections as of August 31. See the Supplementary file for values for all regions. It may be noted that in several regions, the number of infections and fatalities are predicted to rise significantly. The heterogeneity in these figures across regions is also very noticeable. In several regions, the pandemic is far from over and have not seen their peaks. However, there is reason for optimism since in some regions the spread seems to be slowing down.

Discussion
We have considered a dynamic version of the time tested SIR(D) model and fitted it to the Indian regional COVID-19 data. This has been done by minimising aggregated RSS dynamically over sliding windows. Appropriate smoothers and robustification methods have been used to obtain time series estimates of the effective contact rate, the recovery rate, the fatality rate and the reproduction number. We have illustrated our method on the COVID-19 Indian regional data. Out of the 36 regions, 20 have a reproduction number higher than 1.0 and three of these are higher than 2.0. We also use the fitted model for short and long term prediction of the number of infection, recoveries and fatalities. The projected pattens are quite varying by regions and while the prognosis is good for some regions in others a sharp rise is foreseen.
Progression of COVID-19 in India is impacted by spatial dependence and it would be pertinent to develop a spatio-temporal model with regions or even districts as the primary units. We plan to investigate this by developing a suitable spatio-temporal model. Studying the effects of migration is a particularly challenging task.