This tutorial has been written by Gianluca Baio and Nathan Green, University College London


BCEA is a package designed to post-process the result of a Bayesian health economic evaluation. It is based on a simulation approach to Probabilistic Sensitivity Analysis [PSA; Baio and Dawid (2011)]. The package is made by a main function bcea, which takes as input the simulations for the pair (e,c), indicating the population average benefits and costs. bcea process the simulations to create relevant PSA summaries and then has a set of other functions to visualise and analyse the output in a standardised way.


There are two ways of installing BCEA. Details can be found below.

A “stable” version (currently 2.3-1.1) is packaged and available from CRAN. So you can simply type on your R terminal


to install it.


Alternatively, a “development” version can be installed from the GitHub repository. This will usually be updated more frequently and may be continuously tested. On Windows machines, you need to install a few dependencies, including Rtools first, e.g. by running

pkgs <- c("MASS","Rtools","devtools")
repos <- c("https://cran.rstudio.com", "https://inla.r-inla-download.org/R/stable")
install.packages(pkgs,repos=repos,dependencies = "Depends")

before installing the package using devtools:


Under Linux or MacOS, it is sufficient to install the package via devtools:


More details on BCEA are available in the textbooks: Bayesian Cost-Effectiveness Analysis with the R Package BCEA [published in the UseR! Springer series; Baio, Berardi, and Heath (2017)]. Also, details about the package, including some references and links to a pdf presentation and some posts) are given here.

Example: Vaccine

Consider an infectious disease, for instance influenza, for which a new vaccine has been produced. Under the current management of the disease some individuals treat the infection by taking over the counter (OTC) medications. Some subjects visit their GP and, depending on the gravity of the infection, may receive treatment with antiviral drugs, which usually cure the infection. However, in some cases complications may occur. Minor complications will need a second GP visit after which the patients become more likely to receive antiviral treatment. Major complications are represented by pneumonia and can result in hospitalisation and possibly death. In this scenario, the costs generated by the management of the disease are represented by OTC medications, GP visits, the prescription of antiviral drugs, hospital episodes and indirect costs such as time off work. The focus is on the clinical and economic evaluation of the policy that makes the vaccine available to those who wish to use it ($t=1$) against the null option ($t=0$) under which the vaccine will remain unavailable. More details of this example can be found in Baio and Dawid (2011) and references therein.

In a population made up of \(N\) individuals, consider the number of patients taking up the vaccine when available \(V_1 \sim \mbox{Binomial}(\phi,N)\) where \(\phi\) is the vaccine coverage rate. Obviously, \(V_0=0\) as the vaccine is not available in the status quo. For convenience, we denote the total number of patients in the two groups, vaccinated ($v=1$) and non-vaccinated ($v=0$), by \(n_{tv}\) with \(n_{t1}:=V_t\) and \(n_{t0}:=N-V_t\) respectively.

The relevant clinical are \(j=1\): influenza infection; \(j=2\): GP visit; \(j=3\): minor complications; \(j=4\): major complications; \(j=5\): hospitalisation; \(j=6\): death; and \(j=7\): adverse events of influenza vaccination. For each clinical outcome \(j\), \(\beta_j\) is its baseline rate of occurrence and \(\rho_{v}\) is the proportional reduction due to the vaccine in the chance of infection. Vaccinated patients ($v=1$) will experience a reduction in the chance of infection by a factor \(\rho_1\); conversely, for \(v=0\), individuals are not vaccinated and so the chance of infection is just the attack rate \(\beta_1\). This is equivalent to setting \(\rho_0:=0\).

Under these assumptions, the number of individuals becoming infected in each group is \(I_{tv}\sim\mbox{Binomial}(\pi_v,n_{tv})\), where \(\pi_v := \beta_1(1-\rho_v)\) is the probability of infection. Among the infected subjects, the number visiting a GP for the first time is \(G\!P^{(1)}_{tv} \sim \mbox{Binomial}(\beta_2,I_{tv})\). Using a similar reasoning, among those who have had a GP visit, we can define: the number of individuals with minor complications \(G\!P^{(2)}_{tv} \sim \mbox{Binomial}(\beta_3,G\!P^{(1)}_{tv})\); the number of those with major complications \(P_{tv} \sim \mbox{Binomial}(\beta_4,G\!P^{(1)}_{tv})\); the number of hospitalisations \(H_{tv} \sim \mbox{Binomial}(\beta_5,G\!P^{(1)}_{tv})\); and the deaths \(D_{tv} \sim \mbox{Binomial}(\beta_6,G\!P^{(1)}_{tv})\). The number of individuals experiencing adverse events due to vaccination is computed as \(A\!E_{tv} \sim\mbox{Binomial}(\beta_7,n_{tv})\) — obviously, this will be identically 0 in the status quo ($t=0$) and among those individuals who choose not to take the vaccine up in the vaccination scenario ($t=1,v=0$).

The model also includes other parameters, such as the chance of receiving a prescription after the first GP visit ($\gamma_1$) or following minor complications ($\gamma_2$) for a number of antiviral drugs ($\delta$); of taking OTC medications ($\xi$); and of remaining off-work ($\eta$) for a number of days ($\lambda$). Combining these with the relevant populations at risk, we can then derive the expected number of individuals experiencing each of these events.

