-
Notifications
You must be signed in to change notification settings - Fork 2
/
scenario_rho.R
84 lines (74 loc) · 2.02 KB
/
scenario_rho.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#### Code to run scenarios - RHO
# run all multiple times and save output
# all run as functions
# load packages needed to run in parallel
library(foreach)
library(doParallel)
# choose number of times to run
n_runs <- 500
#n_runs<-1
# create a randomly generated string of seeds
# seed must be integer
set.seed(1)
seed <- sample(round(1:100000000),n_runs,replace=F)
#seed <- NULL
# set up the scenario with parameters that need to be changed
# set parameters
#source("setParams.R") # this is now redundant
source("run_scenario.R")
# change those that need changing
## STRUCTURED SAMPLE SIZE
rho_param <- c(0.90,0.95,0.99,1) # 10 scenarios
#
# unstructuredcov model
mapply(FUN = run_scenario,
rho = rho_param,
parameter = rho_param,
MoreArgs = list(
model_type="unstructuredcov",
plotting=FALSE,
summary_results=FALSE,
seed = seed,
plot = FALSE,
n_runs = n_runs,
scenario_name = "Rho_",
dim = c(300,300),
lambda = -3,
env.beta = 2,
plotdat = TRUE,
sigma2x = 0.5,
kappa = 0.05,
strata = 25,
rows = 5,
cols = 5,
probs = 0.2,
qsize = 1,
nsamp = 150,
resolution = c(10,10),
correlation = FALSE))
# jointcov model
mapply(FUN = run_scenario,
rho = rho_param,
parameter = rho_param,
MoreArgs = list(
model_type="jointcov",
plotting=FALSE,
summary_results=FALSE,
seed = seed,
plot = FALSE,
n_runs = n_runs,
scenario_name = "Rho_",
dim = c(300,300),
lambda = -2,
env.beta = 2,
plotdat = TRUE,
sigma2x = 0.5,
kappa = 0.05,
strata = 25,
rows = 5,
cols = 5,
probs = 0.2,
qsize = 1,
nsamp = 150,
resolution = c(10,10),
correlation = FALSE)) # to use the function you must put in all parameters it is expecting