0% found this document useful (0 votes)
92 views45 pages

Dampack Analysis

This document describes the dampack package version 1.0.1. The dampack package provides functions for analyzing and visualizing outputs from health economic models. It was developed with funding from the National Institutes of Health. The package allows calculation of important metrics like incremental cost-effectiveness ratios, value of information measures, and supports probabilistic sensitivity analysis of health economic models. It contains functions for generating samples from different probability distributions as well as visualization of cost-effectiveness and value of information analyses.

Uploaded by

ratno widoyo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views45 pages

Dampack Analysis

This document describes the dampack package version 1.0.1. The dampack package provides functions for analyzing and visualizing outputs from health economic models. It was developed with funding from the National Institutes of Health. The package allows calculation of important metrics like incremental cost-effectiveness ratios, value of information measures, and supports probabilistic sensitivity analysis of health economic models. It contains functions for generating samples from different probability distributions as well as visualization of cost-effectiveness and value of information analyses.

Uploaded by

ratno widoyo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Package ‘dampack’

October 13, 2022


Type Package
Title Decision-Analytic Modeling Package
Version 1.0.1
Description A suite of functions for analyzing and visualizing the health economic outputs of mathe-
matical models.
This package was developed with funding from the National Institutes of Allergy and Infec-
tious Diseases of the
National Institutes of Health under award no. R01AI138783. The content of this pack-
age is solely the
responsibility of the authors and does not necessarily represent the official views of the Na-
tional Institutes
of Health. The theoretical underpinnings of 'dampack''s functionality are de-
tailed in Hunink et al. (2014)
<doi:10.1017/CBO9781139506779>.
License GPL-3

URL https://github.com/DARTH-git/dampack

BugReports https://github.com/DARTH-git/dampack/issues
Encoding UTF-8
Depends R (>= 3.5), ggplot2 (>= 3.3.0)
Imports reshape2, ellipse, dplyr, scales, stringr, mgcv, truncnorm,
triangle, ggrepel
Suggests testthat, lintr, knitr, rmarkdown, kableExtra
LazyData true
RoxygenNote 7.1.1
VignetteBuilder knitr
NeedsCompilation no
Author Fernando Alarid-Escudero [aut],
Greg Knowlton [aut, cre],
Caleb Easterly [aut],
Eva Enns [aut]

1
2 R topics documented:

Maintainer Greg Knowlton <knowl193@umn.edu>


Repository CRAN
Date/Publication 2021-05-30 21:40:03 UTC

R topics documented:
beta_params . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
calculate_icers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
calc_evpi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
calc_evppi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
calc_evsi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
calc_exp_loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
ceac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
create_dsa_oneway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
create_dsa_twoway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
dirichlet_params . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
example_psa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
example_psa_obj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
gamma_params . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
gen_psa_samp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
hund_strat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
lnorm_params . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
make_psa_obj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
metamodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
owsa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
owsa_opt_strat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
owsa_tornado . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
plot.evpi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
plot.evppi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
plot.evsi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
plot.exp_loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
plot.icers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
plot.owsa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
plot.psa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
plot.twsa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
predict.metamodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
print.metamodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
print.sa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
psa_cdiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
rdirichlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
run_owsa_det . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
run_psa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
run_twsa_det . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
summary.metamodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
summary.psa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
twsa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
beta_params 3

Index 44

beta_params Calculate alpha and beta parameters of beta distribution.

Description

Function to calculate the alpha and beta parameters of the beta distribution based on the method of
moments using the mean µ and standard deviation σ of the random variable of interest.

Usage

beta_params(mean, sigma)

Arguments

mean mean of the random variable.


sigma standard deviation of the random variable (i.e., standard error).

Value

a list containing the following:


alpha The method-of-moments estimate for the alpha parameter of the beta distribution
beta The method-of-moments estimate for the beta parameter of the beta distribution

Details

Based on methods of moments. If µ is the mean and σ is the standard deviation of the random
variable, then
1−µ 1
α = ( 2 − )µ2
σ µ

and
1
β = α( − 1)
µ
4 calculate_icers

calculate_icers Calculate incremental cost-effectiveness ratios (ICERs)

Description
This function takes in strategies and their associated cost and effect, assigns them one of three
statuses (non-dominated, extended dominated, or dominated), and calculates the incremental cost-
effectiveness ratios for the non-dominated strategies
The cost-effectiveness frontier can be visualized with plot, which calls plot.icers.
An efficent way to get from a probabilistic sensitivity analysis to an ICER table is by using summary
on the PSA object and then using its columns as inputs to calculate_icers.

Usage
calculate_icers(cost, effect, strategies)

Arguments
cost vector of cost for each strategy
effect vector of effect for each strategy
strategies string vector of strategy names With the default (NULL), there is no reference
strategy, and the strategies are ranked in ascending order of cost.

Value
A data frame and icers object of strategies and their associated status, incremental cost, incremen-
tal effect, and ICER.

See Also
plot.icers

Examples
## Base Case
# if you have a base case analysis, can use calculate_icers on that
data(hund_strat)
hund_icers <- calculate_icers(hund_strat$Cost,
hund_strat$QALYs,
hund_strat$Strategy)

plot(hund_icers)
# we have so many strategies that we may just want to plot the frontier
plot(hund_icers, plot_frontier_only = TRUE)
# see ?plot.icers for more options

## Using a PSA object


calc_evpi 5

data(psa_cdiff)

# summary() gives mean cost and effect for each strategy


sum_cdiff <- summary(psa_cdiff)

# calculate icers
icers <- calculate_icers(sum_cdiff$meanCost,
sum_cdiff$meanEffect,
sum_cdiff$Strategy)
icers

# visualize
plot(icers)

# by default, only the frontier is labeled


# if using a small number of strategies, you can label all the points
# note that longer strategy names will get truncated
plot(icers, label = "all")

calc_evpi Expected Value of Perfect Information (EVPI)

Description
calc_evpi is used to compute the expected value of perfect information (EVPI) from a probabilistic
sensitivity analysis (PSA) dataset.

Usage
calc_evpi(psa, wtp, pop = 1)

Arguments
psa psa object from make_psa_obj
wtp numeric vector with willingness-to-pay (WTP) thresholds
pop scalar that corresponds to the total population

Value
A data frame and evpi object with the EVPI at each WTP threshold.

Details
evpi calculates the value of eliminating all the uncertainty of a cost-effectiveness analysis at each
WTP threshold.

See Also
plot.evpi, make_psa_obj
6 calc_evppi

Examples
# load psa object provided with package
data("example_psa_obj")

# define wtp threshold vector (can also use a single wtp)


wtp <- seq(1e4, 1e5, by = 1e4)
evpi <- calc_evpi(example_psa_obj, wtp)
plot(evpi) # see ?plot.evpi for options

# can use plot options (# see ?plot.evpi for details)


plot(evpi, effect_units = "QALE")

# or can use ggplot layers


plot(evpi) + ggtitle("Expected Value of Perfect Information")

calc_evppi Estimation of the Expected Value of Partial Perfect Information


(EVPPI) using a linear regression metamodel approach

Description
evppi is used to estimate the Expected Value of Partial Perfect Information (EVPPI) using a linear
regression metamodel approach from a probabilistic sensitivity analysis (PSA) dataset.

