Key Words: SIR Modeling, Epidemic Model, Forecasting, Time Series, Interactive Visualization

Dr. Edward Parker used John Hopkins Center for Systems Science and Engineering data to build a Shiny COVID-19 tracker that allows the user to visualize global changes of either COVID-19 or SARS outbreak at a daily rate. The visualization also highlights the number of new cases and number of deaths for a given country.

Objectives

In Data 604 (Simulation and Modeling Techniques), I was introduced to developing models of an epidemic as it spreads in a susceptible population. I will use the covid19.analytics library.

I was inspired by Dr. Parker’s tracker and Dr. Rai’s research. Data 608 (Visual Analytics) also helped prepare me to create animated and interactive visualizations.

In Data 624 (Predictive Analytics), I used ARIMA Models to forecast the total international visitors to Australia. I will also utilize the prophet library.

Data

In order to successfully complete these objectives, I will utilize the data sets in the following Github.

Methodology

When COVID-19 was first discovered, the below global data from January 2020 - March 2020 was collected. The data includes age, symptoms, whether the patient lives in Wuhan, travel history etc. For our analysis, we are interested in visualizing the cases by US county. This information is helpful to understand where cases can spread. Leaflet library can help achieve this.

Load Data

# early COVID data - leaflet map of US
# group data by the city/county
early_data <- read.csv("/Users/aaronzalki/Downloads/latestdata.csv", header = T)
usa <- early_data %>% filter(country == 'United States')
usa <- usa %>% group_by(city, province, longitude, latitude) %>% 
  summarise(count = n()) %>% 
  arrange(desc(count))
#the below commented code will tabulate the usa dataframe
#kable(usa) %>%
#kable_styling(bootstrap_options = "bordered") %>%
#row_spec(0, bold = T, color = "black", background = "#7fcdbb")

glimpse(usa)
## Rows: 1,322
## Columns: 5
## Groups: city, province, longitude [1,322]
## $ city      <chr> "", "New York City", "", "", "Westchester County", "Nassau …
## $ province  <chr> "New York", "New York", "New Jersey", "California", "New Yo…
## $ longitude <dbl> -75.64646, -73.94400, -74.67120, -119.67788, -73.75697, -73…
## $ latitude  <dbl> 43.01409, 40.66100, 40.20301, 37.38020, 41.16249, 40.73995,…
## $ count     <int> 23708, 17373, 6306, 5074, 4679, 3241, 2921, 2058, 2000, 166…

Early Data Visualization

County

We can also add a filter to concentrate on fewer states.

New York & New Jersey

The below toggle can hide/unhide the States that the user selects/deselects.

Interactive Toggle

Cluster Counties

Animation Plots

We can see an exponential growth in March.

Exploratory Data Analysis

For this analysis, we will be referring to unemployment claims data by US State and daily COVID confirmed cases data. This COVID data is more up to date than the above used for the County Map and Animated Visualizations.

Load Data

# Unemployment data - USA
df <- read.csv("https://raw.githubusercontent.com/aaronzalkisps/data698/main/state_claims.csv", header = T)

glimpse(df)
## Rows: 3,604
## Columns: 7
## $ State                     <chr> "Alabama", "Alabama", "Alabama", "Alabama",…
## $ week                      <dbl> 43834, 43841, 43848, 43855, 43862, 43869, 4…
## $ Initial.Claims            <dbl> 4578, 3629, 2483, 2129, 2170, 2176, 1981, 1…
## $ Reflecting.Week.Ended     <chr> "12/28/19", "1/4/20", "1/11/20", "1/18/20",…
## $ Continued.Claims          <dbl> 18523, 21143, 17402, 18390, 17284, 16745, 1…
## $ Covered.Employment        <dbl> 1923741, 1923741, 1923741, 1923741, 1923741…
## $ Insured.Unemployment.Rate <dbl> 0.96, 1.10, 0.90, 0.96, 0.90, 0.87, 0.86, 0…
# COVID data - USA
df2 <- read.csv("https://raw.githubusercontent.com/aaronzalkisps/data698/main/coronavirus_states.csv", header = T)

glimpse(df2)
## Rows: 15,854
## Columns: 15
## $ State              <chr> "Washington", "Washington", "Washington", "Illinoi…
## $ date               <chr> "1/21/20", "1/22/20", "1/23/20", "1/24/20", "1/24/…
## $ week               <dbl> 43855, 43855, 43855, 43855, 43855, 43855, 43855, 4…
## $ fips               <int> 53, 53, 53, 17, 53, 6, 17, 53, 4, 6, 17, 53, 4, 6,…
## $ cases              <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1,…
## $ deaths             <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ population         <int> 6724540, 6724540, 6724540, 12830632, 6724540, 3725…
## $ new_cases          <int> 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,…
## $ new_deaths         <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ days_since_death10 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ days_since_case100 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ per100k            <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ newper100k         <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ deathsper100k      <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ newdeathsper100k   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…

Merge Data

The two data frames are joined by week and State. This will provide how many COVID confirmed cases and unemployment claims occurred for a State in a given week. After pivoting the data, we can conclude that from the weeks 01/26/20 - 12/21/20 the top 5 states to record the most COVID cases are: California, Texas, Florida, Illinois and New York.

COVID Data Summary

covid_df

Map Template

We will utilize the following map template from ggplot2.

Unemployment Data Summary

After pivoting the data, we can conclude that from the weeks 01/26/20 - 12/21/20 the top 5 states to record the most unemployment claims are: California, New York, Texas, Georgia, and Florida.

ue_df

Data Preparation

#group total claims
subset2 <- no_zero[c(2,3,5)]
#remove duplicates
distinct_subset2<-unique(subset2)

df_join <- df4 %>% full_join(distinct_subset2, by=c("week", "State"))
#date format
dpm<- as.Date(df_join$week)
dpm <- dpm %m-% years(70)
dpm_df <- as.data.frame(dpm)
final_df <- cbind(dpm_df, df_join)

conditions <- filter (final_df, !State %in% c("Virgin Islands", "Puerto Rico", "Northern Mariana Islands", "Guam", "District of Columbia"))

#the below commented code will tabulate the merged dataframe

#kable(conditions) %>%
#kable_styling(bootstrap_options = "bordered") %>%
#row_spec(0, bold = T, color = "black", background = "#7fcdbb")

#pivot data


weekly_ue <- conditions %>%
  group_by(dpm)%>%
  summarise(claim_sum=sum(Initial.Claims))

names (weekly_ue) <- c("Week","Unemployment Claim")

#the below commented code will tabulate the unemployment claims data

#kable(weekly_ue) %>%
#kable_styling(bootstrap_options = "bordered") %>%
#row_spec(0, bold = T, color = "black", background = "#7fcdbb")

weekly_covid <- conditions %>%
  group_by(dpm)%>%
  summarise(case_sum=sum(case_sum))

names (weekly_covid) <- c("Week","Confirmed COVID Case")

#the below commented code will tabulate the confirmed COVID case data

#kable(weekly_covid) %>%
#kable_styling(bootstrap_options = "bordered") %>%
#row_spec(0, bold = T, color = "black", background = "#7fcdbb")

final_df2 <- cbind(weekly_ue, weekly_covid)
final_df <-final_df2[c(1,2,4)]
kable(final_df) %>%
kable_styling(bootstrap_options = "bordered") %>%
row_spec(0, bold = T, color = "black", background = "#7fcdbb")
Week Unemployment Claim Confirmed COVID Case
2020-01-26 63430 3
2020-02-02 62131 5
2020-02-09 46971 4
2020-02-16 56235 3
2020-02-23 47519 15
2020-03-02 74443 40
2020-03-09 163864 357
2020-03-16 248557 2450
2020-03-23 2879374 21532
2020-03-30 5920274 99075
2020-04-06 6079352 187414
2020-04-13 4845813 216899
2020-04-20 4186423 199967
2020-04-27 3442164 210581
2020-05-04 2763201 193264
2020-05-11 2305713 175582
2020-05-18 2147410 156877
2020-05-25 1884090 155246
2020-06-01 1600893 145901
2020-06-08 1544311 154389
2020-06-15 1445887 151283
2020-06-22 1434831 180497
2020-06-29 1413477 257028
2020-07-06 1377025 339063
2020-07-13 1501234 392431
2020-07-20 1363059 459774
2020-07-27 1192803 463854
2020-08-03 979257 434245
2020-08-10 823559 375297
2020-08-17 874349 362902
2020-08-24 810445 301250
2020-08-31 823605 289983
2020-09-07 854702 292244
2020-09-14 783005 239009
2020-09-21 812885 280328
2020-09-28 729914 307852
2020-10-05 720812 302546
2020-10-12 818784 356551
2020-10-19 756140 391420
2020-10-26 729733 471458
2020-11-02 734824 559425
2020-11-09 718174 742361
2020-11-16 706824 1015006
2020-11-23 825781 1187417
2020-11-30 709284 1131896
2020-12-07 943572 1338682
2020-12-14 925470 1520834
2020-12-21 851448 584482

Linear Regression

COVID cases as the predictor

Unemployment claim as the output

Plot Data

#x axis is covid case, y axis is claim
l_regression <- ggplot(final_df, aes(`Confirmed COVID Case`, `Unemployment Claim`))
l_regression + geom_point()

The plot concludes a weak linear relationship with a -0.15 correlation strength as seen below.

cor(final_df$`Confirmed COVID Case`, final_df$`Unemployment Claim`)
## [1] -0.1503112

Forecasting

Unemployment

Auto ARIMA chose the model ARIMA(1,0,2)

#date handling
weekly_ue$Week <- as.Date(weekly_ue$Week)
#convert to timeseries
data_ts_ue <- xts(weekly_ue$`Unemployment Claim`, weekly_ue$Week)
#ARIMA
aa_austa<-auto.arima(data_ts_ue)
summary(aa_austa)
## Series: data_ts_ue 
## ARIMA(1,0,2) with non-zero mean 
## 
## Coefficients:
##          ar1     ma1     ma2       mean
##       0.6898  1.2677  0.4765  1308430.3
## s.e.  0.1222  0.1838  0.1786   490132.1
## 
## sigma^2 estimated as 1.797e+11:  log likelihood=-689.96
## AIC=1389.92   AICc=1391.35   BIC=1399.28
## 
## Training set error measures:
##                   ME   RMSE    MAE       MPE     MAPE      MASE        ACF1
## Training set 13382.1 405866 208666 -41.66823 53.16551 0.7719208 0.004131897

Check Residuals

#residual 
checkresiduals(aa_austa)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(1,0,2) with non-zero mean
## Q* = 1.6415, df = 6, p-value = 0.9496
## 
## Model df: 4.   Total lags used: 10

Forecast next 10 weeks via Arima Model

