--- title: "Cost-effectiveness plane" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Cost-effectiveness plane} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 6 ) ``` ```{r setup, results='hide', message=FALSE, warning=FALSE, echo=FALSE} library(BCEA) library(dplyr) library(reshape2) library(ggplot2) library(purrr) ``` ##TODO... ## Introduction The intention of this vignette is to show how to plot different styles of cost-effectiveness acceptability curves using the BCEA package. #### R code To calculate these in BCEA we use the `bcea()` function. ```{r} data("Vaccine") he <- bcea(eff, cost) ``` The plot defaults to base R plotting. Type of plot can be set explicitly using the `graph` argument. ```{r} ceplane.plot(he, graph = "base") ceplane.plot(he, graph = "ggplot2") # ceac.plot(he, graph = "plotly") ``` Other plotting arguments can be specified such as title, line colours and theme. ```{r} ceplane.plot(he, graph = "ggplot2", title = "my title", line = list(color = "green", size = 3), point = list(color = "blue", shape = 10, size = 5), icer = list(color = "orange", size = 5), area = list(fill = "grey"), theme = theme_linedraw()) ``` If you only what the mean point then you can suppress the sample points by passing size `NA`. ```{r} ceplane.plot(he, graph = "ggplot2", point = list(size = NA), icer = list(size = 5)) ``` ## Multiple interventions This situation is when there are more than two interventions to consider. #### R code ```{r} data("Smoking") he <- bcea(eff, cost, ref = 4) # str(he) ``` ```{r} ceplane.plot(he) ceplane.plot(he, graph = "ggplot2") ``` ```{r} ceplane.plot(he, graph = "ggplot2", title = "my title", line = list(color = "red", size = 1), point = list(color = c("plum", "tomato", "springgreen"), shape = 3:5, size = 2), icer = list(color = c("red", "orange", "black"), size = 5)) ``` Reposition legend. ```{r} ceplane.plot(he, pos = FALSE) # bottom right ceplane.plot(he, pos = c(0, 0)) ceplane.plot(he, pos = c(0, 1)) ceplane.plot(he, pos = c(1, 0)) ceplane.plot(he, pos = c(1, 1)) ``` ### Willingness-to-pay label For `{ggplot2}` ```{r} ceplane.plot(he, graph = "ggplot2") # default ceplane.plot(he, graph = "ggplot2", wtp = 10000) ceplane.plot(he, graph = "ggplot2", wtp = list(value = 10000)) ceplane.plot(he, graph = "ggplot2", wtp = list(value = 10000, colour = "blue")) ceplane.plot(he, graph = "ggplot2", wtp = list(colour = "blue")) ceplane.plot(he, graph = "ggplot2", wtp = list(y = 8)) ceplane.plot(he, graph = "ggplot2", wtp = list(size = 5)) # to hide text ceplane.plot(he, graph = "ggplot2", wtp = list(size = 0)) ``` For base `R` ```{r} ceplane.plot(he) # default ##TODO: not yet implemented # ceplane.plot(he, wtp = 10000) # ceplane.plot(he, wtp = list(value = 10000)) # ceplane.plot(he, wtp = list(value = 10000, colour = "blue")) # ceplane.plot(he, wtp = list(colour = "blue")) # ceplane.plot(he, wtp = list(y = 8)) # ceplane.plot(he, wtp = list(size = 5)) # # # to hide text # ceplane.plot(he, wtp = list(size = 0)) ```