TSR-Proj / m-local_master.r
m-local_master.r
Raw
#############################################################################
# This script can be used to run the main analysis in `m-Main.R` locally.
# Parameters below can be adjusted to run all or some combinations of the parameters 
# used in the complete analysis.
#############################################################################

# Start with a clean environment ----
rm(list = ls())

# Configuration of parameter sets to be analyzed ----
locations     <- c("Toronto, Canada") # "Dubai, United Arab Emirates" "Rio_de_Janeiro, Brazil" "Rome, Italy" "Toronto, Canada"
sigma_betas   <- c(0)             # (0 0.05)
IDs           <- 1                # From 1 to 50
True_e_vals   <- c(-0.04)         # (-0.04 -0.02)
rho_Ks        <- c(0.1)           # (0.1 0.16)
School_Terms  <- c(0)             # (0 1)
rho_Means     <- c(0.5)
import_rates  <- c(1e-5)

grid <- expand.grid(
  location       = locations,
  sigma_betas_val = sigma_betas,
  ID             = IDs,
  True_e_Te      = True_e_vals,
  True_e_RH      = True_e_vals,
  rho_K          = rho_Ks,
  rho_Mean       = rho_Means,
  import_val     = import_rates,
  School_Term    = School_Terms,
  stringsAsFactors = FALSE
)

# Loop running one full analysis for one parameter set, location and scenario ----
for (i in seq_len(nrow(grid))) {
  p <- grid[i, ]
  
  # Set environment variables to be used for the analysis
  do.call(Sys.setenv, as.list(p))
  
  source("m-Main.r")
}