Getting Started with voiageR

Overview

voiageR is the thin R interface to the voiage Python library. It exposes the stable EVPI, EVPPI, and EVSI wrappers while keeping the package surface small, predictable, and suitable for scripted use.

The examples below are intentionally non-interactive. They show the package shape, the Python environment setup, and the canonical data contracts without requiring the vignette build to depend on a live Python session.

Set up the Python environment

library(voiageR)

set_voiage_env("voiage", type = "virtualenv")
init_voiage()

If you manage Python through Conda, use:

set_voiage_env("voiage", type = "conda")

EVPI

net_benefits <- matrix(
  c(10.0, 12.0, 11.0, 9.0, 13.0, 14.0),
  nrow = 3,
  byrow = TRUE,
  dimnames = list(NULL, c("Strategy A", "Strategy B"))
)

evpi(net_benefits)

EVPPI

parameter_samples <- list(
  effect = c(0.10, 0.12, 0.11),
  cost = c(1000, 980, 1025)
)

evppi(net_benefits, parameter_samples, parameters_of_interest = "effect")

EVSI

model_func <- function(params) {
  cbind(
    Treatment = 50000 * params$mean_treatment - 3000,
    Control = 50000 * params$mean_control
  )
}

set.seed(17)
draws <- 1000L
prior_samples <- list(
  mean_treatment = rnorm(draws, mean = 0.06, sd = 0.03),
  mean_control = rnorm(draws, mean = 0.00, sd = 0.02),
  sd_outcome = rep(1.0, draws)
)

trial_design <- list(
  arms = list(
    list(name = "Treatment", sample_size = 100L),
    list(name = "Control", sample_size = 100L)
  )
)

evsi(
  model_func,
  prior_samples,
  trial_design,
  method = "two_loop",
  n_outer_loops = 100L,
  n_inner_loops = 1000L,
  seed = 20260724L
)

The built-in model expects one mean_<normalised arm> parameter for every trial arm. It lowercases each arm name and replaces spaces with underscores. sd_outcome is the known outcome standard deviation and is fixed across the prior draws.

Custom trial-simulation and posterior-sampling callbacks remain Python-only. The R facade does not convert or execute those callbacks and does not claim custom-model parity.

Current wrapper surface

The current R package exports the core analysis wrappers:

  • evpi() for expected value of perfect information
  • evppi() for expected value of partial perfect information
  • evsi() for expected value of sample information (built-in two-loop model and estimators)
  • enbs() for expected net benefit of sampling

Build outputs

The package ships a deterministic PDF manual build helper at tools/build-manual.R. It is designed for non-interactive use from the package root and produces a stable manual artifact from the package Rd files for release packaging and local verification.