Usage
calc_evppi(
psa,
wtp,
params = NULL,
outcome = c("nmb", "nhb"),
type = c("gam", "poly"),
poly.order = 2,
k = -1,
pop = 1,
progress = TRUE
)

Arguments
psa object of class psa, produced by make_psa_obj
wtp willingness-to-pay threshold
params A vector of parameter names to be analyzed in terms of EVPPI.
outcome either net monetary benefit ("nmb") or net health benefit ("nhb")
type either generalized additive models ("gam") or polynomial models ("poly")
poly.order order of the polynomial, if type == "poly"
calc_evppi 7

k basis dimension, if type == "gam"


pop scalar that corresponds to the total population
progress TRUE or FALSE for whether or not function progress should be displayed in con-
sole.

Details
The expected value of partial pefect information (EVPPI) is the expected value of perfect informa-
tion from a subset of parameters of interest, θI , of a cost-effectiveness analysis (CEA) of D different
strategies with parameters θ = {θI , θC }, where θC is the set of complimenatry parameters of the
CEA. The function calc_evppi computes the EVPPI of θI from a matrix of net monetary benefits
B of the CEA. Each column of B corresponds to the net benefit Bd of strategy d. The function
calc_evppi computes the EVPPI using a linear regression metamodel approach following these
steps:
1. Determine the optimal strategy d∗ from the expected net benefits B̄
d∗ = argmaxd {B̄}

2. Compute the opportunity loss for each d strategy, Ld


Ld = Bd − Bd∗

3. Estimate a linear metamodel for the opportunity loss of each d strategy, Ld , by regressing
them on the spline basis functions of θI , f (θI )
Ld = β0 + f (θI ) + ,
where  is the residual term that captures the complementary parameters θC and the difference
between the original simulation model and the metamodel.
4. Compute the EVPPI of θI using the estimated losses for each d strategy, L̂d from the linear
regression metamodel and applying the following equation:
K
1 X
EV P P IθI = max(L̂d )
K i=1 d

The spline model in step 3 is fitted using the ‘mgcv‘ package.

Value
A list containing 1) a data.frame with WTP thresholds and corresponding EVPPIs for the selected
parameters and 2) a list of metamodels used to estimate EVPPI for each strategy at each willingness
to pay threshold.

References
1. Jalal H, Alarid-Escudero F. A General Gaussian Approximation Approach for Value of Infor-
mation Analysis. Med Decis Making. 2018;38(2):174-188.
2. Strong M, Oakley JE, Brennan A. Estimating Multiparameter Partial Expected Value of Per-
fect Information from a Probabilistic Sensitivity Analysis Sample: A Nonparametric Regres-
sion Approach. Med Decis Making. 2014;34(3):311–26.
8 calc_evsi

calc_evsi Calculate Expected Value of Sample Information (EVSI)

Description

Calculate Expected Value of Sample Information (EVSI)

Usage

calc_evsi(
psa,
wtp,
params = NULL,
outcome = c("nhb", "nmb"),
k = -1,
n = 100,
n0 = 10,
n_by_param = FALSE,
pop = 1,
progress = TRUE
)

Arguments

psa object of class psa, produced by make_psa_obj


wtp willingness-to-pay threshold
params A vector of parameter names to be analyzed in terms of EVPPI.
outcome either net monetary benefit ("nmb") or net health benefit ("nhb")
k basis dimension, if type == "gam"
n additional sample size
n0 initial sample size
n_by_param if TRUE, each parameter in the metamodel can have a unique initial and additional
sample size. n and n0 must be numerical vectors of equal length to params,
with each value corresponding to the initial and additional sample sizes for each
parameter in the metamodel. By default, n_by_param = FALSE, and each value
of n and n0 is shared by each parameter in the model. When n_by_param =
FALSE, n0 must be a single numeric value, and n must be a numerical vector of
additional sample sizes for which EVSI is calculated from the metamodel.
pop scalar that corresponds to the total population
progress TRUE or FALSE for whether or not function progress should be displayed in con-
sole.
calc_exp_loss 9

Value

A list containing 1) a data.frame with WTP thresholds, new prospective sample sizes (if n_by_param
== FALSE), and corresponding EVSIs for the selected parameters and 2) a list of metamodels used
to estimate EVSI for each strategy at each willingness to pay threshold.

calc_exp_loss Calculate the expected loss at a range of willingness-to-pay thresholds

Description

The expected loss is the quantification of the foregone benefits when choosing a suboptimal strategy
given current evidence.

Usage

calc_exp_loss(psa, wtp)

Arguments

psa object of class psa, produced by function make_psa_obj


wtp vector of willingness to pay thresholds

Details

Visualize the expected loss at a variety of WTP thresholds using plot.exp_loss.

Value

object with classes exp_loss and data.frame

References

1. Alarid-Escudero F, Enns EA, Kuntz KM, Michaud TL, Jalal H. "Time Traveling Is Just Too
Dangerous" But Some Methods Are Worth Revisiting: The Advantages of Expected Loss
Curves Over Cost-Effectiveness Acceptability Curves and Frontier. Value Health. 2019;22(5):611-
618.
2. Eckermann S, Briggs A, Willan AR. Health technology assessment in the cost- disutility plane.
Med Decis Making. 2008;28(2):172–181.

See Also

plot.exp_loss, make_psa_obj
10 ceac

Examples
data("example_psa_obj")
wtp <- seq(1e4, 1e5, by = 1e4)
exp_loss <- calc_exp_loss(example_psa_obj, wtp)

# can use head(), summary(), print(), etc.


head(exp_loss)

# plot an expected loss curve (ELC)


plot(exp_loss)

# the y axis is on a log scale by default


plot(exp_loss, log_y = FALSE)

ceac Cost-Effectiveness Acceptability Curve (CEAC)

Description
ceac is used to compute and plot the cost-effectiveness acceptability curves (CEAC) from a proba-
bilistic sensitivity analysis (PSA) dataset.

Usage
ceac(wtp, psa)

Arguments
wtp numeric vector with willingness-to-pay (WTP) thresholds
psa psa object from make_psa_obj

Details
ceac computes the probability of each of the strategies being cost-effective at each wtp threshold.
The returned object has classes ceac and data.frame, and has its own plot method (plot.ceac).

Value
An object of class ceac that can be visualized with plot. The ceac object is a data.frame that shows
the proportion of PSA samples for which each strategy at each WTP threshold is cost-effective. The
final column indicates whether or not the strategy at a particular WTP is on the cost-efficient frontier.

See Also
plot.ceac, summary.ceac
create_dsa_oneway 11

Examples
# psa input provided with package
data("example_psa")
example_psa_obj <- make_psa_obj(example_psa$cost, example_psa$effectiveness,
example_psa$parameters, example_psa$strategies)

# define wtp threshold vector (can also use a single wtp)


wtp <- seq(1e4, 1e5, by = 1e4)
ceac_obj <- ceac(wtp, example_psa_obj)
plot(ceac_obj) # see ?plot.ceac for options

# this is most useful when there are many strategies


# warnings are printed to describe strategies that
# have been filtered out
plot(ceac_obj, min_prob = 0.5)

# standard ggplot layers can be used


plot(ceac_obj) +
labs(title = "CEAC", y = "Pr(Cost-effective) at WTP")

# the ceac object is also a data frame


head(ceac_obj)

# summary() tells us the regions of cost-effectiveness for each strategy.