aa_austa_fc<-forecast(aa_austa,h=10)
autoplot(aa_austa_fc)

COVID-19

#date handling
weekly_covid$Week <- as.Date(weekly_covid$Week)
#convert to timeseries
data_ts_covid <- xts(weekly_covid$`Confirmed COVID Case`, weekly_ue$Week)
#ARIMA
ab_austa<-auto.arima(data_ts_covid)
summary(ab_austa)
## Series: data_ts_covid 
## ARIMA(0,1,0) 
## 
## sigma^2 estimated as 2.474e+10:  log likelihood=-629.08
## AIC=1260.17   AICc=1260.26   BIC=1262.02
## 
## Training set error measures:
##                    ME     RMSE      MAE      MPE     MAPE      MASE        ACF1
## Training set 12176.65 155642.1 66718.52 10.87979 25.32519 0.9791667 -0.01591221

Check Residuals

#residual 
checkresiduals(ab_austa)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(0,1,0)
## Q* = 5.7173, df = 10, p-value = 0.8384
## 
## Model df: 0.   Total lags used: 10

Forecast next 10 weeks via Arima Model

aa_austa_fd<-forecast(ab_austa,h=10)
autoplot(aa_austa_fd)

Forecasting via Prophet

The following code will get confirmed cases data from the covid19.analytics library. I have saved the object as ‘tsc’ which stands for time series confirmed. I will filter for United States and will transpose the dataframe.

tsc <- covid19.data(case = 'ts-confirmed')
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## --------------------------------------------------------------------------------
tsc <- tsc %>% filter(Country.Region == 'US')
tsc <- data.frame(t(tsc))
tsc <- cbind(rownames(tsc), data.frame(tsc, row.names = NULL))
#change column name
colnames(tsc) <- c('Date', 'Confirmed')
#lubridate library
tsc$Date <- ymd(tsc$Date)
tsc$Confirmed <- as.numeric(tsc$Confirmed)
# refer to ggplot
qplot(Date, Confirmed, data = tsc, main='COVID 19 Confirmed Cases in US')

ds <- tsc$Date
y <- tsc$Confirmed
#create dataframe with date and confirmed cases
df <- data.frame(ds, y)

Forecast for the next 4 weeks or 28 days

#remove NA in first four rows
N <- 4
df <- tail(df, -N)
fore_cast_case <- prophet(df)
# Prediction
future <- make_future_dataframe(fore_cast_case, periods = 28)
forecast <- predict(fore_cast_case, future)
# Plot forecast
plot(fore_cast_case, forecast)

dyplot.prophet(fore_cast_case,forecast)
prophet_plot_components(fore_cast_case, forecast)

Model performance seems to be strong.

#Model performance
pred <- forecast$yhat[1:546]
actual <- fore_cast_case$history$y
plot(actual, pred)

Results

The following code will get COVID cases data from the covid19.analytics library.

tsc <- covid19.data(case='ts-confirmed')
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## --------------------------------------------------------------------------------
tsa <- covid19.data(case='ts-ALL')
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## -------------------------------------------------------------------------------- 
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## -------------------------------------------------------------------------------- 
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## --------------------------------------------------------------------------------

Top Two Countries Report

report.summary(Nentries=2, graphical.output=TRUE)
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## -------------------------------------------------------------------------------- 
## ################################################################################ 
##   ##### TS-CONFIRMED Cases  -- Data dated:  2021-07-20  ::  2021-07-21 13:11:50 
## ################################################################################ 
##   Number of Countries/Regions reported:  195 
##   Number of Cities/Provinces reported:  88 
##   Unique number of distinct geographical locations combined: 279 
## -------------------------------------------------------------------------------- 
##   Worldwide ts-confirmed  Totals: 191445502 
## -------------------------------------------------------------------------------- 
##   Country.Region Province.State   Totals GlobalPerc LastDayChange   t-2   t-3   t-7  t-14  t-30
## 1             US                34174774      17.85         42703 52111 12048 31845 22931 12334
## 2          India                31216337      16.31         42015 30093 38164 41733 45892 42640
## -------------------------------------------------------------------------------- 
##   Global Perc. Average:  0.36 (sd: 1.63) 
##   Global Perc. Average in top  2 :  17.08 (sd: 1.09) 
## -------------------------------------------------------------------------------- 
## ================================================================================

## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## -------------------------------------------------------------------------------- 
## ################################################################################ 
##   ##### TS-DEATHS Cases  -- Data dated:  2021-07-20  ::  2021-07-21 13:11:52 
## ################################################################################ 
##   Number of Countries/Regions reported:  195 
##   Number of Cities/Provinces reported:  88 
##   Unique number of distinct geographical locations combined: 279 
## -------------------------------------------------------------------------------- 
##   Worldwide ts-deaths  Totals: 4118391 
## -------------------------------------------------------------------------------- 
##   Country.Region Province.State Totals Perc LastDayChange t-2 t-3  t-7 t-14 t-30
## 1             US                609529 1.78           298 212 135  331  292  274
## 2         Brazil                544180 2.80          1424 542 948 1556 1648  761
## -------------------------------------------------------------------------------- 
## -------------------------------------------------------------------------------- 
## ================================================================================

## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## -------------------------------------------------------------------------------- 
## ################################################################################ 
##   ##### TS-RECOVERED Cases  -- Data dated:  2021-07-20  ::  2021-07-21 13:11:53 
## ################################################################################ 
##   Number of Countries/Regions reported:  195 
##   Number of Cities/Provinces reported:  72 
##   Unique number of distinct geographical locations combined: 264 
## -------------------------------------------------------------------------------- 
##   Worldwide ts-recovered  Totals: 126000293 
## -------------------------------------------------------------------------------- 
##   Country.Region Province.State   Totals LastDayChange   t-2   t-3   t-7  t-14  t-30
## 1          India                30390687         36977 45254 38660 39191 44291 81839
## 2         Brazil                17371065         51736 14515 50485 91402 23386 74301
## -------------------------------------------------------------------------------- 
## -------------------------------------------------------------------------------- 
## ================================================================================

## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## ############################################################################################################################################ 
##   ##### AGGREGATED Data  -- ORDERED BY  CONFIRMED Cases  -- Data dated:  2021-07-21  ::  2021-07-21 13:11:53 
## ############################################################################################################################################ 
##   Number of Countries/Regions reported: 195 
##   Number of Cities/Provinces reported: 576 
##   Unique number of distinct geographical locations combined: 3982 
## -------------------------------------------------------------------------------------------------------------------------------------------- 
##             Location Confirmed Perc.Confirmed Deaths Perc.Deaths Recovered Perc.Recovered  Active Perc.Active
## 1 Maharashtra, India   6229596           3.25 130753         2.1   6000911          96.33   97932        1.57
## 2             France   5814442           3.04 110548         1.9    340769           5.86 5363125       92.24
## ============================================================================================================================================
## ############################################################################################################################################ 
##   ##### AGGREGATED Data  -- ORDERED BY  DEATHS Cases  -- Data dated:  2021-07-21  ::  2021-07-21 13:11:53 
## ############################################################################################################################################ 
##   Number of Countries/Regions reported: 195 
##   Number of Cities/Provinces reported: 576 
##   Unique number of distinct geographical locations combined: 3982 
## -------------------------------------------------------------------------------------------------------------------------------------------- 
##             Location Confirmed Perc.Confirmed Deaths Perc.Deaths Recovered Perc.Recovered Active Perc.Active
## 1  Sao Paulo, Brazil   3947574           2.06 135490        3.43   3608391          91.41 203693        5.16
## 2 Maharashtra, India   6229596           3.25 130753        2.10   6000911          96.33  97932        1.57
## ============================================================================================================================================
## ############################################################################################################################################ 
##   ##### AGGREGATED Data  -- ORDERED BY  RECOVERED Cases  -- Data dated:  2021-07-21  ::  2021-07-21 13:11:53 
## ############################################################################################################################################ 
##   Number of Countries/Regions reported: 195 
##   Number of Cities/Provinces reported: 576 
##   Unique number of distinct geographical locations combined: 3982 
## -------------------------------------------------------------------------------------------------------------------------------------------- 
##             Location Confirmed Perc.Confirmed Deaths Perc.Deaths Recovered Perc.Recovered Active Perc.Active
## 1 Maharashtra, India   6229596           3.25 130753        2.10   6000911          96.33  97932        1.57
## 2             Turkey   5546166           2.90  50650        0.91   5395300          97.28 100216        1.81
## ============================================================================================================================================
## ############################################################################################################################################ 
##   ##### AGGREGATED Data  -- ORDERED BY  ACTIVE Cases  -- Data dated:  2021-07-21  ::  2021-07-21 13:11:53 
## ############################################################################################################################################ 
##   Number of Countries/Regions reported: 195 
##   Number of Cities/Provinces reported: 576 
##   Unique number of distinct geographical locations combined: 3982 
## -------------------------------------------------------------------------------------------------------------------------------------------- 
##                  Location Confirmed Perc.Confirmed Deaths Perc.Deaths Recovered Perc.Recovered  Active Perc.Active
## 1                  France   5814442           3.04 110548        1.90    340769           5.86 5363125       92.24
## 2 England, United Kingdom   4812460           2.51 113257        2.35         0           0.00 4699203       97.65
## ============================================================================================================================================

##       Confirmed  Deaths  Recovered   Active 
##   Totals 
##       191408767  4092735 NA  NA 
##   Average 
##       48068.5    1027.81 NA  NA 
##   Standard Deviation 
##       270133.08  5938.14 NA  NA 
##   
## 
##  * Statistical estimators computed considering 3982 independent reported entries 
##  
## 
## ******************************************************************************** 
## ********************************  OVERALL SUMMARY******************************** 
## ******************************************************************************** 
##   ****  Time Series Worldwide TOTS **** 
##       ts-confirmed   ts-deaths   ts-recovered 
##       191445502  4118391 126000293 
##              2.15%       65.82% 
##   ****  Time Series Worldwide AVGS **** 
##       ts-confirmed   ts-deaths   ts-recovered 
##       686184.59  14761.26    477273.84 
##              2.15%       69.55% 
##   ****  Time Series Worldwide SDS **** 
##       ts-confirmed   ts-deaths   ts-recovered 
##       3115192.63 60694.51    2270930.13 
##              1.95%       72.9% 
##   
## 
##  * Statistical estimators computed considering 279/279/264 independent reported entries per case-type 
## ********************************************************************************

Totals Per Location

tots.per.location(tsc,geo.loc=c('US', 'India'))
## US  --  34174774 
## ===============================   running models...=============================== 
##   Linear Regression (lm): 
## 
## Call:
## lm(formula = y.var ~ x.var)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -5990105 -3116262   213501  3201255  7360408 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -7439822     303987  -24.47   <2e-16 ***
## x.var          79415        963   82.47   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3547000 on 544 degrees of freedom
## Multiple R-squared:  0.9259, Adjusted R-squared:  0.9258 
## F-statistic:  6801 on 1 and 544 DF,  p-value: < 2.2e-16
## 
## -------------------------------------------------------------------------------- 
##   Linear Regression (lm): 
## 
## Call:
## lm(formula = y.var ~ x.var)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -8.6520 -1.1534  0.8149  2.0636  2.6528 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 9.3060148  0.2268352   41.02   <2e-16 ***
## x.var       0.0195857  0.0007186   27.26   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.647 on 544 degrees of freedom
## Multiple R-squared:  0.5773, Adjusted R-squared:  0.5765 
## F-statistic: 742.9 on 1 and 544 DF,  p-value: < 2.2e-16
## 
## -------------------------------------------------------------------------------- 
##   GLM using Family [1] "poisson" : 
## 
## Call:
## glm(formula = y.var ~ x.var, family = family)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2821.7  -1166.4   -112.2    651.9   2053.0  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) 1.414e+01  4.075e-05  346928   <2e-16 ***
## x.var       6.697e-03  9.509e-08   70433   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 1)
## 
##     Null deviance: 7419718377  on 545  degrees of freedom
## Residual deviance:  875882190  on 544  degrees of freedom
## AIC: 875891199
## 
## Number of Fisher Scoring iterations: 5
## 
## -------------------------------------------------------------------------------- 
##   GLM using Family Family: Gamma Link function: log  : 
## 
## Call:
## glm(formula = y.var ~ x.var, family = family)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -4.8286  -0.6150   0.2612   0.3732   0.6383  
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1.264e+01  4.751e-02  265.94   <2e-16 ***
## x.var       1.106e-02  1.505e-04   73.51   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.3072904)
## 
##     Null deviance: 1989.1  on 545  degrees of freedom
## Residual deviance: 1101.4  on 544  degrees of freedom
## AIC: 18108
## 
## Number of Fisher Scoring iterations: 17
## 
## --------------------------------------------------------------------------------

## INDIA  --  31216337 
## ===============================   running models...=============================== 
##   Linear Regression (lm): 
## 
## Call:
## lm(formula = y.var ~ x.var)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -5375050 -2553630 -1322091  2657408  7991868 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -6093658     329481  -18.50   <2e-16 ***
## x.var          54337       1044   52.06   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3844000 on 544 degrees of freedom
## Multiple R-squared:  0.8328, Adjusted R-squared:  0.8325 
## F-statistic:  2710 on 1 and 544 DF,  p-value: < 2.2e-16
## 
## -------------------------------------------------------------------------------- 
##   Linear Regression (lm): 
## 
## Call:
## lm(formula = y.var ~ x.var)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6.9626 -1.5168  0.5826  2.3127  2.9084 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 6.7658180  0.2236107   30.26   <2e-16 ***
## x.var       0.0246034  0.0007084   34.73   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.609 on 544 degrees of freedom
## Multiple R-squared:  0.6892, Adjusted R-squared:  0.6886 
## F-statistic:  1206 on 1 and 544 DF,  p-value: < 2.2e-16
## 
## -------------------------------------------------------------------------------- 
##   GLM using Family [1] "poisson" : 
## 
## Call:
## glm(formula = y.var ~ x.var, family = family)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1390.6  -1103.7   -379.6    518.7   1405.9  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) 1.314e+01  5.845e-05  224814   <2e-16 ***
## x.var       7.912e-03  1.325e-07   59720   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 1)
## 
##     Null deviance: 5632832606  on 545  degrees of freedom
## Residual deviance:  512291033  on 544  degrees of freedom
## AIC: 512299385
## 
## Number of Fisher Scoring iterations: 5
## 
## --------------------------------------------------------------------------------

Growth Rate

growth.rate(tsc,geo.loc='US')
## Processing...  US

