Skip to contents

This function generates seropositivity probabilities based on either a time-varying FOI model, an age-varying FOI model, or an age-and-time-varying FOI model. In all cases, it is possible to optionally include seroreversion.

Usage

probability_seropositive_by_age(model, foi, seroreversion_rate = 0)

Arguments

model

A string specifying the model type which can be one of 'age', 'time', 'age-time'.

foi

A dataframe containing the force of infection (FOI) values. For time-varying models the columns should be 'year', 'foi'. For age-varying models the columns should be 'age', 'foi'. For age-and-time-varying models the columns should be 'age', 'time', 'foi'.

seroreversion_rate

A non-negative value determining the rate of seroreversion (per year). Default is 0.

Value

A dataframe with columns 'age' and 'seropositivity'.

Examples

probability_seropositive_by_age(
  model = "age",
  foi = data.frame(
    age = 1:80,
    foi = rep(0.01, 80)
  )
)
#>    age seropositivity
#> 1    1    0.009950166
#> 2    2    0.019801327
#> 3    3    0.029554466
#> 4    4    0.039210561
#> 5    5    0.048770575
#> 6    6    0.058235466
#> 7    7    0.067606180
#> 8    8    0.076883654
#> 9    9    0.086068815
#> 10  10    0.095162582
#> 11  11    0.104165865
#> 12  12    0.113079563
#> 13  13    0.121904569
#> 14  14    0.130641765
#> 15  15    0.139292024
#> 16  16    0.147856211
#> 17  17    0.156335183
#> 18  18    0.164729789
#> 19  19    0.173040866
#> 20  20    0.181269247
#> 21  21    0.189415754
#> 22  22    0.197481202
#> 23  23    0.205466397
#> 24  24    0.213372139
#> 25  25    0.221199217
#> 26  26    0.228948414
#> 27  27    0.236620506
#> 28  28    0.244216259
#> 29  29    0.251736432
#> 30  30    0.259181779
#> 31  31    0.266553044
#> 32  32    0.273850963
#> 33  33    0.281076267
#> 34  34    0.288229677
#> 35  35    0.295311910
#> 36  36    0.302323674
#> 37  37    0.309265669
#> 38  38    0.316138591
#> 39  39    0.322943126
#> 40  40    0.329679954
#> 41  41    0.336349750
#> 42  42    0.342953180
#> 43  43    0.349490905
#> 44  44    0.355963579
#> 45  45    0.362371848
#> 46  46    0.368716354
#> 47  47    0.374997732
#> 48  48    0.381216608
#> 49  49    0.387373606
#> 50  50    0.393469340
#> 51  51    0.399504421
#> 52  52    0.405479452
#> 53  53    0.411395030
#> 54  54    0.417251748
#> 55  55    0.423050190
#> 56  56    0.428790936
#> 57  57    0.434474561
#> 58  58    0.440101633
#> 59  59    0.445672715
#> 60  60    0.451188364
#> 61  61    0.456649131
#> 62  62    0.462055562
#> 63  63    0.467408199
#> 64  64    0.472707576
#> 65  65    0.477954223
#> 66  66    0.483148666
#> 67  67    0.488291422
#> 68  68    0.493383008
#> 69  69    0.498423931
#> 70  70    0.503414696
#> 71  71    0.508355803
#> 72  72    0.513247744
#> 73  73    0.518091010
#> 74  74    0.522886084
#> 75  75    0.527633447
#> 76  76    0.532333573
#> 77  77    0.536986932
#> 78  78    0.541593989
#> 79  79    0.546155205
#> 80  80    0.550671036