gen_psa_samp: Generate PSA Sample

Description Usage Arguments Details Value See Also Examples

View source: R/gen_psa_samp.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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:

Value

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

See Also

run_psa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#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)

DARTH-git/dampack documentation built on Aug. 8, 2021, 2:58 a.m.