Skip to contents

Returns a data frame for simulated donors clinical and demographic characteristics.

Usage

candidates_df(
  n = 10,
  replace = TRUE,
  origin = "PT",
  probs_abo = c(0.43, 0.03, 0.08, 0.46),
  probs_cpra = c(0.7, 0.1, 0.1, 0.1),
  lower = 18,
  upper = 75,
  mean = 45,
  sd = 15,
  prob_dm = 0.12,
  uk = FALSE,
  n_seed = 3
)

Arguments

n

An integer to define the number of rows

replace

A logical value for sampling with replacement

origin

A character value for population origin from options: 'PT', 'API', 'AFA', 'CAU' and 'HIS'

probs_abo

A vector with the probabilities for blood group A, AB, B and O (in this order). The sum of the probabilities must be equal to one.

probs_cpra

A vector with the probabilities for cPRA groups 0%, 1%-50%, 51%-84%, 85%-100% (in this order). The sum of the probabilities must be equal to one.

lower

An integer for ages' lower limit.

upper

An integer for ages' upper limit.

mean

A value for mean age's distribution.

sd

A value for standard deviation age's distribution.

prob_dm

A value for the probability of having Diabetes Mellitus

uk

A logical value, if TRUE is also computed the Donor Risk Index (DRI)

n_seed

a numeric seed that will be used for random number generation.

Value

A data frame with HLA typing, blood group, truncated ages, time on dialysis (in months), cPRA, Tier, MS and RRI (those last 3, only when uk = TRUE) for a simulated group of transplant candidates.

Examples

candidates_df(n = 10, replace = TRUE, origin = 'PT',
probs_abo = c(0.43, 0.03, 0.08, 0.46), probs_cpra = c(0.7, 0.1, 0.1, 0.1),
lower=18, upper=75, mean = 45, sd = 15,
prob_dm = 0.12,
uk = FALSE, n_seed = 3)
#> # A tibble: 10 x 12
#>    ID    bg       A1    A2    B1    B2   DR1   DR2   age  cPRA hiper dialysis
#>    <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <lgl>    <dbl>
#>  1 K1    A         1    29     8    44    11     7    36     0 FALSE       49
#>  2 K2    O         2     3     7    57     4     8    21     0 FALSE       22
#>  3 K3    A        11    33    14    35     1    13    26    21 FALSE       55
#>  4 K4    O        24    30    49    58    11    11    37     0 FALSE       98
#>  5 K5    O         2     3     7    51     1    13    47     0 FALSE       89
#>  6 K6    A        30    68    15    18     3     4    25     0 FALSE       22
#>  7 K7    O         3    26    18    40    11    13    56     0 FALSE       79
#>  8 K8    A         1     1     7     8     3    13    72    90 TRUE        81
#>  9 K9    O         3     3     7    44    15     8    47    60 FALSE       65
#> 10 K10   O        11    29    44    57     7     7    30     0 FALSE       42