Skip to contents

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

Usage

donors_df(
  n = 10,
  replace = TRUE,
  origin = "PT",
  probs = c(0.4658, 0.0343, 0.077, 0.4229),
  lower = 18,
  upper = 75,
  mean.age = 60,
  sd.age = 12,
  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

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.

lower

An integer for ages' lower limit.

upper

An integer for ages' upper limit.

mean.age

A value for mean on age's distribution.

sd.age

A value for standard deviation on age's distribution.

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 and truncated ages for a simulated group of transplant donors.

Examples

donors_df(n = 10, replace = TRUE, origin = 'PT',
probs = c(0.4658, 0.0343, 0.077, 0.4229),
lower=18, upper=75, mean.age = 55, sd.age = 15,
uk = FALSE, seed.number = 3)
#> # A tibble: 10 × 9
#>    ID    bg    A1    A2    B1    B2    DR1   DR2     age
#>    <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
#>  1 D1    A     1     29    8     44    11    7        47
#>  2 D2    O     2     3     7     57    4     8        52
#>  3 D3    A     11    33    14    35    1     13       56
#>  4 D4    O     24    30    49    58    11    11       57
#>  5 D5    B     2     3     7     51    1     13       62
#>  6 D6    A     30    68    15    18    3     4        36
#>  7 D7    O     3     26    18    40    11    13       45
#>  8 D8    B     1     1     7     8     3     13       48
#>  9 D9    O     3     3     7     44    15    8        73
#> 10 D10   A     11    29    44    57    7     7        60