-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobCheck.R
More file actions
30 lines (20 loc) · 1.05 KB
/
robCheck.R
File metadata and controls
30 lines (20 loc) · 1.05 KB
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
## args <- c("Tennessee/robustness/tnBadRunGD", "Tennessee/tnGraph.rds")
args <- commandArgs(trailingOnly = T)
runs <- lapply(list.files(args[1]), function(x) {readRDS(file=paste0(args[1], "/", x))})
g <- readRDS(file=args[2])
gaics <- lapply(runs, function(run){
sapply(run, function(x) {x$gaic})
})
vars <- lapply(runs, function(run){
sapply(run, function(x) {var(x$csize)})
})
norm <- lapply(runs, function(run){
sapply(run, function(x) {x$gaic/log(var(x$csize))})
})
mins <- sapply(gaics, function(x){which(x==min(x))})
plot(as.numeric(names(mins)), main = "Robustness Test3, Tennessee", xlab = "Run (runX shows the minimum GAIC obtained after removing x-1 years)", ylab = "Cutoff obtaining minimum GAIC")
mins <- sapply(norm, function(x){which(x==min(x))})
plot(as.numeric(names(mins)), main = "Robustness Test4, Tennessee", xlab = "Run (runX shows the minimum GAIC obtained after removing x-1 years)", ylab = "Cutoff obtaining minimum GAIC normalized to log variance of cluster size")
for (i in 1:length(runs)){
plot(gaics[[i]]/log(vars[[i]]))
}