Chapter 4 Supplementary Figures (Model)

4.1 Packages, data, and helpers

library(tidyverse); library(useful);library(epiDisplay);library(lubridate)
library(spdep); library(sf); library(sp); library(devtools); library(pkgload)

test_pv_2<-readRDS("./_data/models_pv_jm.rds")
test_pf_2<-readRDS("./_data/models_pf_jm.rds")

4.2 Supplementary Figure 7 [COMPLETE] Relative risk nonlinear effects of deforestation, prcp,Tmax,month and year for A)P.vivax and B)Falciparum

# Extra requirements
library(cowplot)

# P. Vivax
sv8a <- test_pv_2[[5]] %>%
  plot_random2(lab1 = c("Cum deforest x 100 km2","Avg. Daily Precipitation (mm)","Tmax (ºC)", "Month", "Year"),
               scaled = T,
               scaled_var = "inla.group(prcp)", 
               scaled_mean = mean(dt_final$prcp/30, na.rm=T), 
               scaled_sd = sd(dt_final$prcp/30, na.rm=T)
               )


# P. Falciparum
sf8b <- test_pf_2[[11]] %>% #esta bien solo estaba mal el subindice y la bd ademas 
  plot_random2(lab1 = c("Cum deforest x 100 km2","Avg. Daily Precipitation (mm)","Tmax (ºC)", "Month", "Year"),
               scaled = T,
               scaled_var = "inla.group(prcp)", 
               scaled_mean = mean(dt_final$prcp/30, na.rm=T), 
               scaled_sd = sd(dt_final$prcp/30, na.rm=T)
               )

# Final figure
(sf8 <- plot_grid(sv8a, sf8b, labels = c("A","B"), ncol = 1))

4.3 Supplementary Figure 8 [COMPLETE]Contributions of spatial random effects to P.vivax and P.falciparum risk

# Preprocessing requirements
library(cowplot)

# ---------------
# Version 2
# ---------------

# P. Vivax
rm_pv_2 <-test_pv_2[[5]] %>% 
  plot_random_map2(map = area.sf, name= "")

#P. Falciparum
rm_pf_2 <-test_pf_2[[2]] %>% 
  plot_random_map2(map = area.sf, name= "")


rm_seasonal<-plot_grid(rm_pv_2,rm_pf_2, ncol=2, labels = c("A) P. vivax", "B) P. falciparum"))
rm_seasonal