# Note that the range_max column is an open parenthesis, meaning that the
# interval over which that strategy is cost-effective goes up to but does not include
# the value in the range_max column.
summary(ceac_obj)

create_dsa_oneway Create one-way deterministic sensitivity analysis object

Description
The object returned by this function can be passed to owsa to do a one-way sensitivity analysis on
each parameter of interest.

Usage
create_dsa_oneway(
parameters,
effectiveness = NULL,
strategies,
cost = NULL,
currency = "$",
other_outcome = NULL
)
12 create_dsa_twoway

Arguments
parameters parameter values associated with costs, effectiveness, or other outcomes. The
table must have two columns, with each parameter name in the first column and
the associated parameter value in the second column:

parameter value
param1 name param1 val1
... ...
param2 name param2 val1
... ...

effectiveness data frames containing data for costs, effectiveness or another outcome (user-
defined), respectively. Each simulation should be a row of the data frame, and
each strategy should be a column. Naming the columns of the data frames is not
necessary, as they will be renamed with the strategies vector.
strategies vector with the names of the strategies. Due to requirements in certain uses of
this vector, this function uses make.names to modify strategy names as neces-
sary. It is strongly suggested that you follow the rules in the make.names help
page, to avoid unexpected errors.
cost data frames containing data for costs, effectiveness or another outcome (user-
defined), respectively. Each simulation should be a row of the data frame, and
each strategy should be a column. Naming the columns of the data frames is not
necessary, as they will be renamed with the strategies vector.
currency symbol for the currency being used (ex. "$", "£")
other_outcome data frames containing data for costs, effectiveness or another outcome (user-
defined), respectively. Each simulation should be a row of the data frame, and
each strategy should be a column. Naming the columns of the data frames is not
necessary, as they will be renamed with the strategies vector.

Value

a class dsa_oneway object that can be passed to the owsa function to visualize the one-way sensi-
tivity analyses contained in the object.

create_dsa_twoway Create one-way deterministic sensitivity analysis object

Description

The object returned by this function can be passed to owsa to do a one-way sensitivity analysis on
each parameter of interest.
create_dsa_twoway 13

Usage
create_dsa_twoway(
parameters,
effectiveness = NULL,
strategies,
cost = NULL,
currency = "$",
other_outcome = NULL
)

Arguments
parameters parameter values associated with effectiveness and outcomes. The table must
have two columns, one for each parameter. The parameter names must be the
column names.

param1 name param2 name


param1 val1 param2 val1
param1 val2 param2 val2
... ...

effectiveness data frames containing data for costs, effectiveness or another outcome (user-
defined), respectively. Each simulation should be a row of the data frame, and
each strategy should be a column. Naming the columns of the data frames is not
necessary, as they will be renamed with the strategies vector.
strategies vector with the names of the strategies. Due to requirements in certain uses of
this vector, this function uses make.names to modify strategy names as neces-
sary. It is strongly suggested that you follow the rules in the make.names help
page, to avoid unexpected errors.
cost data frames containing data for costs, effectiveness or another outcome (user-
defined), respectively. Each simulation should be a row of the data frame, and
each strategy should be a column. Naming the columns of the data frames is not
necessary, as they will be renamed with the strategies vector.
currency symbol for the currency being used (ex. "$", "£")
other_outcome data frames containing data for costs, effectiveness or another outcome (user-
defined), respectively. Each simulation should be a row of the data frame, and
each strategy should be a column. Naming the columns of the data frames is not
necessary, as they will be renamed with the strategies vector.

Value

a class dsa_twoway object that can be passed to the twsa function to visualize the two-way sensi-
tivity analysis contained in the object.
14 dirichlet_params

dirichlet_params Calculate alpha parameters of Dirichlet distribution.

Description
Function to calculate the α parameters of the Dirichlet distribution based on the method of moments
(MoM) using the mean µ and standard deviation σ of the random variables of interest.

Usage
dirichlet_params(p.mean, sigma)

Arguments
p.mean Vector of means of the random variables.
sigma Vector of standard deviation of the random variables (i.e., standard error).

Value
numeric vector of method-of-moment estimates for the alpha parameters of the dirichlet distribution

Details
Based on methods of moments. If µ is a vector of means and σ is a vector of standard deviations of
the random variables, then the second moment X2 is defined by σ 2 + µ2 . Using the mean and the
second moment, the J alpha parameters are computed as follows

(µ1 − X21 )µi


αi =
X21 − µ21

for i = 1, . . . , J − 1, and
PJ−1
(µ1 − X21 )(1 − i=1 µi )
αJ =
X21 − µ21

References
1. Fielitz BD, Myers BL. Estimation of parameters in the beta distribution. Dec Sci. 1975;6(1):1–13.
2. Narayanan A. A note on parameter estimation in the multivariate beta distribution. Comput
Math with Appl. 1992;24(10):11–7.

Examples
p.mean <- c(0.5, 0.15, 0.35)
p.se <- c(0.035, 0.025, 0.034)
dirichlet_params(p.mean, p.se)
example_psa 15

example_psa Sample PSA data for testing

Description
A dataset containing a number of PSA samples

Usage
example_psa

Format
An object of class list of length 5.

example_psa_obj Sample PSA data for testing

Description
A psa object created from the data in example_psa

Usage
example_psa_obj

Format
An object of class psa of length 8.

gamma_params Calculate shape and scale (or rate) parameters of a gamma distribu-
tion.

Description
Function to calculate the shape, α, and scale, θ, (or rate, β) parameters of a gamma distribution
based on the method of moments (MoM) using the mean µ and standard deviation σ of the random
variable of interest.

Usage
gamma_params(mu, sigma, scale = TRUE)
16 gamma_params

Arguments

mu scalar with the mean of the random variable.


sigma scalar with the standard deviation of the random variable.
scale logical variable indicating scale parameterization of the gamma distribution (De-
fault is TRUE). If FALSE, rate parameterization is retrieved

Value

A list contianing the following:


shape Shape parameter of gamma distribution
scale Scale parameter of gamma distribution (If scale=TRUE)
rate Rate parameter of gamma distribution (If scale=FALSE)

Details

Based on method of moments. If µ is the mean and σ is the standard deviation of the random
variable, then the the shape, α, scale, θ, and rate, β, parameters are computed as follows

µ2
α= ,
σ2

σ2
θ=
µ
and
µ
β=
σ2

References

• Gamma distribution. (2018, February 7). In Wikipedia, The Free Encyclopedia. Retrieved
17:23, February 11, 2018, from https://en.wikipedia.org/w/index.php?title=Gamma_distribution&oldid=824541785

Examples

mu <- 2
sigma <- 1
# Scale specification
gamma_params(mu, sigma)
# Rate specification
gamma_params(mu, sigma, scale = FALSE)
gen_psa_samp 17

gen_psa_samp Generate PSA Sample

Description
gen_psa_samp generates a data.frame of sampled parameter values from user-specified distributions
to be used in a probabilistic sensitivity analysis (PSA)

Usage
gen_psa_samp(
params = NULL,
dists = c("normal", "log-normal", "truncated-normal", "beta", "gamma", "dirichlet",
"bootstrap", "constant", "triangle"),
parameterization_types = c("mean, sd", "a, b", "shape, scale",
"value, mean_prop, sd", "value, n", "value, alpha", "mean, sd, ll, ul", "val",
"meanlog, sdlog", "ll, ul, mode"),
dists_params = NULL,
nsamp = 100
)

