# Coding the Cost Effectiveness Acceptance Curve (CEAC) in R R Bloggers

Introduction

The cost-effectiveness acceptance curve (CEAC) is a tool used to describe the output of a probabilistic sensitivity analysis performed on models used in the economic evaluation of health technologies. It communicates the probability of cost effectiveness conditional on our willingness to pay the threshold to obtain each unit of effectiveness or QALY. While this blog post will not provide the best treatment of the theory behind CEACs, it will provide you with some information on how to calculate them in R.

Preliminary: Simulating cost-effectiveness data.

For the calculation of CEAC, I have chosen to simulate data on 2000 treated and untreated patients (1000 in each group). If you are working with (real) patient level data using a pure benefit regression framework would be more appropriate, but we can view this crude simulation as a communication of the output from some probabilistic sensitivity analysis of a model Are. While the seed is not required to be set, it helps to replicate the picture you see above.

I have also included the code for the CE aircraft which is production

# load package library(‘ggplot2’) library(‘ggthemes’) # set seed. simulation cost control_cost<-rnorm(1000,1000,200) treatment_cost<-rnorm(1000,1500,200) #create incremental cost D_cost<-treatment_cost-control_cost D_QALYs<-treatment_QALYs-control_QALYs #CE data CE data<-data.frame( D_Costs,D_QALYs) #plot CE plane ggplot(CEdata,aes(y=D_Costs))+ geom_point(aes(x=D_QALYs),color="blue")+ geom_vline(xintercept=0,size=1)+ geom_hline(yintercept =0,size=1)+ xlim(-1,1)+ xlab("incremental QALYs")+ ylab("incremental cost")+ ggtitle("CE plain")

CEAC Coding

To actually code your CEAC we need to convert the measures of incremental costs and impacts into incremental net benefits. I do this by first creating a list of willingness to pay thresholds that we will consider, creating an array to store the data and then using a loop to populate this array

#Create threshold vector T_Names<-c("T0","T5000","T10000","T15000","T20000","T250000") threshold<-c(0,5000,10000,15000,20000,25000) #Create Dataframe id<-seq(1,1000) df<-matrix(NA,nrow=1000,ncol=6,dimnames=list(NA,WTP=T_Names)) #For loop for Incremental Net Benefits calculation for (i in 1:6)[,i]=0)/1000 Prob_CE5k<-sum(df[,2]>=0)/1000 Prob_CE10k<-sum(df[,3]>=0)/1000 Prob_CE15k<-sum(df[,4]>=0)/1000 Prob_CE20k<-sum(df[,5]>=0)/1000 Prob_CE25k<-sum(df[,6]>=0)/1000 #StoreValues ​​Prob_CE<-c(ProbCE_0,Prob_CE5k,Prob_CE10k,Prob_CE15k,Prob_CE20k,Prob_CE25k) #CEAC Dataframe CEAC_Data<-data.frame(Threshold,Prob_CE) CEAC_Data #Plot CEAC ggplot(CEAC_Data, aes( y) =Prob_CE))+ geom_line(aes(x=threshold),color="blue",size=1.0)+ geom_point(aes(x=threshold),color="black", size=2.0)+ ylim(0 ,1 )+ xlab("willingness to pay per QALY")+ ylab("likelihood of CE")+ ggtitle("The cost-effectiveness acceptability curve")+ theme_economist_white() closing remarks

This blog post has demonstrated a way to calculate the cost-effectiveness acceptance curve in R from scratch. There is likely a better way to calculate each probability of cost effectiveness at each threshold as a loop but the simplest solution is to calculate each probability directly.

Connected