### SHOULD BE RUN ON CLUSTER with lots of memory###

rm(list=ls())
library(foreign)
library(rstanarm)
library(rstan)
library(Hmisc)
library(data.table)
library(parallel)
library(loo)

setwd('~/research/gTiger/Article_citsci/open_code')
source('settings/parameters.r')
source('settings/paths.r')
source('settings/functions.r')

setwd(path_to_data)

# "mosquito_alert_model",

these_models = c("mosquito_alert_model_M0a","mosquito_alert_model_M0b", "mosquito_alert_model_M0c","mosquito_alert_model_M0d","mosquito_alert_model_M0e")

for(this_model in these_models){

	M = readRDS(paste0('untracked/', this_model, '.Rds'))

	M_waic = waic(M) 

	saveRDS(M_waic, paste0('untracked/', this_model, '_waic.Rds'))

	rm(M_waic)
	rm(M)
}