Arguments
params string vector with the names of parameters to be generated by gen_psa_samp
and used by a user-defined function in run_psa to calculate outcomes.
dists string vector with the distributions from which params will be drawn.
parameterization_types
string vector with parameterization types for each dists
dists_params list of input parameters required to by specific dists and parameterization_types
to fully describe distribution and generate parameter samples.
nsamp number of sets of parameter values to be generated

Details
Length of vectors params, dists, parameterization_types, and list dists_params must all be
the same. The nth element of dists, parameterization_types, and dists_params all define
the distribution that will be used to draw samples of the corresponding nth element of the params
vector.
For a given element of params:
• If dists == "normal", parameterization_types can only be "mean, sd", and the corre-
sponding element of list dists_params must be the the vector c(mean, sd)
• If dists == "log-normal", parameterization_types can be either "mean, sd" or "meanlog,
sdlog", and the corresponding element of list dists_params must be either the the vector
c(mean, sd) or c(meanlog, sdlog). Use "mean, sd" if you have sample mean and sample
standard deviation of an empirical sample of the random variable, and use "meanlog, sdlog"
18 gen_psa_samp

if you want to directly specify the parameters of the log-normal distribution as specified by
rlnorm
• If dists == "truncated-normal", parameterization_types can only be "mean, sd, ll,
ul", and dists_params must be the vector c(mean, sd, ll, ul), where ll is the lower limit
of the distribution and ul is the upper limit of the distribution. If either the lower limit or the
upper limit does not exist, simply specify NA in the corresponding position of the dists_params
vector.
• If dists == "beta", parameterization_types can be "mean, sd" or "a, b" and the cor-
responding element of list dists_params must be the the vector c(mean, sd) or c(a, b),
respectively.
• If dists == "gamma", parameterization_types can be "mean, sd" or "shape, scale" and
the corresponding element of list dists_params must be the the vector c(mean, sd) or
c(shape, scale), respectively.
• If dists == "dirichlet", parameterization_types can be "value, mean_prop, sd", "value,
n", or "value, alpha".
– If parameterization_types == "value, mean_prop, sd", then the corresponding ele-
ment of list dists_params must be a data.frame where the first column is a string vector
of the the different multinomial outcomes. These multinomial outcomes will become col-
umn names in the data.frame returned by gen_psa_samp, and therefore the strings in this
column should correspond to variable names used in FUN for run_psa. The second and
third columns of this dists_params should be numerical vectors containing the sample
means and sample standard errors for each of the multinomial outcomes.
– If parameterization_types == "value, n", then dists_params must be a data.frame
with the first column being a string vector of the multinomial outcomes, and the second
column being a vector of the observed number of each multinomial outcome in a sample.
– If parameterization_types == "value, alpha", then dists_params must be a data.frame
with the first column being a string vector of the multinomial outcomes, and the second
column must be a numerical vector of the alpha parameter values for each multinomial
outcome in the dirichlet distribution.
• If dists == "bootstrap", parameterization_types can only be "value, weight", and
dists_params must be a data.frame with the first column being a numerical vector containing
all of the bootstrap sample values, and the second column being an integer vector designating
the sampling weights of each bootstrap sample value. For example, the number of rows in the
dists_params data.frame is the number of individuals in the population to be sampled from
(with replacement) or the number of values an empirical distribution (e.g. a histogram). If
each individual value in the sample is unique and should be weighted equally, set each weight
to 1. If the sample distribution resembles a histogram, the weights should be equal to the
number of observations for each unique value in the empirical distribution.
• If dists == "constant", parameterization_types can only be "val", and dists_params
must be a single numerical value.

Value
A dataframe with samples of parameters for a probabilistic sensitivity analysis (PSA)

See Also
run_psa
hund_strat 19

Examples
#define parameter names
params <- c("normal_param", "lognorm_param", "truncnorm_param", "beta_param",
"gamma_param", "dirichlet_param", "bootstrap_param")

#indicate parent distribution types for each parameter


dists <- c("normal", "log-normal", "truncated-normal", "beta", "gamma", "dirichlet", "bootstrap")

#indicate which type of parameterization is used for each parent distribution


parameterization_types <- c("mean, sd", "mean, sd", "mean, sd, ll, ul", "mean, sd", "mean, sd",
"value, mean_prop, sd", "value, weight")

#provide distribution parameters that fully define each parent distribution, and
#ensure that these distribution parameters match the form expected by each combination of dists
#and parameterization_types
dists_params <- list(c(1, 2), c(1, 3), c(1, 0.1, NA, 1), c(.5, .2), c(100, 1),
data.frame(value = c("level1", "level2", "level3"),
mean_prop = c(.1, .4, .5), sd = c(.05, .01, .1)),
data.frame(value = c(1, 2, 4, 6, 7, 8),
weight = c(1, 1, 1, 1, 1, 4)))

#generate 100 samples of parameter values to be used in a probabilistic sensitivity analysis


gen_psa_samp(params = params,
dists = dists,
parameterization_types = parameterization_types,
dists_params = dists_params,
nsamp = 100)

hund_strat Sample deterministic data for testing

Description

A dataset containing 100 strategies

Usage

hund_strat

Format

An object of class data.frame with 100 rows and 3 columns.


20 lnorm_params

lnorm_params Calculate location and scale parameters of a log-normal distribution.

Description
Function to calculate the location, µ, and scale, σ, parameteres of a log-normal distribution based on
the method of moments (MoM) using the mean m and variance v of the non-logarithmized random
variable of interest.

Usage
lnorm_params(m = 1, v = 1)

Arguments
m Scalar with the mean of the random variable.
v Scalar with the variance of the random variable. (i.e., squared standar error).

Value
A list containing the following:
mu Location parameter of log-normal distribution
sigma Scale parameter of log-normal distribution

Details
Based on method of moments. If m is the mean and v is the variance of the random variable, then
the the location, µ, and scale, σ, parameteres are computed as follows
m
µ = ln ( p )
(1 + mv2 )
and r
v
σ = ln (1 + 2 )
m

References
1. Ginos BF. Parameter Estimation for the Lognormal Distribution. Brigham Young University;
2009.
2. Log-normal distribution. (2017, April 20). In Wikipedia, The Free Encyclopedia. Retrieved
16:47, April 23, 2017, from https://en.wikipedia.org/w/index.php?title=Log-normal_distribution&oldid=776357974

Examples
m <- 3
v <- 0.01
lnorm_params(m, v)
# True values: 100, 30, 70
make_psa_obj 21

make_psa_obj Create a PSA object

Description
Creates an object to hold probabilistic sensitivity analysis data, while checking the data for validity.
The object can then be used for many standard cost-effectiveness analyses (see Details below).

Usage
make_psa_obj(
cost,
effectiveness,
parameters = NULL,
strategies = NULL,
currency = "$",
other_outcome = NULL
)

