knitr::opts_chunk$set(fig.width=12, fig.height=6, echo=FALSE, warning=FALSE, message=FALSE, fig.path = "output/figures/")
library(magrittr)
library(ggplot2)
library(dplyr)
library(EpiEstim)
devtools::load_all()

pow_dist    <- params$pow_dist
t.proj      <- params$t.proj
n.sim       <- params$n.sim
n.dates.sim <- params$n.dates.sim
p.stay      <- params$p.stay

Data clean-up

Read in data prepared using the above code chunks.

infile <- here::here("data", "CaseCounts/processed/WHO_bydistricts.csv")
WHO_bydistricts <- readr::read_csv(infile)

infile <- here::here("data", "CaseCounts/processed/WHO_bycountry.csv")
WHO_bycountry   <- readr::read_csv(infile)

Gravity model parameters

pow_N_to <- pow_N_from <- 1
K        <- 1

Comparison with the data from Health Map and ProMed


Projection using WHO data

Projection within Sierra Leone


Projection within Liberia


Projection within Guinea


Projection across all districts within Sierra Leone, Liberia and Guinea


Evaluating goodness of fit

outfile         <- "output/alldistricts-lh-tproj-100.csv"
log_likelihood  <- read.csv(outfile, na.strings = "-Inf")

## Replace -Inf by a large negative number

#log_likelihood[is.na(log_likelihood)] <- -900


pstay <- unique(log_likelihood$p.stay)   %>% sort
power <- unique(log_likelihood$pow_dist) %>% sort

z  <- select(log_likelihood, -c(pow_dist, p.stay)) %>%
      rowSums %>%
       matrix(nrow = length(power), byrow = TRUE)

p <- plotly::plot_ly(x = ~pstay, y = ~power, z = ~z) %>% plotly::add_surface()


#p <- plot_ly(x = ~pstay, y = ~power, showscale = TRUE) %>%
#  add_surface(z = ~z300) %>%
#  add_surface(z = ~z500, opacity = 0.98) 


annecori/mRIIDSprocessData documentation built on May 29, 2019, 1:16 p.m.