## $Changes
##   geo.loc 2020-01-23 2020-01-24 2020-01-25 2020-01-26 2020-01-27 2020-01-28
## 1      US          0          1          0          3          0          0
##   2020-01-29 2020-01-30 2020-01-31 2020-02-01 2020-02-02 2020-02-03 2020-02-04
## 1          1          0          2          0          0          3          0
##   2020-02-05 2020-02-06 2020-02-07 2020-02-08 2020-02-09 2020-02-10 2020-02-11
## 1          0          1          0          0          0          0          1
##   2020-02-12 2020-02-13 2020-02-14 2020-02-15 2020-02-16 2020-02-17 2020-02-18
## 1          0          1          0          0          0          0          0
##   2020-02-19 2020-02-20 2020-02-21 2020-02-22 2020-02-23 2020-02-24 2020-02-25
## 1          0          0          2          0          0          0          0
##   2020-02-26 2020-02-27 2020-02-28 2020-02-29 2020-03-01 2020-03-02 2020-03-03
## 1          0          1          0          8          7         23         19
##   2020-03-04 2020-03-05 2020-03-06 2020-03-07 2020-03-08 2020-03-09 2020-03-10
## 1         33         77         53        166        116         75        188
##   2020-03-11 2020-03-12 2020-03-13 2020-03-14 2020-03-15 2020-03-16 2020-03-17
## 1        365        439        633        759        234       1467       1833
##   2020-03-18 2020-03-19 2020-03-20 2020-03-21 2020-03-22 2020-03-23 2020-03-24
## 1       2657       4494       6367       5995       8873      11238      10619
##   2020-03-25 2020-03-26 2020-03-27 2020-03-28 2020-03-29 2020-03-30 2020-03-31
## 1      12082      17856      18690      19630      18899      22075      26314
##   2020-04-01 2020-04-02 2020-04-03 2020-04-04 2020-04-05 2020-04-06 2020-04-07
## 1      32286      32222      32307      32386      29895      31390      30779
##   2020-04-08 2020-04-09 2020-04-10 2020-04-11 2020-04-12 2020-04-13 2020-04-14
## 1      31235      35942      34403      29083      27256      26939      28818
##   2020-04-15 2020-04-16 2020-04-17 2020-04-18 2020-04-19 2020-04-20 2020-04-21
## 1      25408      30002      33066      27907      26062      29820      25926
##   2020-04-22 2020-04-23 2020-04-24 2020-04-25 2020-04-26 2020-04-27 2020-04-28
## 1      28911      33612      32327      30380      26488      23715      24575
##   2020-04-29 2020-04-30 2020-05-01 2020-05-02 2020-05-03 2020-05-04 2020-05-05
## 1      26459      29205      34907      27348      24321      24068      24528
##   2020-05-06 2020-05-07 2020-05-08 2020-05-09 2020-05-10 2020-05-11 2020-05-12
## 1      24569      27429      26830      25176      18805      19298      22927
##   2020-05-13 2020-05-14 2020-05-15 2020-05-16 2020-05-17 2020-05-18 2020-05-19
## 1      20433      26817      24733      24135      18388      22389      20979
##   2020-05-20 2020-05-21 2020-05-22 2020-05-23 2020-05-24 2020-05-25 2020-05-26
## 1      22725      25769      23649      21099      20077      18662      19663
##   2020-05-27 2020-05-28 2020-05-29 2020-05-30 2020-05-31 2020-06-01 2020-06-02
## 1      18551      22320      24478      23632      18983      17414      21502
##   2020-06-03 2020-06-04 2020-06-05 2020-06-06 2020-06-07 2020-06-08 2020-06-09
## 1      19857      21658      25403      21142      17928      17616      18383
##   2020-06-10 2020-06-11 2020-06-12 2020-06-13 2020-06-14 2020-06-15 2020-06-16
## 1      21111      23166      24828      25212      18941      19827      23667
##   2020-06-17 2020-06-18 2020-06-19 2020-06-20 2020-06-21 2020-06-22 2020-06-23
## 1      27072      28537      31544      32280      25150      32144      37072
##   2020-06-24 2020-06-25 2020-06-26 2020-06-27 2020-06-28 2020-06-29 2020-06-30
## 1      35878      40326      45999      41330      40734      41299      46420
##   2020-07-01 2020-07-02 2020-07-03 2020-07-04 2020-07-05 2020-07-06 2020-07-07
## 1      51820      56636      51351      45693      50747      43106      60661
##   2020-07-08 2020-07-09 2020-07-10 2020-07-11 2020-07-12 2020-07-13 2020-07-14
## 1      60119      62509      68057      60017      58424      58930      68051
##   2020-07-15 2020-07-16 2020-07-17 2020-07-18 2020-07-19 2020-07-20 2020-07-21
## 1      68090      75866      72236      62536      60456      62107      64461
##   2020-07-22 2020-07-23 2020-07-24 2020-07-25 2020-07-26 2020-07-27 2020-07-28
## 1      70579      68445      73319      64953      54816      56783      66412
##   2020-07-29 2020-07-30 2020-07-31 2020-08-01 2020-08-02 2020-08-03 2020-08-04
## 1      71873      67466      68712      56201      45568      45501      58774
##   2020-08-05 2020-08-06 2020-08-07 2020-08-08 2020-08-09 2020-08-10 2020-08-11
## 1      54466      59349      59303      54134      45769      47606      48003
##   2020-08-12 2020-08-13 2020-08-14 2020-08-15 2020-08-16 2020-08-17 2020-08-18
## 1      56040      51316      65336      46951      39212      36652      45033
##   2020-08-19 2020-08-20 2020-08-21 2020-08-22 2020-08-23 2020-08-24 2020-08-25
## 1      47320      44041      48843      43064      34247      36482      40354
##   2020-08-26 2020-08-27 2020-08-28 2020-08-29 2020-08-30 2020-08-31 2020-09-01
## 1      45172      45393      46832      42754      34404      35362      41846
##   2020-09-02 2020-09-03 2020-09-04 2020-09-05 2020-09-06 2020-09-07 2020-09-08
## 1      41018      44251      50382      43158      31218      23613      27226
##   2020-09-09 2020-09-10 2020-09-11 2020-09-12 2020-09-13 2020-09-14 2020-09-15
## 1      34049      36056      47769      41101      34372      34423      39492
##   2020-09-16 2020-09-17 2020-09-18 2020-09-19 2020-09-20 2020-09-21 2020-09-22
## 1      39030      45130      49282      42202      38447      51878      39866
##   2020-09-23 2020-09-24 2020-09-25 2020-09-26 2020-09-27 2020-09-28 2020-09-29
## 1      39069      47103      48295      44673      37528      33294      43338
##   2020-09-30 2020-10-01 2020-10-02 2020-10-03 2020-10-04 2020-10-05 2020-10-06
## 1      39443      45650      54950      48577      35738      39376      45289
##   2020-10-07 2020-10-08 2020-10-09 2020-10-10 2020-10-11 2020-10-12 2020-10-13
## 1      51056      58599      56384      54953      45981      41774      52231
##   2020-10-14 2020-10-15 2020-10-16 2020-10-17 2020-10-18 2020-10-19 2020-10-20
## 1      59778      64880      69147      56759      49367      67717      61956
##   2020-10-21 2020-10-22 2020-10-23 2020-10-24 2020-10-25 2020-10-26 2020-10-27
## 1      63301      76310      81933      82767      62204      67310      76838
##   2020-10-28 2020-10-29 2020-10-30 2020-10-31 2020-11-01 2020-11-02 2020-11-03
## 1      79426      91019      99264      89754     104900      85211     127198
##   2020-11-04 2020-11-05 2020-11-06 2020-11-07 2020-11-08 2020-11-09 2020-11-10
## 1     104541     129367     128033     127510     115170     120434     140504
##   2020-11-11 2020-11-12 2020-11-13 2020-11-14 2020-11-15 2020-11-16 2020-11-17
## 1     146750     164750     180398     167926     136356     162624     163958
##   2020-11-18 2020-11-19 2020-11-20 2020-11-21 2020-11-22 2020-11-23 2020-11-24
## 1     173251     191510     198333     179436     146947     174089     175544
##   2020-11-25 2020-11-26 2020-11-27 2020-11-28 2020-11-29 2020-11-30 2020-12-01
## 1     183403     112526     207933     155661     140328     160321     188339
##   2020-12-02 2020-12-03 2020-12-04 2020-12-05 2020-12-06 2020-12-07 2020-12-08
## 1     202894     223421     232644     215811     181253     194409     224452
##   2020-12-09 2020-12-10 2020-12-11 2020-12-12 2020-12-13 2020-12-14 2020-12-15
## 1     222648     231428     240089     217797     187971     194314     208992
##   2020-12-16 2020-12-17 2020-12-18 2020-12-19 2020-12-20 2020-12-21 2020-12-22
## 1     246644     239900     251832     192102     188015     198703     198107
##   2020-12-23 2020-12-24 2020-12-25 2020-12-26 2020-12-27 2020-12-28 2020-12-29
## 1     229624     194155      97880     226416     155845     174152     200408
##   2020-12-30 2020-12-31 2021-01-01 2021-01-02 2021-01-03 2021-01-04 2021-01-05
## 1     233701     235600     153916     300462     208853     184005     235042
##   2021-01-06 2021-01-07 2021-01-08 2021-01-09 2021-01-10 2021-01-11 2021-01-12
## 1     255637     278337     295257     260967     213415     214664     226967
##   2021-01-13 2021-01-14 2021-01-15 2021-01-16 2021-01-17 2021-01-18 2021-01-19
## 1     230301     235766     242780     201858     177931     143598     176216
##   2021-01-20 2021-01-21 2021-01-22 2021-01-23 2021-01-24 2021-01-25 2021-01-26
## 1     183261     193856     190760     170759     131198     151677     147626
##   2021-01-27 2021-01-28 2021-01-29 2021-01-30 2021-01-31 2021-02-01 2021-02-02
## 1     153961     168804     166613     142459     112152     134975     115303
##   2021-02-03 2021-02-04 2021-02-05 2021-02-06 2021-02-07 2021-02-08 2021-02-09
## 1     121691     124006     134422     104176      89746      90438      95265
##   2021-02-10 2021-02-11 2021-02-12 2021-02-13 2021-02-14 2021-02-15 2021-02-16
## 1      95250     105764      99670      87219      65135      54279      62498
##   2021-02-17 2021-02-18 2021-02-19 2021-02-20 2021-02-21 2021-02-22 2021-02-23
## 1      70139      69911      79282      71696      57152      56159      72270
##   2021-02-24 2021-02-25 2021-02-26 2021-02-27 2021-02-28 2021-03-01 2021-03-02
## 1      74749      77504      77349      64626      51422      58098      57098
##   2021-03-03 2021-03-04 2021-03-05 2021-03-06 2021-03-07 2021-03-08 2021-03-09
## 1      67191      68060      66419      58254      41073      44917      57667
##   2021-03-10 2021-03-11 2021-03-12 2021-03-13 2021-03-14 2021-03-15 2021-03-16
## 1      57895      62471      61513      53031      38278      56541      54008
##   2021-03-17 2021-03-18 2021-03-19 2021-03-20 2021-03-21 2021-03-22 2021-03-23
## 1      59280      60375      61651      55519      33822      51436      53688
##   2021-03-24 2021-03-25 2021-03-26 2021-03-27 2021-03-28 2021-03-29 2021-03-30
## 1      86938      67546      77377      62842      43223      69273      61429
##   2021-03-31 2021-04-01 2021-04-02 2021-04-03 2021-04-04 2021-04-05 2021-04-06
## 1      66765      79119      69887      63261      35133      77404      60674
##   2021-04-07 2021-04-08 2021-04-09 2021-04-10 2021-04-11 2021-04-12 2021-04-13
## 1      75021      79894      82710      66687      46509      70075      77966
##   2021-04-14 2021-04-15 2021-04-16 2021-04-17 2021-04-18 2021-04-19 2021-04-20
## 1      75403      74308      80071      52532      42121      68105      60949
##   2021-04-21 2021-04-22 2021-04-23 2021-04-24 2021-04-25 2021-04-26 2021-04-27
## 1      62855      67278      62411      53495      32153      47568      50836
##   2021-04-28 2021-04-29 2021-04-30 2021-05-01 2021-05-02 2021-05-03 2021-05-04
## 1      55150      58251      57919      45391      29403      50491      40723
##   2021-05-05 2021-05-06 2021-05-07 2021-05-08 2021-05-09 2021-05-10 2021-05-11
## 1      44704      47557      48130      33675      21427      36798      33662
##   2021-05-12 2021-05-13 2021-05-14 2021-05-15 2021-05-16 2021-05-17 2021-05-18
## 1      35826      38076      42260      28857      16875      28621      27789
##   2021-05-19 2021-05-20 2021-05-21 2021-05-22 2021-05-23 2021-05-24 2021-05-25
## 1      29301      30206      27946      19798      12868      25815      22739
##   2021-05-26 2021-05-27 2021-05-28 2021-05-29 2021-05-30 2021-05-31 2021-06-01
## 1      23976      27448      21859      12001       6734       5775      22940
##   2021-06-02 2021-06-03 2021-06-04 2021-06-05 2021-06-06 2021-06-07 2021-06-08
## 1      16917      19080      16850      13906       5395      15496      13013
##   2021-06-09 2021-06-10 2021-06-11 2021-06-12 2021-06-13 2021-06-14 2021-06-15
## 1      18647      14545      24699       8228       4777      12730      11305
##   2021-06-16 2021-06-17 2021-06-18 2021-06-19 2021-06-20 2021-06-21 2021-06-22
## 1      12425      10393      20591       8520       3892      12334      10940
##   2021-06-23 2021-06-24 2021-06-25 2021-06-26 2021-06-27 2021-06-28 2021-06-29
## 1      12436      12830      23715       7303       3920      15083      11350
##   2021-06-30 2021-07-01 2021-07-02 2021-07-03 2021-07-04 2021-07-05 2021-07-06
## 1      13118      14463      29892       4739       3697       5528      24224
##   2021-07-07 2021-07-08 2021-07-09 2021-07-10 2021-07-11 2021-07-12 2021-07-13
## 1      22931      20061      48241       9038       6164      35013      26424
##   2021-07-14 2021-07-15 2021-07-16 2021-07-17 2021-07-18 2021-07-19 2021-07-20
## 1      31845      28412      79310      12960      12048      52111      42703
## 
## $Growth.Rate
##   geo.loc 2020-01-24 2020-01-25 2020-01-26 2020-01-27 2020-01-28 2020-01-29
## 1      US         NA          0         NA          0        NaN         NA
##   2020-01-30 2020-01-31 2020-02-01 2020-02-02 2020-02-03 2020-02-04 2020-02-05
## 1          0         NA          0        NaN         NA          0        NaN
##   2020-02-06 2020-02-07 2020-02-08 2020-02-09 2020-02-10 2020-02-11 2020-02-12
## 1         NA          0        NaN        NaN        NaN         NA          0
##   2020-02-13 2020-02-14 2020-02-15 2020-02-16 2020-02-17 2020-02-18 2020-02-19
## 1         NA          0        NaN        NaN        NaN        NaN        NaN
##   2020-02-20 2020-02-21 2020-02-22 2020-02-23 2020-02-24 2020-02-25 2020-02-26
## 1        NaN         NA          0        NaN        NaN        NaN        NaN
##   2020-02-27 2020-02-28 2020-02-29 2020-03-01 2020-03-02 2020-03-03 2020-03-04
## 1         NA          0         NA      0.875   3.285714   0.826087   1.736842
##   2020-03-05 2020-03-06 2020-03-07 2020-03-08 2020-03-09 2020-03-10 2020-03-11
## 1   2.333333  0.6883117   3.132075  0.6987952  0.6465517   2.506667   1.941489
##   2020-03-12 2020-03-13 2020-03-14 2020-03-15 2020-03-16 2020-03-17 2020-03-18
## 1    1.20274   1.441913   1.199052  0.3083004   6.269231   1.249489   1.449536
##   2020-03-19 2020-03-20 2020-03-21 2020-03-22 2020-03-23 2020-03-24 2020-03-25
## 1   1.691381   1.416778  0.9415737   1.480067   1.266539   0.944919   1.137772
##   2020-03-26 2020-03-27 2020-03-28 2020-03-29 2020-03-30 2020-03-31 2020-04-01
## 1   1.477901   1.046707   1.050294  0.9627611   1.168051   1.192027   1.226951
##   2020-04-02 2020-04-03 2020-04-04 2020-04-05 2020-04-06 2020-04-07 2020-04-08
## 1  0.9980177   1.002638   1.002445   0.923084   1.050008  0.9805352   1.014815
##   2020-04-09 2020-04-10 2020-04-11 2020-04-12 2020-04-13 2020-04-14 2020-04-15
## 1   1.150696   0.957181  0.8453623  0.9371798  0.9883695    1.06975  0.8816712
##   2020-04-16 2020-04-17 2020-04-18 2020-04-19 2020-04-20 2020-04-21 2020-04-22
## 1   1.180809   1.102127  0.8439787  0.9338876   1.144195  0.8694165   1.115135
##   2020-04-23 2020-04-24 2020-04-25 2020-04-26 2020-04-27 2020-04-28 2020-04-29
## 1   1.162602  0.9617696  0.9397717  0.8718894  0.8953111   1.036264   1.076663
##   2020-04-30 2020-05-01 2020-05-02 2020-05-03 2020-05-04 2020-05-05 2020-05-06
## 1   1.103783   1.195241  0.7834532  0.8893155  0.9895975   1.019113   1.001672
##   2020-05-07 2020-05-08 2020-05-09 2020-05-10 2020-05-11 2020-05-12 2020-05-13
## 1   1.116407  0.9781618  0.9383526  0.7469415   1.026216   1.188051    0.89122
##   2020-05-14 2020-05-15 2020-05-16 2020-05-17 2020-05-18 2020-05-19 2020-05-20
## 1   1.312436  0.9222881  0.9758218  0.7618811   1.217588  0.9370226   1.083226
##   2020-05-21 2020-05-22 2020-05-23 2020-05-24 2020-05-25 2020-05-26 2020-05-27
## 1   1.133949  0.9177306   0.892173  0.9515617  0.9295213   1.053638  0.9434471
##   2020-05-28 2020-05-29 2020-05-30 2020-05-31 2020-06-01 2020-06-02 2020-06-03
## 1    1.20317   1.096685  0.9654384  0.8032752  0.9173471   1.234754  0.9234955
##   2020-06-04 2020-06-05 2020-06-06 2020-06-07 2020-06-08 2020-06-09 2020-06-10
## 1   1.090698   1.172915  0.8322639  0.8479803  0.9825971    1.04354   1.148398
##   2020-06-11 2020-06-12 2020-06-13 2020-06-14 2020-06-15 2020-06-16 2020-06-17
## 1   1.097343   1.071743   1.015466  0.7512692   1.046777   1.193675   1.143871
##   2020-06-18 2020-06-19 2020-06-20 2020-06-21 2020-06-22 2020-06-23 2020-06-24
## 1   1.054115   1.105372   1.023332  0.7791202   1.278091    1.15331  0.9677924
##   2020-06-25 2020-06-26 2020-06-27 2020-06-28 2020-06-29 2020-06-30 2020-07-01
## 1   1.123976   1.140678  0.8984978  0.9855795    1.01387   1.123998   1.116329
##   2020-07-02 2020-07-03 2020-07-04 2020-07-05 2020-07-06 2020-07-07 2020-07-08
## 1   1.092937  0.9066848  0.8898171   1.110608  0.8494295   1.407252  0.9910651
##   2020-07-09 2020-07-10 2020-07-11 2020-07-12 2020-07-13 2020-07-14 2020-07-15
## 1   1.039754   1.088755  0.8818637  0.9734575   1.008661   1.154777   1.000573
##   2020-07-16 2020-07-17 2020-07-18 2020-07-19 2020-07-20 2020-07-21 2020-07-22
## 1   1.114202  0.9521525  0.8657179  0.9667392   1.027309   1.037902    1.09491
##   2020-07-23 2020-07-24 2020-07-25 2020-07-26 2020-07-27 2020-07-28 2020-07-29
## 1  0.9697644    1.07121  0.8858959  0.8439333   1.035884   1.169575   1.082229
##   2020-07-30 2020-07-31 2020-08-01 2020-08-02 2020-08-03 2020-08-04 2020-08-05
## 1  0.9386835   1.018469  0.8179212  0.8108041  0.9985297   1.291708  0.9267023
##   2020-08-06 2020-08-07 2020-08-08 2020-08-09 2020-08-10 2020-08-11 2020-08-12
## 1   1.089652  0.9992249  0.9128375   0.845476   1.040136   1.008339   1.167427
##   2020-08-13 2020-08-14 2020-08-15 2020-08-16 2020-08-17 2020-08-18 2020-08-19
## 1  0.9157031   1.273209  0.7186084  0.8351686  0.9347139   1.228664   1.050785
##   2020-08-20 2020-08-21 2020-08-22 2020-08-23 2020-08-24 2020-08-25 2020-08-26
## 1  0.9307058   1.109035  0.8816821  0.7952582   1.065261   1.106135   1.119393
##   2020-08-27 2020-08-28 2020-08-29 2020-08-30 2020-08-31 2020-09-01 2020-09-02
## 1   1.004892   1.031701  0.9129228  0.8046966   1.027846   1.183361  0.9802132
##   2020-09-03 2020-09-04 2020-09-05 2020-09-06 2020-09-07 2020-09-08 2020-09-09
## 1   1.078819   1.138551  0.8566155  0.7233421  0.7563905   1.153009   1.250606
##   2020-09-10 2020-09-11 2020-09-12 2020-09-13 2020-09-14 2020-09-15 2020-09-16
## 1   1.058944   1.324856  0.8604116  0.8362814   1.001484   1.147256  0.9883014
##   2020-09-17 2020-09-18 2020-09-19 2020-09-20 2020-09-21 2020-09-22 2020-09-23
## 1    1.15629   1.092001   0.856337  0.9110232   1.349338  0.7684568   0.980008
##   2020-09-24 2020-09-25 2020-09-26 2020-09-27 2020-09-28 2020-09-29 2020-09-30
## 1   1.205636   1.025306  0.9250026    0.84006  0.8871776   1.301676  0.9101251
##   2020-10-01 2020-10-02 2020-10-03 2020-10-04 2020-10-05 2020-10-06 2020-10-07
## 1   1.157366   1.203724  0.8840218   0.735698   1.101796   1.150168   1.127338
##   2020-10-08 2020-10-09 2020-10-10 2020-10-11 2020-10-12 2020-10-13 2020-10-14
## 1    1.14774  0.9622007  0.9746205  0.8367332  0.9085057   1.250323   1.144493
##   2020-10-15 2020-10-16 2020-10-17 2020-10-18 2020-10-19 2020-10-20 2020-10-21
## 1   1.085349   1.065768  0.8208454  0.8697651   1.371706  0.9149254   1.021709
##   2020-10-22 2020-10-23 2020-10-24 2020-10-25 2020-10-26 2020-10-27 2020-10-28
## 1    1.20551   1.073686   1.010179  0.7515556   1.082085   1.141554   1.033681
##   2020-10-29 2020-10-30 2020-10-31 2020-11-01 2020-11-02 2020-11-03 2020-11-04
## 1    1.14596   1.090585  0.9041949    1.16875   0.812307   1.492742  0.8218761
##   2020-11-05 2020-11-06 2020-11-07 2020-11-08 2020-11-09 2020-11-10 2020-11-11
## 1   1.237476  0.9896883  0.9959151  0.9032233   1.045706   1.166647   1.044454
##   2020-11-12 2020-11-13 2020-11-14 2020-11-15 2020-11-16 2020-11-17 2020-11-18
## 1   1.122658    1.09498   0.930864  0.8120005   1.192643   1.008203   1.056679
##   2020-11-19 2020-11-20 2020-11-21 2020-11-22 2020-11-23 2020-11-24 2020-11-25
## 1    1.10539   1.035627  0.9047208  0.8189382   1.184706   1.008358   1.044769
##   2020-11-26 2020-11-27 2020-11-28 2020-11-29 2020-11-30 2020-12-01 2020-12-02
## 1   0.613545   1.847866  0.7486113  0.9014975   1.142473   1.174762   1.077281
##   2020-12-03 2020-12-04 2020-12-05 2020-12-06 2020-12-07 2020-12-08 2020-12-09
## 1   1.101171   1.041281  0.9276448  0.8398691   1.072584   1.154535  0.9919626
##   2020-12-10 2020-12-11 2020-12-12 2020-12-13 2020-12-14 2020-12-15 2020-12-16
## 1   1.039434   1.037424  0.9071511   0.863056   1.033745   1.075538    1.18016
##   2020-12-17 2020-12-18 2020-12-19 2020-12-20 2020-12-21 2020-12-22 2020-12-23
## 1  0.9726569   1.049737  0.7628181  0.9787248   1.056847  0.9970005   1.159091
##   2020-12-24 2020-12-25 2020-12-26 2020-12-27 2020-12-28 2020-12-29 2020-12-30
## 1  0.8455344  0.5041333     2.3132  0.6883127   1.117469   1.150765   1.166126
##   2020-12-31 2021-01-01 2021-01-02 2021-01-03 2021-01-04 2021-01-05 2021-01-06
## 1   1.008126  0.6532937   1.952117  0.6951062  0.8810264   1.277367   1.087623
##   2021-01-07 2021-01-08 2021-01-09 2021-01-10 2021-01-11 2021-01-12 2021-01-13
## 1   1.088798    1.06079  0.8838639  0.8177854   1.005852   1.057313   1.014689
##   2021-01-14 2021-01-15 2021-01-16 2021-01-17 2021-01-18 2021-01-19 2021-01-20
## 1    1.02373    1.02975  0.8314441  0.8814662  0.8070432   1.227148   1.039979
##   2021-01-21 2021-01-22 2021-01-23 2021-01-24 2021-01-25 2021-01-26 2021-01-27
## 1   1.057814  0.9840294   0.895151  0.7683226   1.156092  0.9732919   1.042912
##   2021-01-28 2021-01-29 2021-01-30 2021-01-31 2021-02-01 2021-02-02 2021-02-03
## 1   1.096408  0.9870204  0.8550293  0.7872581   1.203501  0.8542545   1.055402
##   2021-02-04 2021-02-05 2021-02-06 2021-02-07 2021-02-08 2021-02-09 2021-02-10
## 1   1.019024   1.083996  0.7749922  0.8614844   1.007711   1.053374  0.9998425
##   2021-02-11 2021-02-12 2021-02-13 2021-02-14 2021-02-15 2021-02-16 2021-02-17
## 1   1.110383  0.9423812  0.8750778  0.7467983  0.8333308   1.151421    1.12226
##   2021-02-18 2021-02-19 2021-02-20 2021-02-21 2021-02-22 2021-02-23 2021-02-24
## 1  0.9967493   1.134042  0.9043162  0.7971435  0.9826253   1.286882   1.034302
##   2021-02-25 2021-02-26 2021-02-27 2021-02-28 2021-03-01 2021-03-02 2021-03-03
## 1   1.036857  0.9980001  0.8355118  0.7956859   1.129828  0.9827877   1.176766
##   2021-03-04 2021-03-05 2021-03-06 2021-03-07 2021-03-08 2021-03-09 2021-03-10
## 1   1.012933  0.9758889  0.8770683  0.7050675   1.093589   1.283857   1.003954
##   2021-03-11 2021-03-12 2021-03-13 2021-03-14 2021-03-15 2021-03-16 2021-03-17
## 1    1.07904  0.9846649  0.8621104  0.7218042   1.477115  0.9552007   1.097615
##   2021-03-18 2021-03-19 2021-03-20 2021-03-21 2021-03-22 2021-03-23 2021-03-24
## 1   1.018472   1.021135  0.9005369  0.6091969   1.520785   1.043783   1.619319
##   2021-03-25 2021-03-26 2021-03-27 2021-03-28 2021-03-29 2021-03-30 2021-03-31
## 1  0.7769445   1.145545  0.8121535  0.6878043   1.602688  0.8867668   1.086865
##   2021-04-01 2021-04-02 2021-04-03 2021-04-04 2021-04-05 2021-04-06 2021-04-07
## 1   1.185037   0.883315  0.9051898  0.5553659   2.203171  0.7838613    1.23646
##   2021-04-08 2021-04-09 2021-04-10 2021-04-11 2021-04-12 2021-04-13 2021-04-14
## 1   1.064955   1.035247  0.8062749  0.6974223   1.506698   1.112608  0.9671267
##   2021-04-15 2021-04-16 2021-04-17 2021-04-18 2021-04-19 2021-04-20 2021-04-21
## 1   0.985478   1.077556  0.6560677   0.801816   1.616889   0.894927   1.031272
##   2021-04-22 2021-04-23 2021-04-24 2021-04-25 2021-04-26 2021-04-27 2021-04-28
## 1   1.070368  0.9276584  0.8571406  0.6010468   1.479426   1.068702   1.084861
##   2021-04-29 2021-04-30 2021-05-01 2021-05-02 2021-05-03 2021-05-04 2021-05-05
## 1   1.056228  0.9943005  0.7836979  0.6477716   1.717206  0.8065398   1.097758
##   2021-05-06 2021-05-07 2021-05-08 2021-05-09 2021-05-10 2021-05-11 2021-05-12
## 1    1.06382   1.012049  0.6996676   0.636288   1.717366   0.914778   1.064286
##   2021-05-13 2021-05-14 2021-05-15 2021-05-16 2021-05-17 2021-05-18 2021-05-19
## 1   1.062804   1.109885  0.6828443  0.5847801   1.696059  0.9709304    1.05441
##   2021-05-20 2021-05-21 2021-05-22 2021-05-23 2021-05-24 2021-05-25 2021-05-26
## 1   1.030886  0.9251804  0.7084377  0.6499646   2.006139  0.8808445     1.0544
##   2021-05-27 2021-05-28 2021-05-29 2021-05-30 2021-05-31 2021-06-01 2021-06-02
## 1   1.144811  0.7963786  0.5490187  0.5611199  0.8575884   3.972294  0.7374455
##   2021-06-03 2021-06-04 2021-06-05 2021-06-06 2021-06-07 2021-06-08 2021-06-09
## 1    1.12786  0.8831237  0.8252819   0.387962   2.872289  0.8397651   1.432952
##   2021-06-10 2021-06-11 2021-06-12 2021-06-13 2021-06-14 2021-06-15 2021-06-16
## 1  0.7800182   1.698109  0.3331309  0.5805785   2.664852  0.8880597   1.099071
##   2021-06-17 2021-06-18 2021-06-19 2021-06-20 2021-06-21 2021-06-22 2021-06-23
## 1  0.8364588   1.981237   0.413773  0.4568075   3.169065  0.8869791   1.136746
##   2021-06-24 2021-06-25 2021-06-26 2021-06-27 2021-06-28 2021-06-29 2021-06-30
## 1   1.031682   1.848402  0.3079486  0.5367657   3.847704  0.7525028   1.155771
##   2021-07-01 2021-07-02 2021-07-03 2021-07-04 2021-07-05 2021-07-06 2021-07-07
## 1   1.102531   2.066791  0.1585374  0.7801224   1.495266   4.382055  0.9466232
##   2021-07-08 2021-07-09 2021-07-10 2021-07-11 2021-07-12 2021-07-13 2021-07-14
## 1  0.8748419   2.404716   0.187351  0.6820093    5.68024  0.7546911   1.205154
##   2021-07-15 2021-07-16 2021-07-17 2021-07-18 2021-07-19 2021-07-20 NA
## 1  0.8921966   2.791426  0.1634094  0.9296296   4.325282  0.8194623 NA