Arguments
cost For the data.frame, each simulation should be a row and each strategy should be
a column. Naming the columns of the data frames is not necessary, as they will
be renamed with the strategies vector.
effectiveness For the data.frame, each simulation should be a row and each strategy should be
a column. Naming the columns of the data frames is not necessary, as they will
be renamed with the strategies vector.
parameters Data frame with values for each simulation (rows) and parameter (columns).
The column names should be the parameter names.
strategies vector with the names of the strategies. Due to requirements in certain uses of
this vector, this function uses make.names to modify strategy names as neces-
sary. It is strongly suggested that you follow the rules in the make.names help
page, to avoid unexpected errors.
currency symbol for the currency being used (ex. "$", "£")
other_outcome data.frame containing values for another user-defined outcome. Each simula-
tion should be a row of the data frame, and each strategy should be a column.
Naming the columns of the data frames is not necessary, as they will be renamed
with the strategies vector.

Details
The PSA object forms the backbone of one part of the dampack package.
A scatterplot of the cost-effectiveness plane may be shown by running plot on the output of
make_psa_obj.
Using this object, you may calculate:
22 metamodel

• Cost-effectiveness acceptability curves (ceac)


• Expected value of perfect information (calc_evpi)
• Expected loss (calc_exp_loss)
• One-way sensitivity analysis (owsa)
• Two-way sensitivity analysis (twsa)
• Metamodels (metamodel)

In addition, the PSA may be converted to a base-case analysis by using summary on the PSA object.
The output of summary can be used in calculate_icers.

Value

An object of class psa

See Also

summary.psa, plot.psa

Examples

# psa input provided with package


data("example_psa")
psa <- make_psa_obj(example_psa$cost, example_psa$effectiveness,
example_psa$parameters, example_psa$strategies)

# custom print and summary methods


print(psa)
summary(psa)

# custom plot method; see ?plot.psa for options


plot(psa)

metamodel Linear regression metamodeling

Description

This function estimates a linear regression metamodel for a given decision-analytic model by using
the results of a probabilistic sensitivity analysis (PSA)
metamodel 23

Usage
metamodel(
analysis = c("oneway", "twoway", "multiway"),
psa,
params = NULL,
strategies = NULL,
outcome = c("eff", "cost", "nhb", "nmb", "nhb_loss", "nmb_loss", "nhb_loss_voi",
"nmb_loss_voi"),
wtp = NULL,
type = c("linear", "gam", "poly"),
poly.order = 2,
k = -1
)

Arguments
analysis either "oneway" or "twoway"
psa psa object
params string vector with the name(s) of the parameter of interest. Defaults to all.
strategies vector of strategies to consider. The default (NULL) is that all strategies are
considered.
outcome either effectiveness ("eff"), cost ("cost"), net health benefit ("nhb"), net monetary
benefit ("nmb"), or the opportunity loss in terms of NHB or NMB ("nhb_loss"
and "nmb_loss", respectively). "nmb_loss_voi" and "nhb_loss_voi" are only
used in internal function calls of metamodel within other VOI functions.
wtp if outcome is NHB or NMB (or the associated loss), must provide the willingness-
to-pay threshold
type type of metamodel
poly.order order of polynomial for the linear regression metamodel. Default: 2
k the dimension of the basis used to represent the smooth term. The default de-
pends on the number of variables that the smooth is a function of. k should
not be less than the dimension of the null space of the penalty for the term (see
null.space.dimension), but will be reset if it is. See choose.k for further
information.

Details
The most important option is analysis, which can be either "oneway" or twoway. If analysis ==
"oneway", a separate metamodel is created for each combination of the parameters in params and
strategies in strategies (by default, this is all strategies and parameters).
If analysis == "twoway", params must be a vector of two parameters, and a metamodel is created
with these two parameters for each strategy in strategies.

Value
A metamodel object, which contains a list of metamodels and other relevant information.
24 owsa

See Also
predict.metamodel, make_psa_obj, owsa, twsa

owsa One-way sensitivity analysis

Description
When used on a PSA object, this function uses a polynomial regression metamodel to predict the
average outcome of a decision-analytic model as a function of a single input parameter. When used
on a DSA object, this function uses the DSA results directly to show how the selected outcome
varies as a function of the input parameter of interest. In the DSA context, this function is called
internally by run_owsa_det and should not be called by the user. In the PSA context, the user must
use this function to produce an owsa object.

Usage
owsa(
sa_obj,
params = NULL,
ranges = NULL,
nsamp = 100,
outcome = c("eff", "cost", "nhb", "nmb", "nhb_loss", "nmb_loss"),
wtp = NULL,
strategies = NULL,
poly.order = 2
)

Arguments
sa_obj sensitivity analysis object; either a probabilistic sensitivity analysis (make_psa_obj)
or a deterministic sensitivity analysis object (run_owsa_det)
params string vector with the name(s) of the parameter of interest. Defaults to all.
ranges a named list of the form c("param" = c(0, 1), ...) that gives the ranges for the
parameter of interest. If NULL, parameter values from the middle 95 from this
range is determined by nsamp.
nsamp number of samples to take from the ranges
outcome either effectiveness ("eff"), cost ("cost"), net health benefit ("nhb"), net monetary
benefit ("nmb"), or the opportunity loss in terms of NHB or NMB ("nhb_loss"
and "nmb_loss", respectively). "nmb_loss_voi" and "nhb_loss_voi" are only
used in internal function calls of metamodel within other VOI functions.
wtp if outcome is NHB or NMB (or the associated loss), must provide the willingness-
to-pay threshold
strategies vector of strategies to consider. The default (NULL) is that all strategies are
considered.
poly.order order of polynomial for the linear regression metamodel. Default: 2
owsa_opt_strat 25

Value
An object of class data.frame and owsa with the results of the sensitivity analysis. Can be visual-
ized with plot.owsa, owsa_tornado, and owsa_opt_strat

owsa_opt_strat plot the optimal strategy as the parameter values change

Description
plot the optimal strategy as the parameter values change

Usage
owsa_opt_strat(
owsa,
params = NULL,
maximize = TRUE,
return = c("plot", "data"),
plot_const = TRUE,
col = c("full", "bw"),
greystart = 0.2,
greyend = 0.8,
txtsize = 12,
facet_ncol = 1,
facet_nrow = NULL,
facet_lab_txtsize = NULL,
n_x_ticks = 10
)

Arguments
owsa An owsa object
params vector of parameters to plot
maximize whether to maximize (TRUE) or minimize the outcome
return either return a ggplot object plot or a data frame with ranges of parameters for
which each strategy is optimal.
plot_const whether to plot parameters that don’t lead to changes in optimal strategy as they
vary.
col either none, full color, or black and white
greystart between 0 and 1. used in greyscale only. smaller numbers are lighter
greyend between 0 and 1, greater than greystart.
txtsize base text size
facet_ncol Number of columns in plot facet.
26 owsa_tornado

facet_nrow number of rows in plot facet.


facet_lab_txtsize
text size for plot facet labels
n_x_ticks number of axis ticks

Value
If return == "plot", a ggplot2 optimal strategy plot derived from the owsa object, or if return
== "data", a data.frame containing all data contained in the plot. The plot allows us to see how
the strategy that maximizes the expectation of the outcome of interest changes as a function of each
parameter of interest.

owsa_tornado Tornado plot of a one-way sensitivity analysis

Description
Tornado plot of a one-way sensitivity analysis

Usage
owsa_tornado(
owsa,
return = c("plot", "data"),
txtsize = 12,
min_rel_diff = 0,
col = c("full", "bw"),
n_y_ticks = 8,
ylim = NULL,
ybreaks = NULL
)

Arguments
owsa an owsa object
return either return a ggplot object plot or a data frame with ranges of parameters for
which each strategy is optimal.
txtsize base text size
min_rel_diff this function only plots parameters that lead to a relative change in the outcome
greater than or equal to min_rel_diff, which must be between 0 and 1. The
default (0) is that no strategies are filtered.
col either none, full color, or black and white
n_y_ticks number of axis ticks
ylim vector of axis limits, or NULL, which sets limits automatically
ybreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
plot.evpi 27

Value
If return == "plot", a ggplot2 tornado plot derived from the owsa object, or if return == "data",
a data.frame containing all data contained in the plot. A tornado plot is a visual aid used to identify
which parameters are driving most of the variation in a specified model outcome.

plot.evpi Plot of Expected Value of Perfect Information (EVPI)

Description
Plots the evpi object created by calc_evpi.

Usage
## S3 method for class 'evpi'
plot(
x,
txtsize = 12,
currency = "$",
effect_units = "QALY",
n_y_ticks = 8,
n_x_ticks = 20,
xbreaks = NULL,
ybreaks = NULL,
xlim = c(0, NA),
ylim = NULL,
...
)

Arguments
x object of class evpi, produced by function calc_evpi
txtsize base text size
currency string with currency used in the cost-effectiveness analysis (CEA). Default: $,
but it could be any currency symbol or word (e.g., £, C, peso)
effect_units units of effectiveness. Default: QALY
n_y_ticks number of axis ticks
n_x_ticks number of axis ticks
xbreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
ybreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
xlim vector of axis limits, or NULL, which sets limits automatically
ylim vector of axis limits, or NULL, which sets limits automatically
... further arguments to plot. This is not used by dampack but required for generic
consistency.
28 plot.evppi

Value
A ggplot2 plot with the EVPI

See Also
calc_evpi

plot.evppi Plot of Expected Value of Partial Perfect Information (EVPPI)

Description
Plots the evppi object created by calc_evppi.

Usage
## S3 method for class 'evppi'
plot(
x,
txtsize = 12,
currency = "$",
effect_units = "QALY",
n_y_ticks = 8,
n_x_ticks = 20,
xbreaks = NULL,
ybreaks = NULL,
xlim = c(0, NA),
ylim = NULL,
...
)

Arguments
x object of class evppi, produced by function calc_evppi
txtsize base text size
currency string with currency used in the cost-effectiveness analysis (CEA). Default: $,
but it could be any currency symbol or word (e.g., £, C, peso)
effect_units units of effectiveness. Default: QALY
n_y_ticks number of axis ticks
n_x_ticks number of axis ticks
xbreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
ybreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
xlim vector of axis limits, or NULL, which sets limits automatically
ylim vector of axis limits, or NULL, which sets limits automatically
... further arguments to plot. This is not used by dampack but required for generic
consistency.
plot.evsi 29

Value
A ggplot2 plot with the EVPPI

See Also
calc_evppi

plot.evsi Plot of Expected Value of Sample Information (EVSI)

Description
Plots the evsi object created by calc_evsi. EVSI is either plotted as a function of additional
sample size for each willingness-to-pay threshold provided, or as a function of each willingness-to-
pay threshold, depending upon the usage of calc_evsi used to create the evsi object.

Usage
## S3 method for class 'evsi'
plot(
x,
txtsize = 12,
currency = "$",
effect_units = "QALY",
n_y_ticks = 8,
n_x_ticks = 20,
xbreaks = NULL,
ybreaks = NULL,
xlim = c(0, NA),
ylim = NULL,
col = c("full", "bw"),
...
)

Arguments
x object of class evsi, produced by function calc_evsi
txtsize base text size
currency string with currency used in the cost-effectiveness analysis (CEA). Default: $,
but it could be any currency symbol or word (e.g., £, C, peso)
effect_units units of effectiveness. Default: QALY
n_y_ticks number of axis ticks
n_x_ticks number of axis ticks
xbreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
ybreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
30 plot.exp_loss

xlim vector of axis limits, or NULL, which sets limits automatically


ylim vector of axis limits, or NULL, which sets limits automatically
col either none, full color, or black and white
... further arguments to plot. This is not used by dampack but required for generic
consistency.

Value

A ggplot2 plot with the EVSI

See Also

calc_evsi

plot.exp_loss Plot of Expected Loss Curves (ELC)

Description

Plot of Expected Loss Curves (ELC)

Usage

## S3 method for class 'exp_loss'


plot(
x,
log_y = TRUE,
frontier = TRUE,
points = TRUE,
lsize = 1,
txtsize = 12,
currency = "$",
effect_units = "QALY",
n_y_ticks = 8,
n_x_ticks = 20,
xbreaks = NULL,
ybreaks = NULL,
xlim = c(0, NA),
ylim = NULL,
col = c("full", "bw"),
...
)
plot.icers 31

Arguments
x object of class exp_loss, produced by function calc_exp_loss
log_y take the base 10 log of the y axis
frontier indicate the frontier (also the expected value of perfect information). To only
plot the EVPI see calc_evpi.
points whether to plot points on the curve (TRUE) or not (FALSE)
lsize line size. defaults to 1.
txtsize base text size
currency string with currency used in the cost-effectiveness analysis (CEA). Default: $,
but it could be any currency symbol or word (e.g., £, C, peso)
effect_units units of effectiveness. Default: QALY
n_y_ticks number of axis ticks
n_x_ticks number of axis ticks
xbreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
ybreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
xlim vector of axis limits, or NULL, which sets limits automatically
ylim vector of axis limits, or NULL, which sets limits automatically
col either none, full color, or black and white
... further arguments to plot. This is not used by dampack but required for generic
consistency.

Value
A ggplot2 object with the expected loss

plot.icers Plot of ICERs

Description
Plots the cost-effectiveness plane for a ICER object, calculated with calculate_icers

Usage
## S3 method for class 'icers'
plot(
x,
txtsize = 12,
currency = "$",
effect_units = "QALYs",
label = c("frontier", "all", "none"),
label_max_char = NULL,
32 plot.icers

plot_frontier_only = FALSE,
alpha = 1,
n_x_ticks = 6,
n_y_ticks = 6,
xbreaks = NULL,
ybreaks = NULL,
xlim = NULL,
ylim = NULL,
xexpand = expansion(0.1),
yexpand = expansion(0.1),
max.iter = 20000,
...
)

Arguments
x Object of class icers.
txtsize base text size
currency string. with currency used in the cost-effectiveness analysis (CEA).
effect_units string. unit of effectiveness
label whether to label strategies on the efficient frontier, all strategies, or none. de-
faults to frontier.
label_max_char max number of characters to label the strategies - if not NULL (the default)
longer strategies are truncated to save space.
plot_frontier_only
only plot the efficient frontier
alpha opacity of points
n_x_ticks number of axis ticks
n_y_ticks number of axis ticks
xbreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
ybreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
xlim vector of axis limits, or NULL, which sets limits automatically
ylim vector of axis limits, or NULL, which sets limits automatically
xexpand Padding around data. See scale_continuous for details. The default behavior
in ggplot2 is expansion(0.05). See expansion for how to modify this.
yexpand Padding around data. See scale_continuous for details. The default behavior
in ggplot2 is expansion(0.05). See expansion for how to modify this.
max.iter Maximum number of iterations to try to resolve overlaps. Defaults to 10000.
... further arguments to plot. This is not used by dampack but required for generic
consistency.

