-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostprocess_compare_adapt.R
More file actions
60 lines (59 loc) · 2.2 KB
/
postprocess_compare_adapt.R
File metadata and controls
60 lines (59 loc) · 2.2 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
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
# Postprocess compare_adapt
# Use to changed batches to not full number
postprocess_outdf = function(self, batches) {#browser()
if (missing(batches)) {
batches <- self$batches
} else if (batches == '10D') {batches <- ceiling(10 * self$D / otl1$b)
} else {stop("bad batches")}
self.outdf <- self$outrawdf
self.outdf$rmse <- sqrt(ifelse(self.outdf$mse>=0, self.outdf$mse, 1e-16))
self.outdf$prmse <- sqrt(ifelse(self.outdf$pvar>=0, self.outdf$pvar, 1e-16))
# self.enddf <- self.outdf[self.outdf$batch == self$batches,]
self.enddf <- self.outdf[self.outdf$batch == batches,]
if (nrow(self.enddf)==0) {stop('No rows?')}
# Want to get mean of these columns across replicates
meanColNames <- c("mse","pvar","pamv","rmse","prmse","pred_intwerror",
"actual_intwerror", "actual_intwvar")
# Use these as ID, exclude repl, seed, and num and time
splitColNames <- c("func","func_string","func_num","D","L","b",
"reps","batches",
"force_old","force_pvar","force2",
"n0","obj", "batch", "n", "Group","package",
"selection_method", "design", "des_func",
"actual_des_func_num", "alpha_des", "weight_const",
"error_power")
# self.meandf <- plyr::ddply(
# self.outdf,
# splitColNames,
# function(tdf){
# colMeans(tdf[,meanColNames])
# }
# )
# self$meanlogdf <- plyr::ddply(
# self.outdf,
# splitColNames,
# function(tdf){
# exp(colMeans(log(tdf[,meanColNames])))
# }
# )
self.endmeandf <- plyr::ddply(
self.enddf,
splitColNames,
function(tdf){
c(
colMeans(tdf[,meanColNames])
, setNames(c(summary(tdf$actual_intwerror),
sd(tdf$actual_intwerror)),
paste("actual_intwerror",
c("Min", "Q1","Med","Mean","Q3","Max","sd"),
sep = '_'))
, setNames(c(summary(tdf$actual_intwvar),
sd(tdf$actual_intwvar)),
paste("actual_intwvar",
c("Min", "Q1","Med","Mean","Q3","Max","sd"),
sep = '_'))
)
}
)
self.endmeandf
}