Package {CEACT}


Type: Package
Title: Cost-Effectiveness Analysis Toolkit for Clinical Trials
Version: 0.5.0
Author: Imad EL BADISY [aut, cre]
Maintainer: Imad EL BADISY <elbadisyimad@gmail.com>
Description: Provides tools for trial-based economic evaluation of healthcare interventions. Computes and visualizes incremental cost-effectiveness ratios, cost-effectiveness acceptability curves, cost-effectiveness planes, net monetary benefit tables, and one-way deterministic sensitivity analyses. Supports cost-utility analyses using observed summaries and non-parametric bootstrap uncertainty.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.3
URL: https://github.com/ielbadisy/CEACT
BugReports: https://github.com/ielbadisy/CEACT/issues
Depends: R (≥ 3.5.0)
Imports: ggplot2, boot
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2026-06-08 19:28:28 UTC; imad-el-badisy
Repository: CRAN
Date/Publication: 2026-06-16 20:00:02 UTC

Bootstrap Incremental Cost, Effect, ICER, and Net Benefit

Description

Performs non-parametric stratified bootstrap resampling for a two-arm trial-based economic evaluation. Resampling is stratified by trial group to preserve arm sizes.

Usage

boot_icer(formula, data, ref, R = 1000, ci.type = "bca", na.omit = TRUE)

Arguments

formula

A formula of the form cost + effect ~ group.

data

A data frame containing the variables in the formula.

ref

Reference group label.

R

Number of bootstrap replications.

ci.type

Confidence interval type passed to boot::boot.ci().

na.omit

Logical; whether to remove rows with missing values.

Value

An object of class boot_icer containing a summary table, bootstrap distribution, observed estimates, formula, reference group, and matched call.

Examples

df <- simulate_ce_trial(n = 100, seed = 123)
res <- boot_icer(cost + effect ~ group, data = df, ref = "control", R = 200)
summary(res)


Cost-Effectiveness Analysis Summary for a Two-Arm Trial

Description

Computes observed cost-effectiveness summaries comparing one treatment group with one reference group. The incremental cost-effectiveness ratio is ICER = (mean(cost_treatment) - mean(cost_reference)) / (mean(effect_treatment) - mean(effect_reference)).

Usage

cea(formula, data, ref, na.omit = TRUE)

Arguments

formula

A formula of the form cost + effect ~ group.

data

A data frame containing the variables used in the formula.

ref

Character string specifying the reference group.

na.omit

Logical; whether to remove rows with missing values.

Value

An object of class cea, a data frame with group means, standard deviations, differences, confidence intervals, and p-values. Attributes include ICER, delta_cost, delta_effect, formula, ref, and call.

Examples

df <- simulate_ce_trial(n = 100, seed = 123)
res <- cea(cost + effect ~ group, data = df, ref = "control")
summary(res)


Compute Net Monetary Benefit and CEAC Table

Description

Computes expected incremental net monetary benefit (INMB) and the probability that treatment is cost-effective across willingness-to-pay thresholds. For a two-arm trial, INMB(k) = k * DeltaEffect - DeltaCost.

Usage

compute_nmb_ceac(
  x,
  data = NULL,
  wtp_range = seq(0, 1e+05, 1000),
  ref = NULL,
  R = 1000,
  ...
)

Arguments

x

Either a boot_icer object or a formula of the form cost + effect ~ group.

data

Data frame required when x is a formula.

wtp_range

Numeric vector of willingness-to-pay thresholds.

ref

Reference group label required when x is a formula.

R

Number of bootstrap replications used when x is a formula.

...

Additional arguments passed to boot_icer() for formula input.

Value

An object of class "nmb_ceac" with columns WTP, ENMB, and Prob_CE.

Examples

df <- simulate_ce_trial(n = 100, seed = 123)
ceac_tbl <- compute_nmb_ceac(cost + effect ~ group, data = df,
                             ref = "control", R = 200,
                             wtp_range = seq(0, 50000, 5000))
head(ceac_tbl)


Deterministic Sensitivity Analysis for ICER or INMB

Description

Varies one treatment-arm parameter while holding observed reference-arm data fixed, then recomputes the ICER or incremental net monetary benefit.

Usage

dsa_icer(formula, data, param, range, ref, metric = "ICER", k = 1000)

Arguments

formula

A formula of the form cost + effect ~ group.

data

A data frame.

param

Name of the variable to vary, usually the cost or effect variable from formula.

range

Numeric vector of values assigned to the treatment arm.

ref

Reference group label.

metric

Either "ICER" or "INMB". "NMB" is accepted as an alias for "INMB".

k

Willingness-to-pay threshold used for INMB.

Value

A data frame with varied parameter values and resulting metric.

Examples

df <- simulate_ce_trial(n = 100, seed = 123)
dsa <- dsa_icer(cost + effect ~ group, data = df, param = "effect",
                range = seq(0.74, 0.82, 0.02), ref = "control",
                metric = "INMB", k = 20000)