As for the costs, we consider the relevant as \(h=1\): GP visits; \(h=2\): hospital episodes; \(h=3\): vaccination; \(h=4\): time to receive vaccination; \(h=5\): days off work; \(h=6\): antiviral drugs; \(h=7\): OTC medications; \(h=8\): travel to receive vaccination. For each, we define \(\psi_h\) to represent the associated unit cost for which we assume informative lognormal distributions, a convenient choice to model positive, continuous variables such as costs.

Finally, we include in the model suitable parameters to represent the loss in quality of life generated by the occurrence of the clinical outcomes. Let \(\omega_j\) represent the QALYs lost when an individual experiences the \(j-\)th outcome. We assume that GP visits do not generate loss in QALYs and therefore set \(\omega_2=\omega_3:=0\); the remaining \(\omega_j\)’s are modelled using informative lognormal distributions.

The assumptions encoded by this model are that we consider a population parameter \(\boldsymbol\theta = (\boldsymbol\theta^0,\boldsymbol\theta^1)\), with the two components being defined as \(\boldsymbol\theta^0=(\beta_j,\gamma_1,\gamma_2,\delta,\xi,\eta,\lambda,\psi_h,\omega_j)\) and \(\boldsymbol\theta^1=(\phi,\beta_j,\rho_v,\gamma_1,\gamma_2,\delta,\xi,\eta,\lambda,\psi_h,\omega_j)\). We assume that the components of \(\boldsymbol\theta\) have the distributions specified in Table XXX. The distributions of Table XXX are derived by using suitable “hyper-parameters” that have been set to encode knowledge \(\mathcal{D}\) available from previous studies and expert opinion — cfr. Baio and Dawid (2011) for a more detailed discussion of this point.

In order to perform the economic analysis, we need to define suitable summary measures of cost and effectiveness. The total cost associated with each clinical resource can be computed by multiplying the unit cost \(\psi_h\) by the number of patients consuming it. For instance, the overall cost of GP visit is \(\left(G\!P^{(1)}_{tv}+G\!P^{(2)}_{tv}\right)\times \psi_1\). If, for convenience of terminology, we indicate with \(N_{tvh}\) the total number of individuals consuming the \(h-\)th resource under intervention \(t\) and in group \(v\), we can then extend this reasoning and compute the under intervention \(t\) as

Similarly, the total QALYs lost due to the occurrence of the relevant outcomes can be obtained by multiplying the number of individuals experiencing them by the weights \(\omega_j\). For example, the total number of QALYs lost to influenza infection can be computed as \(I_{tv}\times \omega_1\). If we let \(M_{tvj}\) indicate the number of subjects with the \(j-\)th outcome in intervention \(t\) and group \(v\), we can define the for intervention \(t\) as

## The BCEA version loaded is: 2.4.6

## Attaching package: 'BCEA'

## The following object is masked from 'package:graphics':
##     contour

This loads the PSA simulations for the population average benefits and costs, indicated as e and c, which can be visualised using the following command.

##         Status Quo   Vaccination Status Quo Vaccination
## [1,] -0.0010466668 -0.0008986026  10.409146   16.252537
## [2,] -0.0008836105 -0.0007320416   5.834875    9.373437
## [3,] -0.0008898137 -0.0006975327   5.784903   15.935623
## [4,] -0.0016430238 -0.0011393237  12.208484   18.654250
## [5,] -0.0013518841 -0.0009574948   9.786787   16.467321
## [6,] -0.0014325715 -0.0009358231   6.560276    9.689887

In this case, there are two interventions — one is the “Status Quo” and the other is the “Vaccination”, which is the one being assessed to evaluate its cost-effectiveness against the other option. The PSA samples are based on 1000 simulations — this can be easily checked by using the command

## [1] 1000

and note that the original inputs (in terms of PSA samples) can be either directly produced by R, or perhaps imported as the result of a bootstrap or Monte Carlo simulation performed in Microsoft Excel.

The main BCEA function is called bcea and it can be used to produce the basic PSA post-processing. The call is fairly simple, for example as in the following.

m = bcea(eff,cost,ref=2)

This produces an object m in which all the relevant output is stored:

##  [1] "n_sim"         "n_comparators" "n_comparisons" "delta_e"      
##  [5] "delta_c"       "ICER"          "Kmax"          "k"            
##  [9] "ceac"          "ib"            "eib"           "kstar"        
## [13] "best"          "U"             "vi"            "Ustar"        
## [17] "ol"            "evi"           "ref"           "comp"         
## [21] "step"          "interventions" "e"             "c"


Baio, G, A Berardi, and A Heath. 2017. Bayesian Cost-Effectiveness Analysis with the R Package BCEA. Springer. https://doi.org/10.1007/978-3-319-55718-2.

Baio, G, and AP Dawid. 2011. “Probabilistic Sensitivity Analysis in Health Economics.” Statistical Methods in Medical Research, September. https://doi.org/10.1177/0962280211419832.