3 data <- read.csv("stability.csv", stringsAsFactors = FALSE)
6 d <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
9 data.frame(date = d$date, value = d$running,
10 variable = "Running"),
11 data.frame(date = d$date, value = d$stable,
12 variable = "Running + Stable"),
13 data.frame(date = d$date, value = d$guard,
14 variable = "Running + Guard"))
15 ggplot(d, aes(x = as.Date(date), y = value, colour = variable)) +
16 geom_line(size = 0.7) +
17 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
18 labels = date_format("%b %Y")) +
19 scale_y_continuous("Number \nof relays ",
20 limits = c(0, max(d$value, na.rm = TRUE))) +
21 scale_colour_manual(name = "Assigned relay flags\n",
22 values = c("Running" = "black", "Running + Stable" = "grey45",
23 "Running + HSDir" = "grey", "Running + Guard" = "grey70")) +
24 opts(axis.title.y = theme_text(size = 12 * 0.8, face = "bold",
25 vjust = 0.5, hjust = 1))
26 ggsave(filename = "relayflags.pdf", width = 8, height = 4, dpi = 100)
29 d <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
32 data.frame(x = d$date, y = d$stable / d$running,
33 variable = "Stable (observed)"),
34 data.frame(x = d$date, y = d$stable50 / d$running,
35 variable = "Stable (simulated)"),
36 data.frame(x = d$date, y = d$guard / d$running,
37 variable = "Guard (observed)"),
38 data.frame(x = d$date, y = d$guard50wfu50advbw / d$running,
39 variable = "Guard (simulated)"))
40 d[d$x >= '2010-06-26' & d$x <= '2010-06-28', "y"] <- NA
41 d[d$x >= '2010-01-25' & d$x <= '2010-01-26', "y"] <- NA
42 ggplot(d, aes(x = x, y = y, colour = variable, linetype = variable)) +
44 scale_y_continuous(name = "Fraction of \nRunning relays ",
45 labels = percent, limits = c(0, max(d$y, na.rm = TRUE))) +
46 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
47 labels = date_format("%b %Y")) +
48 scale_colour_manual(name = "Assigned relay flags\n",
49 values = c("Stable (observed)" = "grey50",
50 "Stable (simulated)" = "grey50",
51 "Guard (observed)" = "black",
52 "Guard (simulated)" = "black")) +
53 scale_linetype_manual(name = "Assigned relay flags\n",
54 values = c(3, 1, 3, 1)) +
55 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
57 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
59 ggsave(filename = "default-reqs.pdf", width = 8, height = 4, dpi = 100)
62 d <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
65 data.frame(x = d$date, y = d$stableintersect,
66 variable = "simulated and observed", flag = "Stable"),
67 data.frame(x = d$date, y = d$stableobserved,
68 variable = "only observed", flag = "Stable"),
69 data.frame(x = d$date, y = d$stablesimulated,
70 variable = "only simulated", flag = "Stable"),
71 data.frame(x = d$date, y = d$guardintersect,
72 variable = "simulated and observed", flag = "Guard"),
73 data.frame(x = d$date, y = d$guardobserved,
74 variable = "only observed", flag = "Guard"),
75 data.frame(x = d$date, y = d$guardsimulated,
76 variable = "only simulated", flag = "Guard"),
77 data.frame(x = NA, y = 0, variable = "only simulated", flag = "Stable"),
78 data.frame(x = NA, y = 0, variable = "only simulated", flag = "Guard"))
79 ggplot(d, aes(x = x, y = y, linetype = variable)) +
81 facet_grid(flag ~ ., scale = "free_y") +
82 scale_y_continuous(name = "Number \nof relays ") +
83 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
84 labels = date_format("%b %Y")) +
85 scale_linetype_manual(name = "", values = c(4, 3, 1)) +
86 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
88 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
90 ggsave(filename = "diff-sim-obs.pdf", width = 8, height = 4, dpi = 100)
93 d_mean <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
95 d_max <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
97 d_min <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
100 data.frame(x = d_mean$date, y = d_mean$minwmtbfa50 / (24 * 60 * 60),
101 ymin = d_min$minwmtbfa50 / (24 * 60 * 60),
102 ymax = d_max$minwmtbfa50 / (24 * 60 * 60),
103 var = "Median Weighted Mean Time Between Failure"),
104 data.frame(x = d_mean$date, y = d_mean$minwta / (24 * 60 * 60),
105 ymin = d_min$minwta / (24 * 60 * 60),
106 ymax = d_max$minwta / (24 * 60 * 60),
107 var = "12.5th percentile Weighted Time Known"),
108 data.frame(x = d_mean$date, y = d_mean$minwfua50wfu / 10000,
109 ymin = d_min$minwfua50wfu / 10000,
110 ymax = d_max$minwfua50wfu / 10000,
111 var = "Median Weighted Fractional Uptime"),
112 data.frame(x = d_mean$date, y = d_mean$minadvbwa50advbw / 1024,
113 ymin = d_min$minadvbwa50advbw / 1024,
114 ymax = d_max$minadvbwa50advbw / 1024,
115 var = "Median Advertised Bandwidth"))
117 yintercept = c(5, 8, 0.98, 250),
118 var = c("Median Weighted Mean Time Between Failure",
119 "12.5th percentile Weighted Time Known",
120 "Median Weighted Fractional Uptime",
121 "Median Advertised Bandwidth"))
122 ggplot(d, aes(x = as.Date(x), y = y, ymin = ymin, ymax = ymax)) +
123 geom_line(colour = "grey30") +
124 geom_ribbon(alpha = 0.3) +
125 geom_hline(data = e, aes(yintercept = yintercept), colour = "gray30",
127 facet_wrap(~ var, scales = "free_y") +
128 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
129 labels = date_format("%b %Y")) +
130 scale_y_continuous(name = "")
131 ggsave(filename = "requirements.pdf", width = 8, height = 5, dpi = 100)
134 d <- d[d$time < '2010-06-26 00:00:00' | d$time > '2010-06-28 23:00:00', ]
135 d <- d[d$time < '2010-01-25 00:00:00' | d$time > '2010-01-26 23:00:00', ]
137 data.frame(x = sort(d$perc10tunf30) / (60 * 60),
138 y = 1:length(d$perc10tunf30) / length(d$perc10tunf30),
139 sim = "30th (simulated)"),
140 data.frame(x = sort(d$perc10tunf) / (60 * 60),
141 y = 1:length(d$perc10tunf) / length(d$perc10tunf),
142 sim = "50th (observed)"),
143 data.frame(x = sort(d$perc10tunf40) / (60 * 60),
144 y = 1:length(d$perc10tunf40) / length(d$perc10tunf40),
145 sim = "40th (simulated)"),
146 data.frame(x = sort(d$perc10tunf50) / (60 * 60),
147 y = 1:length(d$perc10tunf50) / length(d$perc10tunf50),
148 sim = "50th (simulated)"),
149 data.frame(x = sort(d$perc10tunf60) / (60 * 60),
150 y = 1:length(d$perc10tunf60) / length(d$perc10tunf60),
151 sim = "60th (simulated)"))
152 ggplot(d, aes(x = x, y = y, colour = sim, linetype = sim)) +
154 scale_x_continuous(name = paste("\n10th percentile of time until next",
156 breaks = seq(0, max(d$x, na.rm = TRUE), 24),
157 minor = seq(0, max(d$x, na.rm = TRUE), 6),
158 limits = c(0, max(d$x, na.rm = TRUE))) +
159 scale_y_continuous(name = paste("Cumulative fraction \nof",
160 "consensuses \nfrom July to \nDecember 2010 "),
161 labels = percent, limits = c(0, 1)) +
162 scale_colour_manual(name = paste("WMTBF percentile\nfor",
163 "assigning\nStable flag\n"),
164 values = c("60th (simulated)" = "black",
165 "50th (simulated)" = "grey45", "50th (observed)" = "black",
166 "40th (simulated)" = "grey60", "30th (simulated)" = "grey80")) +
167 scale_linetype_manual(name = paste("WMTBF percentile\nfor",
168 "assigning\nStable flag\n"),
169 values = c(1, 3, 1, 1, 1)) +
170 opts(plot.title = theme_text(size = 14 * 0.8, face = "bold"),
171 axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
173 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
175 ggsave(filename = "wmtbf-tunf-sim.pdf", width = 8, height = 4, dpi = 100)
178 d <- d[d$time < '2010-06-26 00:00:00' | d$time > '2010-06-28 23:00:00', ]
179 d <- d[d$time < '2010-01-25 00:00:00' | d$time > '2010-01-26 23:00:00', ]
181 data.frame(x = sort(d$perc10wfu30wfu50advbw) / 10000,
182 y = 1:length(d$perc10wfu30wfu50advbw) /
183 length(d$perc10wfu30wfu50advbw),
184 sim = "30th (simulated)"),
185 data.frame(x = sort(d$perc10wfu40wfu50advbw) / 10000,
186 y = 1:length(d$perc10wfu40wfu50advbw) /
187 length(d$perc10wfu40wfu50advbw),
188 sim = "40th (simulated)"),
189 data.frame(x = sort(d$perc10wfu) / 10000,
190 y = 1:length(d$perc10wfu) / length(d$perc10wfu),
191 sim = "50th (observed)"),
192 data.frame(x = sort(d$perc10wfu50wfu50advbw) / 10000,
193 y = 1:length(d$perc10wfu50wfu50advbw) /
194 length(d$perc10wfu50wfu50advbw),
195 sim = "50th (simulated)"),
196 data.frame(x = sort(d$perc10wfu60wfu50advbw) / 10000,
197 y = 1:length(d$perc10wfu60wfu50advbw) /
198 length(d$perc10wfu60wfu50advbw),
199 sim = "60th (simulated)"))
200 ggplot(d, aes(x = x, y = y, colour = sim, linetype = sim)) +
202 scale_x_continuous(name = "\n10th percentile of WFU in the future",
204 scale_y_continuous(name = paste("Cumulative fraction \nof",
205 "consensuses \nfrom July to \nDecember 2010 "),
206 labels = percent, limits = c(0, 1)) +
207 scale_colour_manual(name = paste("WFU percentile\nfor",
208 "assigning\nGuard flag\n"),
209 values = c("60th (simulated)" = "black",
210 "50th (simulated)" = "grey45", "50th (observed)" = "black",
211 "40th (simulated)" = "grey60", "30th (simulated)" = "grey80")) +
212 scale_linetype_manual(name = paste("WFU percentile\nfor",
213 "assigning\nGuard flag\n"),
214 values = c(1, 1, 3, 1, 1)) +
215 opts(plot.title = theme_text(size = 14 * 0.8, face = "bold"),
216 axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
218 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
220 ggsave(filename = "wfu-wfu-sim.pdf", width = 8, height = 4, dpi = 100)
224 data.frame(x = sort(d$perc10fwb50wfu40advbw),
225 y = 1:length(d$perc10fwb50wfu40advbw) /
226 length(d$perc10fwb50wfu40advbw),
227 sim = "40th (simulated)"),
228 data.frame(x = sort(d$perc10fwb50wfu50advbw),
229 y = 1:length(d$perc10fwb50wfu50advbw) /
230 length(d$perc10fwb50wfu50advbw),
231 sim = "50th (simulated)"),
232 data.frame(x = sort(d$perc10fwb),
233 y = 1:length(d$perc10fwb) /
235 sim = "50th (observed)"),
236 data.frame(x = sort(d$perc10fwb50wfu60advbw),
237 y = 1:length(d$perc10fwb50wfu60advbw) /
238 length(d$perc10fwb50wfu60advbw),
239 sim = "60th (simulated)"),
240 data.frame(x = sort(d$perc10fwb50wfu70advbw),
241 y = 1:length(d$perc10fwb50wfu70advbw) /
242 length(d$perc10fwb50wfu70advbw),
243 sim = "70th (simulated)"))
244 ggplot(d, aes(x = x / 1024, y = y, linetype = sim, colour = sim)) +
246 scale_x_continuous(name = paste("\n10th percentile of weighted bandwidth",
247 "in KiB/s in the future")) +
248 scale_y_continuous(name = paste("Cumulative fraction \nof",
249 "consensuses \nfrom July to \nDecember 2010 "),
250 labels = percent, limits = c(0, 1)) +
251 scale_colour_manual(name = paste("Advertised\nbandwidth\npercentile\nfor",
252 "assigning\nGuard flag\n"),
254 "40th (simulated)" = "grey80",
255 "50th (observed)" = "black",
256 "50th (simulated)" = "grey60",
257 "60th (simulated)" = "grey45",
258 "70th (simulated)" = "black")) +
259 scale_linetype_manual(name = paste("Advertised\nbandwidth\n",
260 "percentile\nfor assigning\nGuard flag\n", sep = ""),
261 values = c(1, 1, 3, 1, 1)) +
262 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
264 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
266 ggsave(filename = "advbw-wb-sim.pdf", width = 8, height = 4, dpi = 100)
269 d <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
272 data.frame(x = d$date, y = d$guard / d$running,
273 variable = "50th (observed)"),
274 data.frame(x = d$date, y = d$guard50wfu50advbw / d$running,
275 variable = "50th (simulated)"),
276 data.frame(x = d$date, y = d$guard50wfu60advbw / d$running,
277 variable = "60th (simulated)"),
278 data.frame(x = d$date, y = d$guard50wfu70advbw / d$running,
279 variable = "70th (simulated)"))
280 ggplot(d, aes(x = x, y = y, colour = variable, linetype = variable)) +
282 scale_y_continuous(name = "Fraction of \nRunning relays ",
283 labels = percent, limits = c(0, max(d$y, na.rm = TRUE))) +
284 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
285 labels = date_format("%b %Y")) +
286 scale_colour_manual(name = paste("Advertised\nbandwidth\npercentile\nfor",
287 "assigning\nGuard flag\n"),
289 "50th (observed)" = "black",
290 "50th (simulated)" = "grey60",
291 "60th (simulated)" = "grey45",
292 "70th (simulated)" = "black")) +
293 scale_linetype_manual(name = paste("Advertised\nbandwidth\npercentile\nfor",
294 "assigning\nGuard flag\n"),
295 values = c(3, 1, 1, 1)) +
296 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
298 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
300 ggsave(filename = "advbw-frac-relays-sim.pdf", width = 8, height = 4,