Skip to main content
. Author manuscript; available in PMC: 2021 Nov 22.
Published in final edited form as: Med Decis Making. 2017 Jul 22;38(2):174–188. doi: 10.1177/0272989X17715627

Box 1.

Summary of the Steps and R Code for Computing EVSI Using Gaussian Approximation from a PSA Data Set for a Parameter of Interest θI from a New Sample n

1. Conduct probabilistic sensitivity analysis (PSA) and load the PSA data set.
library(mgcv); library(matrixStats)
psa <– read.csv(“example_psa_dataset.csv”)
n.sim <– nrow(psa) # number of simulations in psa
theta_I <– psa[, 1] # parameter of interest is column 1
nmb <– psa[, 5:7] # the strategies’ net monetary benefits are columns 5 through 7
2. Determine the optimal strategy d*.
d.star <– which.max(colMeans (nmb))
3. Compute the opportunity loss L(d, θ).
loss <– nmb – nmb[, d.star]
4. Estimate a linear metamodel for the opportunity loss of each d strategy, Ld, by regressing them on the spline basis functions of θI.
lmm1 <– gam(loss[, 1] ~ s(theta_I)
lmm2 <– gam(loss[, 2] ~ s(theta_I)
lmm3 <– gam(loss[, 3] ~ s(theta_I)
5. Compute EVPPI using the estimated losses for each d strategy, L^d, and applying equation (20).
Lhat <– cbind(lmm1$fitted, lmm2$fitted, lmm3$fitted) # estimated losses
evppi <– mean(rowMaxs(Lhat)) # evppi equation
6. Load the predict.ga function.
source(GA_functions.R)
7. Compute the predicted loss for each d strategy, L^d, given the prior sample size (n0) and new sample size (n).
Ltilde1 <– predict.ga(lmm1, n = n, n0 = n0)
Ltilde2 <– predict.ga(lmm2, n = n, n0 = n0)
Ltilde3 <– predict.ga(lmm3, n = n, n0 = n0)
loss.predicted <– cbind(Ltilde1, Ltilde2, Ltilde3)
8. Compute EVSI using equation (18)
evsi <– mean(rowMaxs(loss.predicted)) # evsi equation

Appendix B provides example R codes for implementing this approach when there are multiple parameters and unbalanced data collection study designs.