do_nmb_sim {predictNMB} | R Documentation |
Do the predictNMB simulation, evaluating the net monetary benefit (NMB) of the simulated model.
Description
Do the predictNMB simulation, evaluating the net monetary benefit (NMB) of the simulated model.
Usage
do_nmb_sim(
sample_size,
n_sims,
n_valid,
sim_auc,
event_rate,
cutpoint_methods = get_inbuilt_cutpoint_methods(),
fx_nmb_training,
fx_nmb_evaluation,
meet_min_events = TRUE,
min_events = NA,
show_progress = FALSE,
cl = NULL
)
Arguments
sample_size |
Sample size of training set. If missing, a sample size calculation will be performed and the calculated size will be used. |
n_sims |
Number of simulations to run. |
n_valid |
Sample size for evaluation set. |
sim_auc |
Simulated model discrimination (AUC). |
event_rate |
Simulated event rate of the binary outcome being predicted. Also known as prevalence. |
cutpoint_methods |
A value or vector of cutpoint methods to include. Defaults to use the inbuilt methods:
User-defined cutpoint methods can be used by passing the name of a function that takes the following arguments:
See |
fx_nmb_training |
Function or |
fx_nmb_evaluation |
Function or |
meet_min_events |
Whether or not to incrementally add samples until the
expected number of events ( |
min_events |
The minimum number of events to include in the training
sample. If less than this number are included in sample of size
|
show_progress |
Logical. Whether to display a progress bar. Requires the
|
cl |
A cluster made using |
Details
This function runs a simulation for a given set of inputs that represent a
healthcare setting using model-guided interventions.
The arguments fx_nmb_training
and fx_nmb_evaluation
should be functions that capture the treatment being used, its costs and
effectiveness, and the costs of the outcome being treated/prevented.
Both of these are functions that return a named vector of NMB values when
called and are used for obtaining and evaluating cutpoints, respectively.
For example, the following function returns the appropriately named vector.
get_nmb <- function() c("TP" = -3, "TN" = 0, "FP" = -1, "FN" = -4)
There is a helper function, get_nmb_sampler()
, to help you
create these.
Value
Returns a predictNMBsim
object.
Examples
get_nmb <- function() c("TP" = -3, "TN" = 0, "FP" = -1, "FN" = -4)
do_nmb_sim(
sample_size = 200, n_sims = 50, n_valid = 10000, sim_auc = 0.7,
event_rate = 0.1, fx_nmb_training = get_nmb, fx_nmb_evaluation = get_nmb
)