-
Notifications
You must be signed in to change notification settings - Fork 0
/
07_CEA_5yr_ICER.Rmd
108 lines (78 loc) · 3.21 KB
/
07_CEA_5yr_ICER.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
---
title: "CEA anticoag"
author: "Emily O'Neill, Andrew Huang"
date: "2023-06-08"
output: html_document
---
```{r}
##remove any variables in R's Memory
rm(list = ls())
##Install packages for Markov Model
library(here)
library(tidyverse)
# Load functions
source(here::here("functions", "function_create-sa.R"))
source(here::here("functions", "function_make-psa-obj.R"))
source(here::here("functions", "function_summary-psa.R"))
source(here::here("functions", "function_plot-psa.R"))
```
Read-in base case results for riv and war
```{r}
sim_results_war_noMC <- readRDS(here::here("output","results_5yr_war_noMC.rds"))
sim_results_riv_noMC <- readRDS(here::here("output","results_5yr_riv_noMC.rds"))
```
Calculate ICER for base case
```{r}
###CEA
##Store the estimated cost of each medication
v.c <- c(sim_results_war_noMC$tc_hat,
sim_results_riv_noMC$tc_hat)
##store the estimated QALY of each medication
v.e <- c(sim_results_war_noMC$te_hat,
sim_results_riv_noMC$te_hat)
## ICER ##
delta.c <- v.c[2] - v.c[1] # calculate incremental costs between rivaroxaban and warfarin
delta.e <- v.e[2] - v.e[1] # calculate incremental QALYs between rivaroxaban and warfarin
ICER <- delta.c / delta.e # calculate the ICER
results <- c(delta.c, delta.e, ICER) # store the values in a new variable
# Create full incremental cost-effectiveness analysis table
table_markov <- data.frame(
round(v.c, 0), # costs per arm
round(v.e, 4), # health outcomes per arm
c("", round(delta.c, 0)), # incremental costs
c("", round(delta.e, 4)), # incremental QALYs
c("", round(ICER, 0)) # ICER
)
rownames(table_markov) = c("Warfarin", "Rivaroxaban") # name the rows
colnames(table_markov) = c("Costs", "QALYs","Incremental Costs", "QALYs Gained", "ICER") # name the columns
table_markov # print the table
```
Read-in MC simulation results for riv and war
```{r}
sim_results_war <- readRDS(here::here("output","results_5yr_war.rds"))
sim_results_riv <- readRDS(here::here("output","results_5yr_riv.rds"))
sim_results_war_param <- sim_results_war %>% select(v.cost, v.util, pr.ne_ne, pr.ne_vr, pr.ne_mb, pr.ne_nmb, pr.mb_ot, pr.nmb_ot)
sim_results_riv_param <- sim_results_riv %>% select(v.cost, v.util, pr.ne_ne, pr.ne_vr, pr.ne_mb, pr.ne_nmb, pr.mb_ot, pr.nmb_ot)
```
Calculate ICERs for MC simulations
```{r}
sim_results_cost <- data.frame(war = sim_results_war$tc_hat,
riv = sim_results_riv$tc_hat)
sim_results_effectiveness <- data.frame(war = sim_results_war$te_hat,
riv = sim_results_riv$te_hat)
psa <- make_psa_obj(cost = sim_results_cost, effectiveness = sim_results_effectiveness, parameters = NULL,
strategies = c("Warfarin", "Rivaroxaban"), currency = "$", other_outcome = NULL)
# Save psa object
saveRDS(psa, here::here("output","results_5yr_psa.rds"))
# See mean ICER
summary.psa(psa, calc_sds=TRUE)
```
Distribution of ICER estimates
```{r}
plot.psa(psa) +
ggthemes::scale_color_colorblind() +
ggthemes::scale_fill_colorblind() +
xlab("Effectiveness (QALYs)") +
guides(col = guide_legend(nrow = 2)) +
theme(legend.position = "right")
```