Last active
March 18, 2025 17:27
-
-
Save adamkucharski/eb8002cee174e44606ea55aa60854467 to your computer and use it in GitHub Desktop.
CFR plot based on aggregate data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define delay params | |
param_1 <- log(5) | |
param_2 <- 1 | |
# Onsets at time 0 | |
initial_onsets <- 100 | |
# CFR | |
cfr <- 0.5 | |
# Formula | |
# E(deaths by time t) = CFR x cases with known outcome by time t if outcome were fatal | |
# Calculate number of known fatal outcomes on day 10 | |
day_10_deaths <- initial_onsets*plnorm(10, param_1, sdlog = param_2) | |
# Plot | |
time_range <- 0:30 | |
plot(time_range,initial_onsets*cfr*plnorm(time_range, param_1, sdlog = param_2), | |
ylim=c(0,initial_onsets), | |
xlim=c(0,max(time_range)), | |
yaxs="i",xaxs="i",xlab="day",ylab="events") | |
lines(c(0,50),initial_onsets*cfr*c(1,1),lty=2) | |
points(time_range,initial_onsets*plnorm(time_range, param_1, sdlog = param_2),col="pink") | |
points(10,day_10_deaths,col="red") | |
text(x=11,y=day_10_deaths,"estimated fatal outcomes/CFR",adj=0,col="red") | |
text(x=10,y=30,"cumulative deaths",adj=0) | |
lines(c(10,10),c(0,day_10_deaths),col="red") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment