#library(ringbp)
library(ggplot2)
library(data.table)
library(plyr)


simRes = fread("simResults.csv" )


plotDt = simRes[, list(meanInfected = sum(weekly_cases/n.sim , na.rm = TRUE), meanAppInfected = sum(frac1*weekly_cases/fracApp/n.sim , na.rm = TRUE),
                         meanR0 = sum(effective_r0*weekly_cases)/sum(weekly_cases)), by=list(fracApp, mixing)]

# Some of the curves when the population is completely mixed
#ggplot(simRes[mixing == 0.5], aes(x = week, y = weekly_cases*frac1/fracApp, colour = as.factor(fracApp), style = mixing, group = paste(fracApp, mixing, sim))) + geom_line(alpha = 0.22,  show.legend = TRUE)


# relative risk to an app user as a function of how many app users there are and how mixed they are with non app users
#ggplot(plotDt, aes(x = fracApp, y = mixing, z = meanAppInfected)) + stat_summary_2d(bins = c(10,5))

#ggplot(plotDt, aes(x = fracApp, y = mixing, z = meanInfected)) + stat_summary_2d(bins = c(10,5))


#ggplot(plotDt, aes(x = fracApp, y = mixing, z = meanR0)) + stat_summary_2d(bins = c(10,5))


#ggplot(plotDt, aes(x = fracApp, y = mixing, z = totalInfected)) + stat_summary_2d(bins = c(10,5))


ggplot(plotDt, aes(x = fracApp, y = meanInfected, colour = as.factor(mixing), group = as.factor(mixing))) + geom_line()

ggplot(plotDt, aes(x = fracApp, y = meanAppInfected, colour = as.factor(mixing), group = as.factor(mixing))) + geom_line()


covid19risk/impact-sim documentation built on April 16, 2021, 2:15 a.m.