knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 6, fig.height = 4 )
library(BCEA)
There are several arguments passed to bcea()
to specify the form of the analysis.
These are
bcea(eff, cost, ref = 1, interventions = NULL, .comparison = NULL, Kmax = 50000, wtp = NULL, plot = FALSE)
Those of interest here are:
ref
is the reference intervention group to compare against the other groups..comparisons
are the groups to compare against ref
. The default is all of the non-ref
groups.
This is a new argument in the latest release of BCEA to make it more flexible and consistent with other functions.
A preceding dot is used to keep it back-compatible with previous versions of BCEA.
Argument c
is partially matched with both c
and comparison
otherwise throwing an error.Kmax
is the maximum value of the willingness-to-pay to calculate statistics for.During an analysis we may want to explore changing some of these parameters and keeping all of the others the same. We can do with with package setter functions.
Load cost-effectiveness data.
data(Vaccine)
We first create bcea
object using the constructor function for 2 different reference groups.
he_ref1 <- bcea(eff, cost, ref = 1, interventions = treats, Kmax = 50000) str(he_ref1) ceplane.plot(he_ref1)
he_ref2 <- bcea(eff, cost, ref = 2, interventions = treats, Kmax = 50000) str(he_ref2[c("n_comparators", "ICER", "ref", "comp")])
Alternatively, we can do the same by modifying the first output.
setReferenceGroup(he_ref1) <- 2 str(he_ref1[c("n_comparators", "ICER", "ref", "comp")])
In the same way as above we can change Kmax
in 2 equivalent ways.
he_Kmax1 <- bcea(eff, cost, ref = 1, interventions = treats, Kmax = 50000) str(he_Kmax1[c("n_comparators", "ICER", "ref", "comp", "Kmax")])
he_Kmax2 <- bcea(eff, cost, ref = 2, interventions = treats, Kmax = 2000) str(he_Kmax2[c("n_comparators", "ICER", "ref", "comp", "Kmax")])
setKmax(he_Kmax1) <- 2000 str(he_Kmax1[c("n_comparators", "ICER", "ref", "comp", "Kmax")])
Lets load some data with more than two groups.
data(Smoking)
Defaults is all other groups which in this case is 2, 3 and 4.
he_comp234 <- bcea(eff, cost, ref = 1, interventions = treats, Kmax = 50000) str(he_comp234[c("n_comparators", "ICER", "ref", "comp")]) ceplane.plot(he_comp234, wtp = 2000)
Let us compare against only groups 2.
he_comp2 <- bcea(eff, cost, ref = 1, .comparison = 2, interventions = treats, Kmax = 2000) str(he_comp2[c("n_comparators", "ICER", "ref", "comp")]) ceplane.plot(he_comp2, wtp = 2000)
We can achieve the same thing using the appropriate setter.
setComparisons(he_comp234) <- 2 str(he_comp234[c("n_comparators", "ICER", "ref", "comp")]) ceplane.plot(he_comp234, wtp = 2000)
We can select multiple comparison groups too. Let us compare against only groups 2 and 4.
he_comp24 <- bcea(eff, cost, ref = 1, .comparison = c(2,4), interventions = treats, Kmax = 2000) str(he_comp24[c("n_comparators", "ICER", "ref", "comp")]) ceplane.plot(he_comp24, wtp = 2000)
setComparisons(he_comp234) <- c(2,4) str(he_comp234[c("n_comparators", "ICER", "ref", "comp")]) ceplane.plot(he_comp24, wtp = 2000)
Further, a bcea
object with all comparison groups can be passed to other functions such as ceplane.plot
and ceac.plot
with a comparison
argument,
which will do the modifications using these functions internally instead.
ceplane.plot(he_comp234, comparison = 2, wtp = 2000) ceplane.plot(he_comp234, comparison = c(2,4), wtp = 2000)
# create output docs # rmarkdown::render(input = "vignettes/Set_bcea_parameters.Rmd", output_format = "pdf_document", output_dir = "vignettes") # rmarkdown::render(input = "vignettes/Set_bcea_parameters.Rmd", output_format = "html_document", output_dir = "vignettes")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.