-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5_times.R
68 lines (50 loc) · 2.21 KB
/
5_times.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
#-----------------------------------------#
## Computational methods for fast Bayesian hierarchical model assessment via calibrated posterior p-values.
## Sally Paganin
## last update: January 2024
## R version 4.3.2 (2023-10-31) -- "Eye Holes"
##-----------------------------------------#
library(ggplot2)
library(latex2exp)
##-----------------------------------------#
## dipper TT
xx <- readRDS("sec6_examples/dipperTT/results_nCRep_1000_nIter_1000.rds")
dfTime <- data.frame(example = "dipperTT" , minutes = xx$time[3]/60)
## dipper CC
dfTime[2, ]$example <- "dipperCC"
dfTime[2, ]$minutes <- readRDS("sec6_examples/dipperCC/results_nCRep_1000_nIter_1000.rds")$time[3]/60
## capture
dfTime[3, ]$example <- "capRecapSimulated"
dfTime[3, ]$minutes <- readRDS("sec6_examples/capRecapSimulated/results_nCRep_1000_nIter_1000.rds")$time[3]/60
## newcomb
dfTime[4, ]$example <- "newcomb"
dfTime[4, ]$minutes <- readRDS("sec6_examples/newcomb/results_nCRep_1000_nIter_1000.rds")$time[3]/60
## newcombBadMixing
dfTime[5, ]$example <- "newcombBadMixing"
dfTime[5, ]$minutes <- readRDS("sec6_examples/newcombBadMixing/results_nCRep_1000_nIter_1000.rds")$time[3]/60
dfTime
## dfTime contain the time to perform 1000 calibration replicates, each with 1000 MCMC samples
dfTime$seconds <- dfTime$minutes * 60
dfTime$mcmc1000 <- dfTime$seconds/1000
dfTime$mcmc1 <- dfTime$mcmc1000/1000
dfTime$ppp <- dfTime$mcmc1* c(10000, 10000, 10000, 5000, 5000)
dfTime$c5000 <- dfTime$mcmc1* 5000
dfTime$c10000 <- dfTime$mcmc1* 10000
dfTime$c20000 <- dfTime$mcmc1* 20000
dfTime$c50000 <- dfTime$mcmc1* 50000
dfTime$naiveTime <- dfTime$ppp * 1000
dfTime <- dfTime[c(4,5,2,1,3), ]
dfTime[, c(6:11)]/60
###################
df <- data.frame(example = rep(dfTime$example, 4),
m = rep(c(50, 100, 200, 500), each = 5),
mcmc1 = rep(dfTime$mcmc1, 4),
naiveTime = rep(dfTime$naiveTime, 4))
df$time = df$m * df$mcmc1 * 1000
df$saving = df$naiveTime/df$time
ggplot(data = df, aes(x = m, y = time/60, color = example)) +
geom_point() + geom_line() + theme_bw() +
xlab(TeX("\\tilde{m}")) + ylab("time in minutes")
ggplot(data = df, aes(x = m, y = naiveTime/60, color = example)) +
geom_point() + geom_line() + theme_bw() +
xlab(TeX("\\tilde{m}")) + ylab("time in minutes")