Skip to contents

Builds a voi_problem by sampling outcomes from distributions rather than from a fixed matrix. States are represented by Monte Carlo samples.

Usage

voi_problem_from_dist(
  action_fns,
  p_prior = NULL,
  n_samples = 10000L,
  val_min = NULL,
  val_max = NULL,
  p_posterior_fns = NULL,
  pp = NULL,
  verbose = FALSE
)

Arguments

action_fns

A named list of functions, one per action. Each function takes a single argument n and returns n sampled outcomes from that action's outcome distribution. Names become row names of V.

p_prior

Numeric vector of state probabilities, OR NULL if using continuous distributions (in which case equal weights are used).

n_samples

Integer. Number of Monte Carlo samples per action (default 10000).

val_min

Numeric. Minimum plausible outcome (for range-coverage check).

val_max

Numeric. Maximum plausible outcome (for range-coverage check).

p_posterior_fns

Optional: named list of lists, one per experiment outcome. Each entry is a list of action functions as in action_fns, representing the outcome distribution after observing that result. Used for EVPXI/EVSI.

pp

Numeric vector of experiment outcome probabilities (same length as p_posterior_fns). Ignored if p_posterior_fns is NULL.

verbose

Logical. If TRUE, prints a note explaining the equal-weight approximation used when p_posterior_fns is supplied. Default FALSE.

Value

A voi_problem object with matrix V built from sample means.

Limitations

When p_posterior_fns is supplied, the posterior probability matrix is approximated using equal weights over the prior samples. For an exact EVPXI calculation, derive the posterior probabilities analytically and supply them directly to voi_problem().