head(dsa)

Plot Cost-Effectiveness Acceptability Curve

Description

Plots the probability that treatment is cost-effective across willingness-to-pay thresholds.

Usage

plot_ceac(
  x,
  data = NULL,
  wtp_range = seq(0, 1e+05, 1000),
  ref = NULL,
  R = 1000,
  ...
)

Arguments

x

A boot_icer object, nmb_ceac object, or formula of the form cost + effect ~ group.

data

Data frame required when x is a formula.

wtp_range

Numeric vector of willingness-to-pay thresholds.

ref

Reference group label required when x is a formula.

R

Number of bootstrap replications used when x is a formula.

...

Additional arguments passed to ggplot2::labs().

Value

A ggplot object.

Examples

df <- simulate_ce_trial(n = 100, seed = 123)
res <- boot_icer(cost + effect ~ group, data = df, ref = "control", R = 200)
plot_ceac(res, wtp_range = seq(0, 50000, 5000))

Plot Cost-Effectiveness Plane

Description

Visualizes bootstrap replicates of incremental cost and incremental effect.

Usage

plot_ceplane(boot_icer_result, k = NULL, subtitle = NULL)

Arguments

boot_icer_result

A boot_icer object from boot_icer().

k

Optional willingness-to-pay threshold shown as a straight line with slope k.

subtitle

Optional subtitle text.

Value

A ggplot object.

Examples

df <- simulate_ce_trial(n = 100, seed = 123)
res <- boot_icer(cost + effect ~ group, data = df, ref = "control", R = 200)
plot_ceplane(res, k = 20000)

One-Way Deterministic Sensitivity Plot

Description

Creates a one-way sensitivity plot from a data frame generated by dsa_icer().

Usage

plot_dsa(df, metric = "ICER")

Arguments

df

A data frame from dsa_icer().

metric

Character string. Either "ICER" or "INMB".

Value

A ggplot object.

Examples

df <- simulate_ce_trial(n = 100, seed = 123)
dsa <- dsa_icer(cost + effect ~ group, data = df, param = "effect",
                range = seq(0.74, 0.82, 0.02), ref = "control")
plot_dsa(dsa, metric = "ICER")

Deprecated Tornado Plot Alias

Description

plot_tornado() is kept for backward compatibility. Use plot_dsa() instead. The plot produced by CEACT is a one-way deterministic sensitivity curve, not a conventional tornado plot.

Usage

plot_tornado(df, metric = "ICER")

Arguments

df

A data frame from dsa_icer().

metric

Character string. Either "ICER" or "INMB".

Value

A ggplot object.


Simulate a Two-Arm Trial for Cost-Effectiveness Analysis

Description

Generates individual-level cost and effect outcomes for a simple two-arm randomized clinical trial. The function is intended for examples, tutorials, tests, and manuscript demonstrations.

Usage

simulate_ce_trial(
  n = 200,
  mean_cost = c(5000, 5600),
  sd_cost = c(900, 1000),
  mean_effect = c(0.72, 0.78),
  sd_effect = c(0.1, 0.11),
  rho = 0.15,
  seed = NULL,
  group_names = c("control", "treatment")
)

Arguments

n

Number of participants per arm.

mean_cost

Control and treatment mean costs.

sd_cost

Control and treatment cost standard deviations.

mean_effect

Control and treatment mean effects, for example QALYs.

sd_effect

Control and treatment effect standard deviations.

rho

Within-person cost-effect correlation used in a Gaussian construction.

seed

Optional random seed.

group_names

Character vector naming control and treatment arms.

Value

A data frame with cost, effect, and group.

Examples

trial <- simulate_ce_trial(n = 50, seed = 1)
head(trial)

Example Trial-Based Cost-Effectiveness Dataset

Description

A patient-level clinical-trial cost-effectiveness dataset with treatment assignment, total cost, QALYs, and baseline covariates. The dataset is used in teaching examples for trial-based economic evaluation and was described as being provided by the Health Services Research Unit for the textbook Economic Evaluation in Clinical Trials.

Usage

trial_cea

Format

A data frame with 500 rows and 10 variables:

id

Patient identifier.

treat

Treatment indicator, 1 for treatment and 0 for control.

cost

Total cost in US dollars.

qaly

Quality-adjusted life-years.

dissev

Disease severity, ranging approximately from 0.025 to 0.729.

race

Race indicator as supplied in the source dataset.

blcost

Baseline cost in US dollars.

blqaly

Baseline QALY.

male

Sex indicator, 1 for male and 0 for female.

group

Factor version of treat, with levels control and treatment.

Source

Health Services Research Unit example dataset used in Glick HA, Doshi JA, Sonnad SS, Polsky D. Economic Evaluation in Clinical Trials. Oxford University Press. Also distributed in the ceaR package as clintrial_cea.