data-raw/nc_delay.R

## code to prepare `nc_delay` dataset goes here
# NCDHHS Reporting Data Starting 2020-10-29
lab_results <- c(
	1.4,
	1.4,
	1.4,
	1.6,
	1.8,
	1.5,
	1.2,
	1.3,
	1.3,
	1.4,
	1.6,
	1.8,
	1.6,
	1.4,
	1.5,
	1.7,
	1.7,
	1.8,
	1.9,
	2,
	1.5,
	1.6,
	1.6,
	1.6,
	1.9,
	2.2,
	1.9,
	1.6,
	1.7,
	1.9,
	2,
	1.8,
	1.1,
	1.1,
	1.3,
	1.6,
	1.6,
	1.8,
	2.1,
	1.9,
	1.3,
	1.4,
	1.5,
	1.3,
	1.4,
	1.7,
	1.3,
	1.1,
	1.4,
	1.4,
	1.5,
	1.4,
	1.1,
	1.3,
	1.5,
	1.7,
	1.5,
	1.1,
	1,
	1.2,
	1.2,
	1.3,
	1.2,
	1.4,
	1.3,
	1.2,
	1.1,
	1.4,
	1.4
)

electronic_report <- c(
	.9,
	1,
	.8,
	.6,
	.7,
	.9,
	3.2,
	.8,
	.8,
	.8,
	.7,
	.8,
	1.3,
	1,
	.5,
	1.1,
	.8,
	.8,
	.8,
	4.6,
	3.5,
	.7,
	.8,
	.8,
	.8,
	.6,
	1,
	1,
	.6,
	1.1,
	1,
	1,
	1.6,
	1.3,
	1.1,
	1.1,
	1,
	.8,
	3.2,
	1.9,
	3.2,
	3.2,
	3.5,
	3.1,
	2.6,
	2.9,
	2,
	1.9,
	.8,
	.8,
	.9,
	1.1,
	.7,
	.9,
	.6,
	.6,
	1.2,
	.5,
	.5,
	.7,
	1.4,
	.5,
	.3,
	.5,
	.4,
	.4,
	.5,
	.5,
	.5)

dates <- seq.Date(from = as.Date("2020-10-29"), by = 1, length.out = length(lab_results))

combined_delay <- lab_results+electronic_report

plot(dates, combined_delay, 
		 type = "b", pch = 19, 
		 ylab = "Days Delayed", 
		 xlab = '', main = "North Carolina Reporting Delay")

nc_delay <- EpiNow2::bootstrapped_dist_fit(combined_delay, dist = "gamma")

usethis::use_data(nc_delay, overwrite = TRUE)


# data viz on delay distribution ------------------------------------------

plot(seq(0,10,.1),dgamma(seq(0,10,.1), shape = 1.67, scale = 1.32), 
		 col = "orange", lwd = 2,type = "l", xlab = "Reporting Delay (Days)", ylab = "Density", ylim = c(0,.5))
lines(seq(0,10,.1),dgamma(seq(0,10,.1), shape = 7.7, scale = .37), col = "blue")
title(main = "Shifting Reporting Delay Since Dec 6")
#lines(seq(0,10,.1),dgamma(seq(0,10,.1), shape = nc_delay$mean, scale = .37), col = "blue")
nctriadresearch/nccovid documentation built on April 9, 2023, 7:03 a.m.