Value
a ggplot2 object which can be modified by adding additional geoms
plot.owsa 33

plot.owsa Plot a sensitivity analysis

Description
Plot a sensitivity analysis

Usage
## S3 method for class 'owsa'
plot(
x,
txtsize = 12,
col = c("full", "bw"),
facet_scales = c("free_x", "free_y", "free", "fixed"),
facet_nrow = NULL,
facet_ncol = NULL,
size = 1,
n_x_ticks = 6,
n_y_ticks = 6,
...
)

Arguments
x an owsa object
txtsize base text size in the plot
col either full-color ("full") or black and white ("bw")
facet_scales whether the x or y axes should be fixed. See facet_grid in the ggplo2 package
for more details.
facet_nrow number of rows in plot facet.
facet_ncol number of columns in plot facet. The default (NULL) is passed to facet_wrap,
which determines the number of rows and columns automatically.
size either point size (ptype = "point") and/or line size (ptype = "line")
n_x_ticks number of axis ticks
n_y_ticks number of axis ticks
... further arguments to plot. This is not used by dampack but required for generic
consistency.

Value
A ggplot2 plot of the owsa object.
34 plot.psa

plot.psa Plot the psa object

Description
Plot the psa object

Usage
## S3 method for class 'psa'
plot(
x,
center = TRUE,
ellipse = TRUE,
alpha = 0.2,
txtsize = 12,
col = c("full", "bw"),
n_x_ticks = 6,
n_y_ticks = 6,
xbreaks = NULL,
ybreaks = NULL,
xlim = NULL,
ylim = NULL,
...
)

Arguments
x the psa object
center plot the mean cost and effectiveness for each strategy. defaults to TRUE
ellipse plot an ellipse around each strategy. defaults to TRUE
alpha opacity of the scatterplot points. 0 is completely transparent, 1 is completely
opaque
txtsize base text size
col either none, full color, or black and white
n_x_ticks number of axis ticks
n_y_ticks number of axis ticks
xbreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
ybreaks vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.
xlim vector of axis limits, or NULL, which sets limits automatically
ylim vector of axis limits, or NULL, which sets limits automatically
... further arguments to plot. This is not used by dampack but required for generic
consistency.
plot.twsa 35

Value

A ggplot2 plot of the PSA, showing the distribution of each PSA sample and strategy on the cost-
effectiveness plane.

plot.twsa Two-way sensitivity analysis plot

Description

Two-way sensitivity analysis plot

Usage

## S3 method for class 'twsa'


plot(
x,
maximize = TRUE,
col = c("full", "bw"),
n_x_ticks = 6,
n_y_ticks = 6,
txtsize = 12,
...
)

Arguments

x a twsa object
maximize If TRUE, plot of strategy with maximum expected outcome (default); if FALSE,
plot of strategy with minimum expected outcome
col either none, full color, or black and white
n_x_ticks number of axis ticks
n_y_ticks number of axis ticks
txtsize base text size
... further arguments to plot. This is not used by dampack but required for generic
consistency.

Value

A ggplot2 plot of the two-way sensitivity analysis.


36 print.metamodel

predict.metamodel Predict from a one-way or two-way metamodel

Description
Predict from a one-way or two-way metamodel

Usage
## S3 method for class 'metamodel'
predict(object, ranges = NULL, nsamp = 100, ...)

Arguments
object object with class "metamodel"
ranges a named list of the form c("param" = c(0, 1), ...) that gives the ranges for the
parameter of interest. If NULL, parameter values from the middle 95 from this
range is determined by nsamp.
nsamp number of samples from ranges
... further arguments to predict (not used)

Value
a data.frame containing the outcome values predicted by the metamodel for each strategy and
each combination of parameter values defined by ranges.

print.metamodel Print metamodel

Description
Print metamodel

Usage
## S3 method for class 'metamodel'
print(x, ...)

Arguments
x metamodel to print
... further arguments to print

Value
None (invisible NULL)
print.sa 37

print.sa print a psa object

Description

print a psa object

Usage

## S3 method for class 'sa'


print(x, all_strat = FALSE, ...)

Arguments

x the psa object


all_strat whether or not to print the full list of strategies. defaults to FALSE, which
truncates the strategy list to 5
... further arguments to print (not used)

Value

None (invisible NULL).

psa_cdiff Sample PSA dataset

Description

Sample PSA dataset

Usage

psa_cdiff

Format

An object of class psa (inherits from sa) of length 6.


38 run_owsa_det

rdirichlet Random number generation for the Dirichlet distribution with param-
eter vector alpha.

Description

Random number generation for the Dirichlet distribution with parameter vector alpha.

Usage

rdirichlet(n, alpha)

Arguments

n number of observations
alpha vector of parameters defining Dirichlet distribution
@importFrom stats rgamma @return A vector random values sampled from a
dirichlet distribution @export

run_owsa_det Run deterministic one-way sensitivity analysis (OWSA)

Description

This function runs a deterministic one-way sensitivity analysis (OWSA) on a given function that
produces outcomes.

Usage

run_owsa_det(
params_range,
params_basecase,
nsamp = 100,
FUN,
outcomes = NULL,
strategies = NULL,
progress = TRUE,
...
)
run_psa 39

Arguments

params_range data.frame with 3 columns in the following order: "pars", "min", and "max".
The number of samples from this range is determined by nsamp. "pars" are the
parameters of interest and must be a subset of the parameters from params_basecase.
params_basecase
a named list of basecase values for input parameters needed by FUN, the user-
defined function.
nsamp number of sets of parameter values to be generated. If NULL, 100 parameter
values are used
FUN function that takes the basecase in params_basecase and ... to produce the
outcome of interest. The FUN must return a dataframe where the first column are
the strategy names and the rest of the columns must be outcomes.
outcomes string vector with the outcomes of interest from FUN produced by nsamp
strategies vector of strategy names. The default NULL will use strategy names in FUN
progress TRUE or FALSE for whether or not function progress should be displayed in con-
sole.
... Additional arguments to user-defined FUN

Value

A list containing dataframes with the results of the sensitivity analyses. The list will contain a
dataframe for each outcome specified. List elements can be visualized with plot.owsa, owsa_opt_strat
and owsa_tornado from dampack

Details

• params_range
– "pars" are the names of the input parameters of interest. These are the parameters that
will be varied in the deterministic sensitivity analysis. variables in "pars" column must
be a subset of variables in params_basecase
– "min" and "max" are the mininum and maximum values of the parameters of interest.

run_psa Calculate outcomes for a PSA using a user-defined function.

Description

run_psa calculates outcomes using a user-defined function and creates PSA objects corresponding
to the specified outcomes.
40 run_twsa_det

Usage
run_psa(
psa_samp,
params_basecase = NULL,
FUN,
outcomes = NULL,
strategies = NULL,
currency = "$",
progress = TRUE,
...
)

Arguments
psa_samp A dataframe with samples of parameters for a probabilistic sensitivity analysis
(PSA)
params_basecase
a named list of basecase values for input parameters needed by FUN, the user-
defined function.
FUN Function that takes the parameter values in psa_samp and ... to produce the
outcome of interest. The FUN must return a dataframe where the first column are
the strategy names and the rest of the columns must be outcomes.
outcomes String vector with the outcomes of interest from FUN.
strategies vector of strategy names. The default NULL will use strategy names in FUN
currency symbol for the currency being used (ex. "$", "£")
progress TRUE or FALSE for whether or not function progress should be displayed in con-
sole.
... Additional arguments to user-defined FUN

