gr <- function(date, cases) {
imax <- length(date)
stopifnot(imax == length(cases))
(log(cases[imax]) - log(cases[1])) / as.numeric(date[imax]-date[1])
}
aprildata <-
filter(cov19county, state == 'Virginia',
!is.na(fips),
date >= as.Date('2020-04-01'),
date <= as.Date('2020-04-30')
)
growthrates <-
group_by(aprildata, county, fips) %>%
summarise(rate=gr(date, cases), cases=max(cases)) %>%
mutate(td=log(2)/rate) %>%
arrange(desc(rate))
#hist(filter(growthrates, rate>0)$td, breaks=25)
ggplot(growthrates, aes(x=td)) + geom_histogram(bins=25, alpha=0.7) + theme_bw()
## Warning: Removed 7 rows containing non-finite values (stat_bin).
Counties in the UVA catchment:
uvacounties <- filter(growthrates, fips %in% sampleCounties$fips)
print(uvacounties)
## # A tibble: 11 x 5
## # Groups: county [11]
## county fips rate cases td
## <chr> <chr> <dbl> <int> <dbl>
## 1 Buckingham 51029 0.123 55 5.65
## 2 Fluvanna 51065 0.118 73 5.86
## 3 Highland 51091 0.116 2 6
## 4 Greene 51079 0.0814 10 8.52
## 5 Orange 51137 0.0707 27 9.80
## 6 Waynesboro city 51820 0.0631 11 11.0
## 7 Madison 51113 0.0571 14 12.1
## 8 Albemarle 51003 0.0495 80 14.0
## 9 Louisa 51109 0.0487 41 14.2
## 10 Nelson 51125 0.0464 7 14.9
## 11 Charlottesville city 51540 0.0429 51 16.1
Counties with doubling times less than 10:
print(filter(growthrates, td <= 10))
## # A tibble: 77 x 5
## # Groups: county [77]
## county fips rate cases td
## <chr> <chr> <dbl> <int> <dbl>
## 1 Richmond 51159 0.198 141 3.50
## 2 Southampton 51175 0.176 115 3.94
## 3 Falls Church city 51610 0.171 26 4.05
## 4 Page 51139 0.166 89 4.17
## 5 Montgomery 51121 0.148 54 4.69
## 6 Manassas Park city 51685 0.147 53 4.71
## 7 Harrisonburg city 51660 0.137 406 5.05
## 8 Colonial Heights city 51570 0.137 47 5.06
## 9 Augusta 51015 0.136 39 5.11
## 10 Buchanan 51027 0.132 16 5.25
## # ... with 67 more rows
Counties with doubling times between 10 and 20
print(filter(growthrates, td > 10, td<=20))
## # A tibble: 35 x 5
## # Groups: county [35]
## county fips rate cases td
## <chr> <chr> <dbl> <int> <dbl>
## 1 Frederick 51069 0.0691 97 10.0
## 2 Hopewell city 51670 0.0664 24 10.4
## 3 Roanoke city 51770 0.0653 35 10.6
## 4 Norfolk city 51710 0.0644 188 10.8
## 5 Buena Vista city 51530 0.0644 5 10.8
## 6 Campbell 51031 0.0631 11 11.0
## 7 Waynesboro city 51820 0.0631 11 11.0
## 8 Wythe 51197 0.0631 11 11.0
## 9 Giles 51071 0.0630 4 11
## 10 Alleghany 51005 0.0596 5 11.6
## # ... with 25 more rows
Counties with doubling times greater than 20
print(filter(growthrates, td >20, rate>0))
## # A tibble: 10 x 5
## # Groups: county [10]
## county fips rate cases td
## <chr> <chr> <dbl> <int> <dbl>
## 1 Rockbridge 51163 0.0339 5 20.4
## 2 Tazewell 51185 0.0339 5 20.4
## 3 Lunenburg 51111 0.0330 4 21
## 4 King and Queen 51097 0.0257 2 27
## 5 Mathews 51115 0.0257 4 27
## 6 Poquoson city 51735 0.0257 6 27.
## 7 Williamsburg city 51830 0.0257 20 27.
## 8 Amherst 51009 0.0218 10 31.8
## 9 James City 51095 0.0181 155 38.2
## 10 Lexington city 51678 0.0162 3 42.7
No growth or no cases observed
print(filter(growthrates, rate==0))
## # A tibble: 6 x 5
## # Groups: county [6]
## county fips rate cases td
## <chr> <chr> <dbl> <int> <dbl>
## 1 Bristol city 51520 0 1 Inf
## 2 Covington city 51580 0 1 Inf
## 3 Craig 51045 0 2 Inf
## 4 Floyd 51063 0 1 Inf
## 5 Lancaster 51103 0 1 Inf
## 6 Norton city 51720 0 2 Inf