This function runs a deterministic two-way sensitivity analysis (TWSA) on a given function that produces outcomes.
twsa_det(
parm1,
parm2,
ranges,
nsamps = 40,
params_basecase,
FUN,
outcome,
strategies = NULL,
progress = TRUE,
...
)String with the name of the first parameter of interest
String with the name of the second parameter of interest
A named list of the form list("parm1" = c(0, 1), ...) that gives
the ranges for the parameters of interest. The list is matched to
parm1 and parm2 by name, so the order of its elements does not
matter. The number of samples from each range is determined by nsamps
Number of parameter values to evaluate for each parameter, so
that FUN is evaluated nsamps^2 times. Default = 40
List with parameters for the base case
Function that takes params_basecase and ... and
produces outcome of interest
String with the name of the outcome of interest produced by
FUN
vector of strategy names. The default (NULL) will use strategy names in FUN
Logical variable to display the simulation progress. Default = TRUE
Further arguments to FUN (not used)
A dataframe with the results of the sensitivity analysis. Can be
visualized with plot.twsa from dampack
FUN must return a dataframe where the first column are the strategy names and the rest of the columns must be outcomes.
# \donttest{
l_params_all <- load_all_params()
twsa_det(parm1 = "u_S1",
parm2 = "u_Trt",
ranges = list("u_S1" = c(0.70, 0.80),
"u_Trt" = c(0.90, 1.00)),
nsamps = 5,
params_basecase = l_params_all,
FUN = calculate_ce_out,
outcome = "NMB",
n_wtp = 150000)
#>
8 % done
20 % done
32 % done
40 % done
48 % done
60 % done
72 % done
80 % done
88 % done
100 % done
#> u_S1 u_Trt strategy outcome_val
#> 1 0.700 0.900 No Treatment 2858704
#> 2 0.725 0.900 No Treatment 2871869
#> 3 0.750 0.900 No Treatment 2885035
#> 4 0.775 0.900 No Treatment 2898200
#> 5 0.800 0.900 No Treatment 2911366
#> 6 0.700 0.925 No Treatment 2858704
#> 7 0.725 0.925 No Treatment 2871869
#> 8 0.750 0.925 No Treatment 2885035
#> 9 0.775 0.925 No Treatment 2898200
#> 10 0.800 0.925 No Treatment 2911366
#> 11 0.700 0.950 No Treatment 2858704
#> 12 0.725 0.950 No Treatment 2871869
#> 13 0.750 0.950 No Treatment 2885035
#> 14 0.775 0.950 No Treatment 2898200
#> 15 0.800 0.950 No Treatment 2911366
#> 16 0.700 0.975 No Treatment 2858704
#> 17 0.725 0.975 No Treatment 2871869
#> 18 0.750 0.975 No Treatment 2885035
#> 19 0.775 0.975 No Treatment 2898200
#> 20 0.800 0.975 No Treatment 2911366
#> 21 0.700 1.000 No Treatment 2858704
#> 22 0.725 1.000 No Treatment 2871869
#> 23 0.750 1.000 No Treatment 2885035
#> 24 0.775 1.000 No Treatment 2898200
#> 25 0.800 1.000 No Treatment 2911366
#> 26 0.700 0.900 Treatment 2866452
#> 27 0.725 0.900 Treatment 2866452
#> 28 0.750 0.900 Treatment 2866452
#> 29 0.775 0.900 Treatment 2866452
#> 30 0.800 0.900 Treatment 2866452
#> 31 0.700 0.925 Treatment 2879617
#> 32 0.725 0.925 Treatment 2879617
#> 33 0.750 0.925 Treatment 2879617
#> 34 0.775 0.925 Treatment 2879617
#> 35 0.800 0.925 Treatment 2879617
#> 36 0.700 0.950 Treatment 2892783
#> 37 0.725 0.950 Treatment 2892783
#> 38 0.750 0.950 Treatment 2892783
#> 39 0.775 0.950 Treatment 2892783
#> 40 0.800 0.950 Treatment 2892783
#> 41 0.700 0.975 Treatment 2905948
#> 42 0.725 0.975 Treatment 2905948
#> 43 0.750 0.975 Treatment 2905948
#> 44 0.775 0.975 Treatment 2905948
#> 45 0.800 0.975 Treatment 2905948
#> 46 0.700 1.000 Treatment 2919114
#> 47 0.725 1.000 Treatment 2919114
#> 48 0.750 1.000 Treatment 2919114
#> 49 0.775 1.000 Treatment 2919114
#> 50 0.800 1.000 Treatment 2919114
# }