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.age = 45,
  sd.age = 15,
  prob.dm = 0.12,
  prob.urgent = 0.05,
  uk = FALSE,
  seed.number = 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.age

A value for mean age's distribution.

sd.age

A value for standard deviation age's distribution.

prob.dm

A value for the probability of having Diabetes Mellitus.

prob.urgent

A value for the probability of being clinical urgent.

uk

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

seed.number

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, prob.urgent = 0.05,
uk = FALSE, seed.number = 3)
#> # A tibble: 10 × 13
#>    ID    bg    A1    A2    B1    B2    DR1   DR2     age  cPRA hiper dialysis
#>    <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <lgl>    <dbl>
#>  1 K1    O     1     29    8     44    11    7        37     0 FALSE       80
#>  2 K2    A     2     3     7     57    4     8        42     0 FALSE       49
#>  3 K3    O     11    33    14    35    1     13       68     0 FALSE       49
#>  4 K4    O     24    30    49    58    11    11       46     0 FALSE       36
#>  5 K5    A     2     3     7     51    1     13       47    76 FALSE       38
#>  6 K6    A     30    68    15    18    3     4        71    25 FALSE       44
#>  7 K7    O     3     26    18    40    11    13       52    91 TRUE        99
#>  8 K8    O     1     1     7     8     3     13       26     0 FALSE       69
#>  9 K9    A     3     3     7     44    15    8        35     0 FALSE       27
#> 10 K10   A     11    29    44    57    7     7        38     0 FALSE       10
#> # ℹ 1 more variable: urgent <dbl>