Totals Plot

totals.plt(tsa)

World Map

live.map(tsa)

In a SIR Model, we assume the population consists of three types of individuals, whose numbers are denoted by the letters Susceptibles,Infected and Recovered. They are all functions of time and change according to a system of differential equations.

\(\gamma\) represents recovery rate.

\(\beta\) represents contact rate.

SIR US Model

tsc <- covid19.data(case = 'ts-confirmed')
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
## --------------------------------------------------------------------------------
#US Population is 328.2 mill
generate.SIR.model(tsc, 'US', tot.population=328200000)
## ################################################################################ 
## ################################################################################ 
## Processing...  US 
##   [1]        1        1        2        2        5        5        5        6
##   [9]        6        8        8        8       11       11       11       12
##  [17]       12       12       12       12       13       13       14       14
##  [25]       14       14       14       14       14       14       16       16
##  [33]       16       16       16       16       17       17       25       32
##  [41]       55       74      107      184      237      403      519      594
##  [49]      782     1147     1586     2219     2978     3212     4679     6512
##  [57]     9169    13663    20030    26025    34898    46136    56755    68837
##  [65]    86693   105383   125013   143912   165987   192301   224587   256809
##  [73]   289116   321502   351397   382787   413566   444801   480743   515146
##  [81]   544229   571485   598424   627242   652650   682652   715718   743625
##  [89]   769687   799507   825433   854344   887956   920283   950663   977151
##  [97]  1000866  1025441  1051900  1081105  1116012  1143360  1167681  1191749
## [105]  1216277  1240846  1268275  1295105  1320281  1339086  1358384  1381311
## [113]  1401744  1428561  1453294  1477429  1495817  1518206  1539185  1561910
## [121]  1587679  1611328  1632427  1652504  1671166  1690829  1709380  1731700
## [129]  1756178  1779810  1798793  1816207  1837709  1857566  1879224  1904627
## [137]  1925769  1943697  1961313  1979696  2000807  2023973  2048801  2074013
## [145]  2092954  2112781  2136448  2163520  2192057  2223601  2255881  2281031
## [153]  2313175  2350247  2386125  2426451  2472450  2513780  2554514  2595813
## [161]  2642233  2694053  2750689  2802040  2847733  2898480  2941586  3002247
## [169]  3062366  3124875  3192932  3252949  3311373  3370303  3438354  3506444
## [177]  3582310  3654546  3717082  3777538  3839645  3904106  3974685  4043130
## [185]  4116449  4181402  4236218  4293001  4359413  4431286  4498752  4567464
## [193]  4623665  4669233  4714734  4773508  4827974  4887323  4946626  5000760
## [201]  5046529  5094135  5142138  5198178  5249494  5314830  5361781  5400993
## [209]  5437645  5482678  5529998  5574039  5622882  5665946  5700193  5736675
## [217]  5777029  5822201  5867594  5914426  5957180  5991584  6026946  6068792
## [225]  6109810  6154061  6204443  6247601  6278819  6302432  6329658  6363707
## [233]  6399763  6447532  6488633  6523005  6557428  6596920  6635950  6681080
## [241]  6730362  6772564  6811011  6862889  6902755  6941824  6988927  7037222
## [249]  7081895  7119423  7152717  7196055  7235498  7281148  7336098  7384675
## [257]  7420413  7459789  7505078  7556134  7614733  7671117  7726070  7772051
## [265]  7813825  7866056  7925834  7990714  8059861  8116620  8165987  8233704
## [273]  8295660  8358961  8435271  8517204  8599971  8662175  8729485  8806323
## [281]  8885749  8976768  9076032  9165786  9270686  9355897  9483095  9587636
## [289]  9717003  9845036  9972546 10087716 10208150 10348654 10495404 10660154
## [297] 10840552 11008478 11144834 11307458 11471416 11644667 11836177 12034510
## [305] 12213946 12360893 12534982 12710526 12893929 13006455 13214388 13370049
## [313] 13510377 13670698 13859037 14061931 14285352 14517996 14733807 14915060
## [321] 15109469 15333921 15556569 15787997 16028086 16245883 16433854 16628168
## [329] 16837160 17083804 17323704 17575536 17767638 17955653 18154356 18352463
## [337] 18582087 18776242 18874122 19100538 19256383 19430535 19630943 19864644
## [345] 20100244 20254160 20554622 20763475 20947480 21182522 21438159 21716496
## [353] 22011753 22272720 22486135 22700799 22927766 23158067 23393833 23636613
## [361] 23838471 24016402 24160000 24336216 24519477 24713333 24904093 25074852
## [369] 25206050 25357727 25505353 25659314 25828118 25994731 26137190 26249342
## [377] 26384317 26499620 26621311 26745317 26879739 26983915 27073661 27164099
## [385] 27259364 27354614 27460378 27560048 27647267 27712402 27766681 27829179
## [393] 27899318 27969229 28048511 28120207 28177359 28233518 28305788 28380537
## [401] 28458041 28535390 28600016 28651438 28709536 28766634 28833825 28901885
## [409] 28968304 29026558 29067631 29112548 29170215 29228110 29290581 29352094
## [417] 29405125 29443403 29499944 29553952 29613232 29673607 29735258 29790777
## [425] 29824599 29876035 29929723 30016661 30084207 30161584 30224426 30267649
## [433] 30336922 30398351 30465116 30544235 30614122 30677383 30712516 30789920
## [441] 30850594 30925615 31005509 31088219 31154906 31201415 31271490 31349456
## [449] 31424859 31499167 31579238 31631770 31673891 31741996 31802945 31865800
## [457] 31933078 31995489 32048984 32081137 32128705 32179541 32234691 32292942
## [465] 32350861 32396252 32425655 32476146 32516869 32561573 32609130 32657260
## [473] 32690935 32712362 32749160 32782822 32818648 32856724 32898984 32927841
## [481] 32944716 32973337 33001126 33030427 33060633 33088579 33108377 33121245
## [489] 33147060 33169799 33193775 33221223 33243082 33255083 33261817 33267592
## [497] 33290532 33307449 33326529 33343379 33357285 33362680 33378176 33391189
## [505] 33409836 33424381 33449080 33457308 33462085 33474815 33486120 33498545
## [513] 33508938 33529529 33538049 33541941 33554275 33565215 33577651 33590481
## [521] 33614196 33621499 33625419 33640502 33651852 33664970 33679433 33709325
## [529] 33714064 33717761 33723289 33747513 33770444 33790505 33838746 33847784
## [537] 33853948 33888961 33915385 33947230 33975642 34054952 34067912 34079960
## [545] 34132071 34174774
## [1] 40
##  [1]    32    55    74   107   184   237   403   519   594   782  1147  1586
## [13]  2219  2978  3212  4679  6512  9169 13663 20030 26025 34898 46136 56755
## [25] 68837 86693
## ------------------------  Parameters used to create model ------------------------ 
##      Region: US 
##      Time interval to consider: t0=40 - t1= ; tfinal=90 
##          t0: 2020-03-02 -- t1:  
##      Number of days considered for initial guess: 26 
##      Fatality rate: 0.02 
##      Population of the region: 328200000 
## -------------------------------------------------------------------------------- 
## [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
##      beta     gamma 
## 0.6601855 0.3398147 
##   R0 = 1.94278096379885 
##   Max nbr of infected: 47008795.32  ( 14.32 %) 
##   Max nbr of casualties, assuming  2% fatality rate: 940175.91 
##   Max reached at day : 51 ==>  2020-04-22 
## ================================================================================

