this is the simulation function

run_simulation(
  recip_matrix,
  donor_matrix,
  algorithm_FUN,
  eligible_FUN,
  matching_FUN,
  waitlist_FUN,
  national_algorithm_threshold = 5.4e+07,
  state_algorithm = TRUE,
  state_algorithm_FUN = NULL,
  state_eligible_FUN = NULL,
  state_matching_FUN = NULL,
  resampleN = 20,
  num_donor = 800,
  num_recip = 300,
  is_parallel = FALSE,
  ncores = 2,
  verbose = TRUE,
  waitlist_arg = list(waitlist_Risk = TRUE, rate_in = 0.7, rate_out = 0.4,
    yearly_scale_in = c(sort(1 + rexp(length(tx_date_ranges), 1/0.1))), yearly_scale_out
    = c(sort(runif(length(tx_date_ranges), 0.3, 1), decreasing = TRUE))),
  eligible_arg = list(AB_priority = TRUE),
  state_eligible_arg = list(),
  matching_arg = list(),
  state_matching_arg = list(),
  state_balance = TRUE,
  dynamic_waitlist = TRUE,
  National_II = TRUE
)

Arguments

recip_matrix

a matrix, indicating the recipient matrix

donor_matrix

a matrix, indicating the donor matrix

algorithm_FUN

a function, this is the allocation algorithm

eligible_FUN

a function, this is the eligible recipient pool function

matching_FUN

a function, this is the selection function

waitlist_FUN

a function,this is the waiting list function

national_algorithm_threshold

an integer value, gives the threshold number to run national-state algorithm

state_algorithm

a boolean value, TRUE/FALSE, whether to have state algorithm or not

state_algorithm_FUN

a function, state algorithm function

state_eligible_FUN

a function, state eligible function

state_matching_FUN

a function, state matching function

resampleN

an integer value, number of simulation results

num_donor

an integer value, number of donor

num_recip

an integer value, number of recipients

is_parallel

a boolean value, TRUE/FALSE, to run paralel or not

ncores

an integer value, number of cores

verbose

a boolean value, TRUE/FALSE, verbose indicator

waitlist_arg

a list,arguments for the wl

eligible_arg

a list,arguments for the eligible pool

state_eligible_arg

a list,arguments for the state eligible pool

matching_arg

a list,arguments for matching functions

state_matching_arg

a list,arguments for state matching functions

state_balance

a boolean value, TRUE/FALSE, state balance adjustment indicator

dynamic_waitlist

a boolean value, TRUE/FALSE, whether to have dynamic wl or not

National_II

a boolean value, TRUE/FALSE, national algorithm round two indicator

Value

a list with 2 objects, a data.frame with matched recipient and donor features, another data.frame with the discarded kidneys if any

Examples

data("newdata", package = "simKAP") simulation_result <-run_simulation(raw_recip_matrix_subset, raw_donor_matrix, algorithm_FUN = allocation_national,eligible_FUN = selection_default, matching_FUN = dm_national_formula,waitlist_FUN = dynamic_waitlist, state_algorithm = TRUE,national_algorithm_threshold = 54000000, state_algorithm_FUN = australia_state_algorithm, state_eligible_FUN = australia_state_selection, state_matching_FUN = dm_state_formula,eligible_arg = list(AB_priority = TRUE), resampleN = 1, waitlist_arg = list(waitlist_Risk = TRUE,rate_in = 0.70,rate_out = 0.40),, verbose = FALSE,num_donor = 800,num_recip = 300, state_balance = TRUE,dynamic_waitlist = TRUE, National_II = TRUE);