# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# ~~~~~~~~ Modelling LF prevalence in Nigeria using a machine learning approach ~~~~~~~~~~~~~ #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# Date: 07.2018
# Place: London, UK
# Project: Modelling LF prevalence in Nigeria using Quantile Regression Forest
# Section 1: Set up a function to install and load multiple R packages.
# Check to see if packages are installed. Install them if they are not, then load them into the R session.
ipak Pred ICT
Obs.Mf.Pred.Mf Obs Mf
# 5.3 - Correlation tests
cor.test(ICT.cor$Prevalence, Obs.ICT.Pred.ICT) #correlation between Obs ICT and Pred ICT
cor.test(Mf.cor$Prevalence, Obs.Mf.Pred.Mf) #correlation between Obs Mf and Pred Mf
# Section 6 - Function for plotting graphs of observed vs predicted values and 95% prediction intervals
ggvalidate = low & observed Pred ICT
# Now re-run the above commands to extract back the values.
obs.ICT <- Obs.Pred.ICT[,2]
# Predicted lower and upper bounds
pred025 <- Predict.ICT.output[,3]
pred975 <- Predict.ICT.output[,5]
ICT.CI <- as.data.frame(cbind(pred025, pred975))
install.packages(c("ggplot2", "ggpubr", "ggsci"))
library(ggplot2)
source("ggvalidate.R")
ggvalidate(observed = obs.ICT, predicted = pred.ICT, CI = cbind(pred025, pred975), type = 1, alpha = 1)
ggvalidate(observed = obs.ICT, predicted = pred.ICT, CI = cbind(pred025, pred975), type = 2, alpha = 1)
# Save workspace
# END OF RUN