## $Infected
##  [1]    32    55    74   107   184   237   403   519   594   782  1147  1586
## [13]  2219  2978  3212  4679  6512  9169 13663 20030 26025 34898 46136 56755
## [25] 68837 86693
## 
## $model
##    time         S            I            R
## 1     1 328199968 3.200000e+01 0.000000e+00
## 2     2 328199943 4.408443e+01 1.281786e+01
## 3     3 328199909 6.073240e+01 3.047623e+01
## 4     4 328199862 8.366729e+01 5.480310e+01
## 5     5 328199796 1.152633e+02 8.831672e+01
## 6     6 328199707 1.587910e+02 1.344863e+02
## 7     7 328199583 2.187565e+02 1.980914e+02
## 8     8 328199413 3.013672e+02 2.857161e+02
## 9     9 328199178 4.151746e+02 4.064312e+02
## 10   10 328198855 5.719595e+02 5.727327e+02
## 11   11 328198410 7.879515e+02 8.018356e+02
## 12   12 328197797 1.085509e+03 1.117456e+03
## 13   13 328196952 1.495431e+03 1.552264e+03
## 14   14 328195789 2.060149e+03 2.151269e+03
## 15   15 328194185 2.838113e+03 2.976475e+03
## 16   16 328191977 3.909840e+03 4.113297e+03
## 17   17 328188934 5.386246e+03 5.679402e+03
## 18   18 328184743 7.420106e+03 7.836880e+03
## 19   19 328178969 1.022186e+04 1.080901e+04
## 20   20 328171015 1.408133e+04 1.490336e+04
## 21   21 328160059 1.939765e+04 2.054356e+04
## 22   22 328144966 2.672042e+04 2.831309e+04
## 23   23 328124178 3.680629e+04 3.901548e+04
## 24   24 328095546 5.069666e+04 5.375722e+04
## 25   25 328056114 6.982439e+04 7.406168e+04
## 26   26 328001814 9.615999e+04 1.020257e+05
## 27   27 327927054 1.324115e+05 1.405343e+05
## 28   28 327824147 1.822972e+05 1.935557e+05
## 29   29 327682540 2.509161e+05 2.665439e+05
## 30   30 327487763 3.452481e+05 3.669888e+05
## 31   31 327220011 4.748250e+05 5.051641e+05
## 32   32 326852241 6.526204e+05 6.951386e+05
## 33   33 326347656 8.962097e+05 9.561339e+05
## 34   34 325656418 1.229251e+06 1.314332e+06
## 35   35 324711459 1.683303e+06 1.805238e+06
## 36   36 323423339 2.299938e+06 2.476723e+06
## 37   37 321674255 3.132947e+06 3.392799e+06
## 38   38 319311726 4.250172e+06 4.638103e+06
## 39   39 316143157 5.734024e+06 6.322819e+06
## 40   40 311933603 7.679066e+06 8.587331e+06
## 41   41 306410575 1.018421e+07 1.160522e+07
## 42   42 299281276 1.333647e+07 1.558226e+07
## 43   43 290267992 1.718391e+07 2.074810e+07
## 44   44 279164700 2.169836e+07 2.733694e+07
## 45   45 265909706 2.673558e+07 3.555472e+07
## 46   46 250655886 3.200954e+07 4.553457e+07
## 47   47 233807861 3.710296e+07 5.728918e+07
## 48   48 215996458 4.152848e+07 7.067506e+07
## 49   49 197983597 4.483101e+07 8.538539e+07
## 50   50 180525770 4.669453e+07 1.009797e+08
## 51   51 164247149 4.700880e+07 1.169441e+08
## 52   52 149564873 4.587184e+07 1.327633e+08
## 53   53 136678453 4.353754e+07 1.479840e+08
## 54   54 125606698 4.033857e+07 1.622547e+08
## 55   55 116244643 3.661529e+07 1.753401e+08
## 56   56 108418547 3.266712e+07 1.871143e+08
## 57   57 101927999 2.872900e+07 1.975430e+08
## 58   58  96573158 2.496723e+07 2.066596e+08
## 59   59  92169761 2.148673e+07 2.145435e+08
## 60   60  88555668 1.834338e+07 2.213010e+08
## 61   61  85592320 1.555695e+07 2.270507e+08
## 62   62  83163471 1.312267e+07 2.319139e+08
## 63   63  81172729 1.102036e+07 2.360069e+08
## 64   64  79540720 9.221297e+06 2.394380e+08
## 65   65  78202362 7.692989e+06 2.423046e+08
## 66   66  77104401 6.402322e+06 2.446933e+08
## 67   67  76203309 5.317525e+06 2.466792e+08
## 68   68  75463514 4.409275e+06 2.483272e+08
## 69   69  74855937 3.651222e+06 2.496928e+08
## 70   70  74356798 3.020143e+06 2.508231e+08
## 71   71  73946632 2.495863e+06 2.517575e+08
## 72   72  73609503 2.061051e+06 2.525294e+08
## 73   73  73332351 1.700941e+06 2.531667e+08
## 74   74  73104467 1.403039e+06 2.536925e+08
## 75   75  72917066 1.156830e+06 2.541261e+08
## 76   76  72762939 9.534997e+05 2.544836e+08
## 77   77  72636165 7.856865e+05 2.547781e+08
## 78   78  72531881 6.472580e+05 2.550209e+08
## 79   79  72446091 5.331174e+05 2.552208e+08
## 80   80  72375511 4.390360e+05 2.553855e+08
## 81   81  72317442 3.615109e+05 2.555210e+08
## 82   82  72269665 2.976436e+05 2.556327e+08
## 83   83  72230354 2.450383e+05 2.557246e+08
## 84   84  72198007 2.017158e+05 2.558003e+08
## 85   85  72171392 1.660429e+05 2.558626e+08
## 86   86  72149491 1.366720e+05 2.559138e+08
## 87   87  72131469 1.124920e+05 2.559560e+08
## 88   88  72116639 9.258682e+04 2.559908e+08
## 89   89  72104436 7.620176e+04 2.560194e+08
## 90   90  72094394 6.271496e+04 2.560429e+08
## 
## $params
## $params$beta
##      beta 
## 0.6601855 
## 
## $params$gamma
##     gamma 
## 0.3398147 
## 
## $params$R0
##       R0 
## 1.942781