Value
A list containing PSA objects for each outcome in outcomes.

See Also
run_psa, make_psa_obj, gen_psa_samp,

run_twsa_det Run deterministic two-way sensitivity analysis (TWSA)

Description
This function runs a deterministic two-way sensitivity analysis (TWSA) on a given function that
produces outcomes.
run_twsa_det 41

Usage
run_twsa_det(
params_range,
params_basecase,
nsamp = 40,
FUN,
outcomes = NULL,
strategies = NULL,
progress = TRUE,
...
)

Arguments
params_range data.frame with 2 rows and 3 columns in the following order: "pars", "min", and
"max". The number of samples from this range is determined by nsamp. "pars"
are the 2 parameters of interest, which must be a subset of the parameters from
params_basecase.
params_basecase
a named list of basecase values for input parameters needed by FUN, the user-
defined function.
nsamp number of parameter values. If NULL, 40 parameter values are used
FUN Function that takes the basecase in params_all and ... to produce the outcome
of interest. The FUN must return a dataframe where the first column are the
strategy names and the rest of the columns must be outcomes.
outcomes String vector with the outcomes of interest from FUN produced by nsamp
strategies vector of strategy names. The default (NULL) will use strategy names in FUN
progress TRUE or FALSE for whether or not function progress should be displayed in con-
sole.
... Additional arguments to user-defined FUN

Value
A list containing dataframes with the results of the sensitivity analyses. The list will contain a
dataframe for each outcome specified.

Details
• params_range
– "pars" are the names of the two input parameters of interest. The two variables in "pars"
column must be a subset of variables in params_basecase
– "min" and "max" are the mininum and maximum values of the parameters of interest.
42 summary.psa

summary.metamodel Summary of metamodel

Description
Summary of metamodel

Usage
## S3 method for class 'metamodel'
summary(object, ...)

Arguments
object metamodel to summarize
... further arguments to summary

Value
a data.frame containing the r-squared for each strategy and parameter’s metamodel.

summary.psa summarize a psa object across all simulations

Description
summarize a psa object across all simulations

Usage
## S3 method for class 'psa'
summary(object, calc_sds = FALSE, ...)

Arguments
object the psa object
calc_sds whether or not to calculate the standard deviations. Defaults to FALSE
... further arguments to summary (not used)

Value
a data.frame containing the mean cost and effectiveness for each strategy and, if requested, the
standard deviations of the cost and effectiveness for each strategy.
twsa 43

twsa Two-way sensitivity analysis using linear regression metamodeling

Description
This function displays a two-way sensitivity analysis (TWSA) graph by estimating a linear regres-
sion metamodel of a PSA for a given decision-analytic model

Usage
twsa(
sa_obj,
param1 = NULL,
param2 = NULL,
ranges = NULL,
nsamp = 100,
outcome = c("eff", "cost", "nhb", "nmb", "nhb_loss", "nmb_loss"),
wtp = NULL,
strategies = NULL,
poly.order = 2
)

Arguments
sa_obj sensitivity analysis object; either a probabilistic sensitivity analysis (make_psa_obj)
or a deterministic sensitivity analysis object (run_owsa_det)
param1 String with the name of the first parameter of interest
param2 String with the name of the second parameter of interest
ranges a named list of the form c("param" = c(0, 1), ...) that gives the ranges for the
parameter of interest. If NULL, parameter values from the middle 95 from this
range is determined by nsamp.
nsamp number of samples from ranges
outcome either effectiveness ("eff"), cost ("cost"), net health benefit ("nhb"), net monetary
benefit ("nmb"), or the opportunity loss in terms of NHB or NMB ("nhb_loss"
and "nmb_loss", respectively). "nmb_loss_voi" and "nhb_loss_voi" are only
used in internal function calls of metamodel within other VOI functions.
wtp if outcome is NHB or NMB (or the associated loss), must provide the willingness-
to-pay threshold
strategies vector of strategies to consider. The default (NULL) is that all strategies are
considered.
poly.order order of polynomial for the linear regression metamodel. Default: 2

Value
twsa A ggplot2 object with the TWSA graph of param1 and param2 on the outcome of interest.
Index

∗ acceptability ∗ method
ceac, 10 dirichlet_params, 14
∗ benefit gamma_params, 15
calc_evpi, 5 lnorm_params, 20
∗ beta ∗ moments
beta_params, 3 beta_params, 3
∗ cost-effectiveness dirichlet_params, 14
ceac, 10 gamma_params, 15
∗ curves lnorm_params, 20
ceac, 10 ∗ monetary
∗ datasets calc_evpi, 5
example_psa, 15 ∗ net
example_psa_obj, 15 calc_evpi, 5
hund_strat, 19 ∗ of
psa_cdiff, 37 beta_params, 3
∗ dirichlet calc_evpi, 5
dirichlet_params, 14 dirichlet_params, 14
∗ distribution; gamma_params, 15
beta_params, 3 lnorm_params, 20
dirichlet_params, 14 plot.evpi, 27
gamma_params, 15 plot.evppi, 28
plot.evsi, 29
lnorm_params, 20
∗ perfect
∗ expected
calc_evpi, 5
calc_evpi, 5
plot.evpi, 27
plot.evpi, 27
plot.evppi, 28
plot.evppi, 28
∗ sample
plot.evsi, 29
plot.evsi, 29
∗ gamma
∗ value
gamma_params, 15
calc_evpi, 5
∗ information; plot.evpi, 27
calc_evpi, 5 plot.evppi, 28
∗ information plot.evsi, 29
plot.evpi, 27
plot.evppi, 28 beta_params, 3
plot.evsi, 29
∗ log-normal calc_evpi, 5, 22, 27, 28, 31
lnorm_params, 20 calc_evppi, 6, 28, 29
∗ methods calc_evsi, 8, 29, 30
beta_params, 3 calc_exp_loss, 9, 22, 31

44
INDEX 45

calculate_icers, 4, 22, 31 scale_continuous, 32


ceac, 10, 22 summary.ceac, 10
choose.k, 23 summary.metamodel, 42
create_dsa_oneway, 11 summary.psa, 22, 42
create_dsa_twoway, 12
twsa, 13, 22, 24, 43
dirichlet_params, 14

example_psa, 15
example_psa_obj, 15
expansion, 32

facet_grid, 33
facet_wrap, 33

gamma_params, 15
gen_psa_samp, 17, 40

hund_strat, 19

lnorm_params, 20

make.names, 12, 13, 21


make_psa_obj, 5, 6, 8–10, 21, 24, 40, 43
metamodel, 22, 22

null.space.dimension, 23

owsa, 11, 12, 22, 24, 24


owsa_opt_strat, 25, 25
owsa_tornado, 25, 26

plot.ceac, 10
plot.evpi, 5, 27
plot.evppi, 28
plot.evsi, 29
plot.exp_loss, 9, 30
plot.icers, 4, 31
plot.owsa, 25, 33
plot.psa, 22, 34
plot.twsa, 35
predict.metamodel, 24, 36
print.metamodel, 36
print.sa, 37
psa_cdiff, 37

rdirichlet, 38
rlnorm, 18
run_owsa_det, 24, 38, 43
run_psa, 18, 39, 40
run_twsa_det, 40

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy