/
analysis.Rmd
354 lines (273 loc) · 10.9 KB
/
analysis.Rmd
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
---
title: "analysis"
output:
html_document:
css: css/style.css
keep_md: yes
self_contained: no
theme: cosmo
pdf_document: default
html_notebook:
code_folding: hide
theme: cosmo
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
rm(list = ls(all.names = TRUE))
```
```{r}
library(knitr)
source("code/functions.R")
source("input/var.R")
## load comparator case
source("input/input_base.R")
#source("input/input_base_vaxbase_10.R")
#source("input/input_base_vaxbase_20.R")
```
```{r}
## load new intervention case
#source("input/input_vaxbase_10.R")
#source("input/input_vaxbase_20.R")
#source("input/input_vaxbase_30.R")
#source("input/input_vaxbase_40.R")
#source("input/input_70_10.R")
#source("input/input_70_20.R")
#source("input/input_70_50.R")
#source("input/input_70_60.R")
```
# SAVE RDATA!!!
```{r eval=FALSE, include=FALSE}
rm(b_cases, cc_intv, cc_base, costs, num_cases, num_outcomes_base, num_outcomes_intv, pop, prob, r_cost, risk_group, vax_comp_i, vax_comp_b, i_cases, total_cost_vax_b, total_cost_vax_i)
## save RData
#save.image(file = "output/base.RData")
#save.image(file = "output/vaxbase_40.RData")
#save.image(file = "output/vax70_60.RData")
#save.image(file = "output-vaxbase10/vax70_60.RData")
#save.image(file = "output-vaxbase20/vax70_60.RData")
```
###### 0-4 years ######
```{r}
pop <- pop_04
num_cases <- base_04
cases_after_vax <- intv_04
vax_comp_i <- vc_04
vax_comp_b <- bc_04
```
## 0-4 years, HIGH
```{r}
risk_group <- high_019
prob <- c(p_04_high_death, p_04_high_hosp, p_04_high_out, p_04_high_rest)
r_cost <- rc_04_high
# total vaccination cost for age/risk
total_cost_vax_b <- calc_vaccination_cost(vax_comp_b) # base
total_cost_vax_i <- calc_vaccination_cost(vax_comp_i) # intv
# cost per health outcome
costs <- cost_cpi_outcome(r_cost[1], r_cost[2], r_cost[3], r_cost[4])
# base summary
b_cases <- calc_subpop_cases_base(num_cases, risk_group) # base
num_outcomes_base <- calc_num_outcomes_base(prob[1], prob[2], prob[3], prob[4]) # base
cc_base <- calc_total_cost_base(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # base
# intv summary
i_cases <- calc_subpop_cases_intv(cases_after_vax, risk_group) # intv
num_outcomes_intv <- calc_num_outcomes_intv(prob[1], prob[2], prob[3], prob[4]) # intv
cc_intv <- calc_total_cost_intv(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # intv
print(sprintf("total vax costs = %f", total_cost_vax_i))
print(sprintf("base cases = %f", b_cases))
print(sprintf("intv cases = %f", i_cases))
costs_04_high <- cc_intv[5]
cases_04_high <- i_cases
outcomes_04_high <- num_outcomes_intv[2:4]
icer_04_high <- calc_icer()
deaths_04_high <- calc_deaths_b()
```
## 0-4 years, low risk
```{r}
risk_group <- 1-high_019
prob <- c(p_04_low_death, p_04_low_hosp, p_04_low_out, p_04_low_rest)
r_cost <- rc_04_low
# total vaccination cost for age/risk
total_cost_vax_b <- calc_vaccination_cost(vax_comp_b) # base
total_cost_vax_i <- calc_vaccination_cost(vax_comp_i) # intv
# cost per health outcome
costs <- cost_cpi_outcome(r_cost[1], r_cost[2], r_cost[3], r_cost[4])
# base summary
b_cases <- calc_subpop_cases_base(num_cases, risk_group) # base
num_outcomes_base <- calc_num_outcomes_base(prob[1], prob[2], prob[3], prob[4]) # base
cc_base <- calc_total_cost_base(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # base
# intv summary
i_cases <- calc_subpop_cases_intv(cases_after_vax, risk_group) # intv
num_outcomes_intv <- calc_num_outcomes_intv(prob[1], prob[2], prob[3], prob[4]) # intv
cc_intv <- calc_total_cost_intv(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # intv
print(sprintf("total vax costs = %f", total_cost_vax_i))
print(sprintf("base cases = %f", b_cases))
print(sprintf("intv cases = %f", i_cases))
costs_04_low <- cc_intv[5]
cases_04_low <- i_cases
outcomes_04_low <- num_outcomes_intv[2:4]
icer_04_low <- calc_icer()
deaths_04_low <- calc_deaths_b()
```
###### 5-19 years ######
```{r}
pop <- pop_519
num_cases <- base_519
cases_after_vax <- intv_519
vax_comp_i <- vc_519
vax_comp_b <- bc_519
```
## 5-19 years, HIGH
```{r}
risk_group <- high_019
prob <- c(p_519_high_death, p_519_high_hosp, p_519_high_out, p_519_high_rest)
r_cost <- rc_519_high
total_cost_vax_b <- calc_vaccination_cost(vax_comp_b) # base
total_cost_vax_i <- calc_vaccination_cost(vax_comp_i) # intv
costs <- cost_cpi_outcome(r_cost[1], r_cost[2], r_cost[3], r_cost[4])
b_cases <- calc_subpop_cases_base(num_cases, risk_group) # base
num_outcomes_base <- calc_num_outcomes_base(prob[1], prob[2], prob[3], prob[4]) # base
cc_base <- calc_total_cost_base(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # base
i_cases <- calc_subpop_cases_intv(cases_after_vax, risk_group) # intv
num_outcomes_intv <- calc_num_outcomes_intv(prob[1], prob[2], prob[3], prob[4]) # intv
cc_intv <- calc_total_cost_intv(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # intv
print(sprintf("total vax costs = %f", total_cost_vax_i))
print(sprintf("base cases = %f", b_cases))
print(sprintf("intv cases = %f", i_cases))
costs_519_high <- cc_intv[5]
cases_519_high <- i_cases
outcomes_519_high <- num_outcomes_intv[2:4]
icer_519_high <- calc_icer()
deaths_519_high <- calc_deaths_b()
```
## 5-19 years, low risk
```{r}
risk_group <- 1-high_019
prob <- c(p_519_low_death, p_519_low_hosp, p_519_low_out, p_519_low_rest)
r_cost <- rc_519_low
total_cost_vax_b <- calc_vaccination_cost(vax_comp_b) # base
total_cost_vax_i <- calc_vaccination_cost(vax_comp_i) # intv
costs <- cost_cpi_outcome(r_cost[1], r_cost[2], r_cost[3], r_cost[4])
b_cases <- calc_subpop_cases_base(num_cases, risk_group) # base
num_outcomes_base <- calc_num_outcomes_base(prob[1], prob[2], prob[3], prob[4]) # base
cc_base <- calc_total_cost_base(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # base
i_cases <- calc_subpop_cases_intv(cases_after_vax, risk_group) # intv
num_outcomes_intv <- calc_num_outcomes_intv(prob[1], prob[2], prob[3], prob[4]) # intv
cc_intv <- calc_total_cost_intv(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # intv
print(sprintf("total vax costs = %f", total_cost_vax_i))
print(sprintf("base cases = %f", b_cases))
print(sprintf("intv cases = %f", i_cases))
costs_519_low <- cc_intv[5]
cases_519_low <- i_cases
outcomes_519_low <- num_outcomes_intv[2:4]
icer_519_low <- calc_icer()
deaths_519_low <- calc_deaths_b()
```
###### 20-64 years ######
```{r}
pop <- pop_2064
num_cases <- base_2064
cases_after_vax <- intv_2064
vax_comp_i <- vc_2064
vax_comp_b <- bc_2064
```
## 20-64 years, HIGH
```{r}
risk_group <- high_2064
prob <- c(p_2064_high_death, p_2064_high_hosp, p_2064_high_out, p_2064_high_rest)
r_cost <- rc_2064_high
total_cost_vax_b <- calc_vaccination_cost(vax_comp_b) # base
total_cost_vax_i <- calc_vaccination_cost(vax_comp_i) # intv
costs <- cost_cpi_outcome(r_cost[1], r_cost[2], r_cost[3], r_cost[4])
b_cases <- calc_subpop_cases_base(num_cases, risk_group) # base
num_outcomes_base <- calc_num_outcomes_base(prob[1], prob[2], prob[3], prob[4]) # base
cc_base <- calc_total_cost_base(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # base
i_cases <- calc_subpop_cases_intv(cases_after_vax, risk_group) # intv
num_outcomes_intv <- calc_num_outcomes_intv(prob[1], prob[2], prob[3], prob[4]) # intv
cc_intv <- calc_total_cost_intv(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # intv
print(sprintf("total vax costs = %f", total_cost_vax_i))
print(sprintf("base cases = %f", b_cases))
print(sprintf("intv cases = %f", i_cases))
costs_2064_high <- cc_intv[5]
cases_2064_high <- i_cases
outcomes_2064_high <- num_outcomes_intv[2:4]
icer_2064_high <- calc_icer()
deaths_2064_high <- calc_deaths_b()
```
## 20-64 years, low risk
```{r}
risk_group <- 1-high_2064
prob <- c(p_2064_low_death, p_2064_low_hosp, p_2064_low_out, p_2064_low_rest)
r_cost <- rc_2064_low
total_cost_vax_b <- calc_vaccination_cost(vax_comp_b) # base
total_cost_vax_i <- calc_vaccination_cost(vax_comp_i) # intv
costs <- cost_cpi_outcome(r_cost[1], r_cost[2], r_cost[3], r_cost[4])
b_cases <- calc_subpop_cases_base(num_cases, risk_group) # base
num_outcomes_base <- calc_num_outcomes_base(prob[1], prob[2], prob[3], prob[4]) # base
cc_base <- calc_total_cost_base(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # base
i_cases <- calc_subpop_cases_intv(cases_after_vax, risk_group) # intv
num_outcomes_intv <- calc_num_outcomes_intv(prob[1], prob[2], prob[3], prob[4]) # intv
cc_intv <- calc_total_cost_intv(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # intv
print(sprintf("total vax costs = %f", total_cost_vax_i))
print(sprintf("base cases = %f", b_cases))
print(sprintf("intv cases = %f", i_cases))
costs_2064_low <- cc_intv[5]
cases_2064_low <- i_cases
outcomes_2064_low <- num_outcomes_intv[2:4]
icer_2064_low <- calc_icer()
deaths_2064_low <- calc_deaths_b()
```
###### 65+ years ######
```{r}
pop <- pop_65
num_cases <- base_65
cases_after_vax <- intv_65
vax_comp_i <- vc_65
vax_comp_b <- bc_65
```
## 65+ years, HIGH
```{r}
risk_group <- high_65
prob <- c(p_65_high_death, p_65_high_hosp, p_65_high_out, p_65_high_rest)
r_cost <- rc_65_high
total_cost_vax_b <- calc_vaccination_cost(vax_comp_b) # base
total_cost_vax_i <- calc_vaccination_cost(vax_comp_i) # intv
costs <- cost_cpi_outcome(r_cost[1], r_cost[2], r_cost[3], r_cost[4])
b_cases <- calc_subpop_cases_base(num_cases, risk_group) # base
num_outcomes_base <- calc_num_outcomes_base(prob[1], prob[2], prob[3], prob[4]) # base
cc_base <- calc_total_cost_base(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # base
i_cases <- calc_subpop_cases_intv(cases_after_vax, risk_group) # intv
num_outcomes_intv <- calc_num_outcomes_intv(prob[1], prob[2], prob[3], prob[4]) # intv
cc_intv <- calc_total_cost_intv(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # intv
print(sprintf("total vax costs = %f", total_cost_vax_i))
print(sprintf("base cases = %f", b_cases))
print(sprintf("intv cases = %f", i_cases))
costs_65_high <- cc_intv[5]
cases_65_high <- i_cases
outcomes_65_high <- num_outcomes_intv[2:4]
icer_65_high <- calc_icer()
deaths_65_high <- calc_deaths_b()
```
## 65+ years, low risk
```{r}
risk_group <- 1-high_65
prob <- c(p_65_low_death, p_65_low_hosp, p_65_low_out, p_65_low_rest)
r_cost <- rc_65_low
total_cost_vax_b <- calc_vaccination_cost(vax_comp_b) # base
total_cost_vax_i <- calc_vaccination_cost(vax_comp_i) # intv
costs <- cost_cpi_outcome(r_cost[1], r_cost[2], r_cost[3], r_cost[4])
b_cases <- calc_subpop_cases_base(num_cases, risk_group) # base
num_outcomes_base <- calc_num_outcomes_base(prob[1], prob[2], prob[3], prob[4]) # base
cc_base <- calc_total_cost_base(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # base
i_cases <- calc_subpop_cases_intv(cases_after_vax, risk_group) # intv
num_outcomes_intv <- calc_num_outcomes_intv(prob[1], prob[2], prob[3], prob[4]) # intv
cc_intv <- calc_total_cost_intv(r_cost[1],r_cost[2],r_cost[3],r_cost[4]) # intv
print(sprintf("total vax costs = %f", total_cost_vax_i))
print(sprintf("base cases = %f", b_cases))
print(sprintf("intv cases = %f", i_cases))
costs_65_low <- cc_intv[5]
cases_65_low <- i_cases
outcomes_65_low <- num_outcomes_intv[2:4]
icer_65_low <- calc_icer()
deaths_65_low <- calc_deaths_b()
```