SIR India Model

#India Population is 1.366 bill
generate.SIR.model(tsc, 'India', tot.population=1366000000)
## ################################################################################ 
## ################################################################################ 
## Processing...  INDIA 
##   [1]        0        0        0        0        0        0        0        0
##   [9]        1        1        1        2        3        3        3        3
##  [17]        3        3        3        3        3        3        3        3
##  [25]        3        3        3        3        3        3        3        3
##  [33]        3        3        3        3        3        3        3        3
##  [41]        5        5       28       30       31       34       39       43
##  [49]       56       62       73       82      102      113      119      142
##  [57]      156      194      244      330      396      499      536      657
##  [65]      727      887      987     1024     1251     1397     1998     2543
##  [73]     2567     3082     3588     4778     5311     5916     6725     7598
##  [81]     8446     9205    10453    11487    12322    13430    14352    15722
##  [89]    17615    18539    20080    21370    23077    24530    26283    27890
##  [97]    29451    31324    33062    34863    37257    39699    42505    46437
## [105]    49400    52987    56351    59695    62808    67161    70768    74292
## [113]    78055    81997    85784    90648    95698   100328   106475   112028
## [121]   118226   124794   131423   138536   144950   150793   158086   165386
## [129]   173491   181827   190609   198370   207191   216824   226713   236184
## [137]   246622   257486   265928   276146   286605   297535   308993   320922
## [145]   332424   343091   354065   366946   380532   395048   410451   425282
## [153]   440215   456183   473105   490401   508953   528859   548318   566840
## [161]   585481   604641   625544   648315   673165   697413   719664   742417
## [169]   767296   793802   820916   849522   878254   906752   936181   968857
## [177]  1003832  1039084  1077781  1118206  1155338  1193078  1238798  1288108
## [185]  1337024  1385635  1435616  1480073  1531669  1581963  1634746  1695988
## [193]  1750723  1803695  1855745  1908254  1964536  2027074  2088611  2153010
## [201]  2215074  2268675  2329638  2396637  2461190  2525922  2589952  2647663
## [209]  2702681  2767253  2836925  2905825  2975701  3044940  3106348  3167323
## [217]  3224547  3310234  3387500  3463972  3542733  3621245  3691166  3769523
## [225]  3853406  3936747  4023179  4113811  4204613  4280422  4370128  4465863
## [233]  4562414  4659984  4754356  4846427  4930236  5020359  5118253  5214677
## [241]  5308014  5400619  5487580  5562663  5646010  5732518  5818570  5903932
## [249]  5992532  6074702  6145291  6225763  6312584  6394068  6473544  6549373
## [257]  6623815  6685082  6757131  6835655  6906151  6979423  7053806  7120538
## [265]  7175880  7239389  7307097  7370468  7432680  7494551  7550273  7597063
## [273]  7651107  7706946  7761312  7814682  7864811  7909959  7946429  7990322
## [281]  8040203  8088851  8137119  8184082  8229313  8267623  8313876  8364086
## [289]  8411724  8462080  8507754  8553657  8591730  8636011  8683916  8728795
## [297]  8773479  8814579  8845127  8874290  8912907  8958483  9004365  9050597
## [305]  9095806  9139865  9177840  9222216  9266705  9309787  9351109  9392919
## [313]  9431691  9462809  9499413  9534964  9571559  9608211  9644222  9677203
## [321]  9703770  9735850  9767371  9796744  9826775  9857029  9884100  9906165
## [329]  9932547  9956557  9979447 10004599 10031223 10055560 10075116 10099066
## [337] 10123778 10146845 10169118 10187850 10207871 10224303 10244852 10266674
## [345] 10286709 10325823 10323965 10340469 10356844 10374932 10395278 10413417
## [353] 10413417 10450284 10466595 10479179 10495147 10512093 10527683 10542841
## [361] 10557985 10571773 10581823 10595639 10610883 10625428 10639684 10654533
## [369] 10667736 10676838 10689527 10701193 10720048 10733130 10746174 10757610
## [377] 10766245 10777284 10790183 10802591 10814304 10826363 10838194 10847304
## [385] 10858371 10871294 10880603 10892746 10904940 10916589 10925710 10937320
## [393] 10950201 10963394 10977387 10991651 11005850 11016434 11030176 11046914
## [401] 11063491 11079979 11096731 11112241 11124527 11139516 11156923 11173761
## [409] 11192045 11210799 11229398 11244786 11262707 11285561 11308846 11333728
## [417] 11359048 11385339 11409831 11438734 11474605 11514331 11555284 11599130
## [425] 11646081 11686796 11734058 11787534 11846652 11908910 11971624 12039644
## [433] 12095855 12149335 12221665 12303131 12392260 12485509 12589067 12686049
## [441] 12801785 12928574 13060542 13205926 13358805 13527717 13689453 13873825
## [449] 14074564 14291917 14526609 14788003 15061805 15320972 15616130 15930774
## [457] 16263695 16610481 16960172 17313163 17636186 17997113 18376421 18762976
## [465] 19164969 19557457 19925517 20282833 20664979 21077410 21491598 21892676
## [473] 22296081 22662575 22992517 23340938 23703665 24046809 24372907 24684077
## [481] 24965463 25228996 25496330 25772440 26031991 26289290 26530132 26752447
## [489] 26948874 27157795 27369093 27555457 27729247 27894800 28047534 28175044
## [497] 28307832 28441986 28574350 28694879 28809339 28909975 28996473 29089069
## [505] 29182532 29274823 29359155 29439989 29510410 29570881 29633105 29700313
## [513] 29762793 29823546 29881772 29935221 29977861 30028709 30082778 30134445
## [521] 30183143 30233183 30279331 30316897 30362848 30411634 30458251 30502362
## [529] 30545433 30585229 30619932 30663665 30709557 30752950 30795716 30837222
## [537] 30874376 30907282 30946147 30987880 31026829 31064908 31106065 31144229
## [545] 31174322 31216337
## [1] 42
##  [1]   5  28  30  31  34  39  43  56  62  73  82 102 113 119 142 156 194 244 330
## [20] 396 499 536 657 727 887 987
## ------------------------  Parameters used to create model ------------------------ 
##      Region: INDIA 
##      Time interval to consider: t0=42 - t1= ; tfinal=90 
##          t0: 2020-03-04 -- t1:  
##      Number of days considered for initial guess: 26 
##      Fatality rate: 0.02 
##      Population of the region: 1.366e+09 
## -------------------------------------------------------------------------------- 
## [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
##      beta     gamma 
## 0.6081878 0.3918122 
##   R0 = 1.55224335206386 
##   Max nbr of infected: 99036464.33  ( 7.25 %) 
##   Max nbr of casualties, assuming  2% fatality rate: 1980729.29 
##   Max reached at day : 86 ==>  2020-05-29 
## ================================================================================

## $Infected
##  [1]   5  28  30  31  34  39  43  56  62  73  82 102 113 119 142 156 194 244 330
## [20] 396 499 536 657 727 887 987
## 
## $model
##    time          S            I            R
## 1     1 1365999995 5.000000e+00 0.000000e+00
## 2     2 1365999992 6.207843e+00 2.187158e+00
## 3     3 1365999987 7.707465e+00 4.902667e+00
## 4     4 1365999982 9.569347e+00 8.274155e+00
## 5     5 1365999976 1.188100e+01 1.246009e+01
## 6     6 1365999968 1.475108e+01 1.765722e+01
## 7     7 1365999958 1.831449e+01 2.410983e+01
## 8     8 1365999945 2.273870e+01 3.212116e+01
## 9     9 1365999930 2.823165e+01 4.206778e+01
## 10   10 1365999911 3.505154e+01 5.441721e+01
## 11   11 1365999887 4.351890e+01 6.974988e+01
## 12   12 1365999857 5.403171e+01 8.878643e+01
## 13   13 1365999820 6.708409e+01 1.124216e+02
## 14   14 1365999775 8.328951e+01 1.417664e+02
## 15   15 1365999718 1.034096e+02 1.781998e+02
## 16   16 1365999648 1.283902e+02 2.234345e+02
## 17   17 1365999561 1.594052e+02 2.795965e+02
## 18   18 1365999453 1.979125e+02 3.493254e+02
## 19   19 1365999318 2.457220e+02 4.358987e+02
## 20   20 1365999152 3.050807e+02 5.433853e+02
## 21   21 1365998944 3.787785e+02 6.768373e+02
## 22   22 1365998687 4.702793e+02 8.425271e+02
## 23   23 1365998368 5.838838e+02 1.048242e+03
## 24   24 1365997971 7.249314e+02 1.303652e+03
## 25   25 1365997479 9.000513e+02 1.620760e+03
## 26   26 1365996868 1.117474e+03 2.014470e+03
## 27   27 1365996109 1.387419e+03 2.503289e+03
## 28   28 1365995167 1.722573e+03 3.110190e+03
## 29   29 1365993998 2.138688e+03 3.863698e+03
## 30   30 1365992545 2.655321e+03 4.799227e+03
## 31   31 1365990743 3.296751e+03 5.960747e+03
## 32   32 1365988504 4.093125e+03 7.402848e+03
## 33   33 1365985725 5.081867e+03 9.193306e+03
## 34   34 1365982274 6.309444e+03 1.141627e+04
## 35   35 1365977990 7.833540e+03 1.417621e+04
## 36   36 1365972671 9.725773e+03 1.760283e+04
## 37   37 1365966068 1.207505e+04 2.185717e+04
## 38   38 1365957869 1.499176e+04 2.713913e+04
## 39   39 1365947690 1.861291e+04 3.369694e+04
## 40   40 1365935053 2.310861e+04 4.183871e+04
## 41   41 1365919363 2.869000e+04 5.194699e+04
## 42   42 1365899884 3.561919e+04 6.449667e+04
## 43   43 1365875701 4.422147e+04 8.007725e+04
## 44   44 1365845679 5.490061e+04 9.942054e+04
## 45   45 1365808407 6.815766e+04 1.234349e+05
## 46   46 1365762138 8.461437e+04 1.532478e+05
## 47   47 1365704699 1.050422e+05 1.902587e+05
## 48   48 1365633398 1.303979e+05 2.362041e+05
## 49   49 1365544892 1.618685e+05 2.932391e+05
## 50   50 1365435037 2.009254e+05 3.640375e+05
## 51   51 1365298691 2.493927e+05 4.519164e+05
## 52   52 1365129480 3.095303e+05 5.609897e+05
## 53   53 1364919504 3.841370e+05 6.963589e+05
## 54   54 1364658976 4.766765e+05 8.643476e+05
## 55   55 1364335776 5.914324e+05 1.072792e+06
## 56   56 1363934907 7.336970e+05 1.331396e+06
## 57   57 1363437825 9.100011e+05 1.652174e+06
## 58   58 1362821624 1.128392e+06 2.049984e+06
## 59   59 1362058046 1.398765e+06 2.543189e+06
## 60   60 1361112280 1.733266e+06 3.154454e+06
## 61   61 1359941530 2.146751e+06 3.911720e+06
## 62   62 1358493303 2.657332e+06 4.849365e+06
## 63   63 1356703411 3.286988e+06 6.009601e+06
## 64   64 1354493645 4.062235e+06 7.444120e+06
## 65   65 1351769160 5.014835e+06 9.216005e+06
## 66   66 1348415598 6.182479e+06 1.140192e+07
## 67   67 1344296061 7.609366e+06 1.409457e+07
## 68   68 1339248157 9.346540e+06 1.740530e+07
## 69   69 1333081446 1.145176e+07 2.146679e+07
## 70   70 1325575813 1.398865e+07 2.643554e+07
## 71   71 1316481519 1.702466e+07 3.249382e+07
## 72   72 1305521947 2.062752e+07 3.985053e+07
## 73   73 1292400235 2.485950e+07 4.874027e+07
## 74   74 1276811176 2.976917e+07 5.941965e+07
## 75   75 1258459549 3.538053e+07 7.215992e+07
## 76   76 1237085503 4.167974e+07 8.723476e+07
## 77   77 1212496414 4.860089e+07 1.049027e+08
## 78   78 1184602804 5.601312e+07 1.253841e+08
## 79   79 1153453667 6.371254e+07 1.488338e+08
## 80   80 1119264494 7.142301e+07 1.753125e+08
## 81   81 1082430408 7.880918e+07 2.047604e+08
## 82   82 1043518035 8.550310e+07 2.369789e+08
## 83   83 1003233479 9.114184e+07 2.716247e+08
## 84   84  962369291 9.541027e+07 3.082204e+08
## 85   85  921738808 9.808005e+07 3.461811e+08
## 86   86  882109568 9.903646e+07 3.848540e+08
## 87   87  844147244 9.828750e+07 4.235653e+08
## 88   88  808378201 9.595460e+07 4.616672e+08
## 89   89  775173269 9.224863e+07 4.985781e+08
## 90   90  744750851 8.743797e+07 5.338112e+08
## 
## $params
## $params$beta
##      beta 
## 0.6081878 
## 
## $params$gamma
##     gamma 
## 0.3918122 
## 
## $params$R0
##       R0 
## 1.552243

Appendices

All code used to generate the above visualizations can be found here

The global map gif was created using the following python code

References

Modeling and Simulation in Python, Downey, A.(2017) Chapter 11 Chapter 12

Forecasting: Principles and Practice, Hyndman, R.J., & Athanasopoulos, G. (2018)

Applied Predictive Modeling, Kuhn, M., & Johnson, K. (2013)

Hunter, K., & Kendall, D. (2020). (Rep.). Equitable and Efficient Distribution of a COVID-19 Vaccine

Center on Budget and Policy Priorities. (2020). (Rep.). Center on Budget and Policy Priorities.

World Health Organization. (2006). SARS: How a global epidemic was stopped (pp. 210-217, Rep.). World Health Organization.

https://www.uschamber.com/series/above-the-fold/unemployment-claims-amid-coronavirus-state-state-analysis

https://www.youtube.com/watch?v=ytIZqSaKb3w&list=PL34t5iLfZddtaJ0SB9kfYmytrmXjZLGpD

https://www.youtube.com/watch?v=vLEA8dCfusQ

https://www.youtube.com/watch?v=LQCGeboXZkc

https://in.springboard.com/blog/data-modelling-covid/

https://gisanddata.maps.arcgis.com/apps/dashboards/bda7594740fd40299423467b48e9ecf6