Skip to contents

Run infectious disease models models

Usage

run_infectiousdisease_model(time, init, params, model_type)

Arguments

time

vector of time units over which to run model

init

initial population size of population

params

vector of beta (infection rate), m (natural birth/death rate), and gamma (recovery rate)

model_type

which type of model to run? (should be one of SIR, SIR_ft, SEIR, SEIR_ft, SIRD, SIRD_ft, SIS, or SIS_ft)

See also

plot_infectiousdisease_time() to plot trajectories over time, and plot_infectiousdisease_portrait() to plot pairwise portrait diagrams

Examples

# Run the SIR model
params_vec <- c(m = .1, beta = .01, v = .2, gamma = 0)
init_vec <- c(S = 100, I = 1, R = 0)
time_vec <- seq(0, 10, 0.1)
run_infectiousdisease_model(time = time_vec, init = init_vec, params =
params_vec, model_type = "SIR")
#>     time         S         I          R
#> 1    0.0 100.00000  1.000000  0.0000000
#> 2    0.1  99.70499  1.094015  0.2009934
#> 3    0.2  99.40350  1.196509  0.3999868
#> 4    0.3  99.09479  1.308208  0.5970002
#> 5    0.4  98.77806  1.429887  0.7920533
#> 6    0.5  98.45245  1.562382  0.9851656
#> 7    0.6  98.11705  1.706590  1.1763564
#> 8    0.7  97.77088  1.863473  1.3656448
#> 9    0.8  97.41289  2.034062  1.5530498
#> 10   0.9  97.04195  2.219459  1.7385900
#> 11   1.0  96.65688  2.420839  1.9222841
#> 12   1.1  96.25640  2.639454  2.1041504
#> 13   1.2  95.83916  2.876635  2.2842071
#> 14   1.3  95.40373  3.133794  2.4624723
#> 15   1.4  94.94861  3.412422  2.6389636
#> 16   1.5  94.47221  3.714093  2.8136988
#> 17   1.6  93.97284  4.040461  2.9866954
#> 18   1.7  93.44877  4.393261  3.1579707
#> 19   1.8  92.89816  4.774301  3.3275417
#> 20   1.9  92.31911  5.185460  3.4954255
#> 21   2.0  91.70968  5.628684  3.6616388
#> 22   2.1  91.06783  6.105971  3.8261982
#> 23   2.2  90.39151  6.619367  3.9891202
#> 24   2.3  89.67863  7.170949  4.1504212
#> 25   2.4  88.92707  7.762808  4.3101172
#> 26   2.5  88.13474  8.397034  4.4682242
#> 27   2.6  87.29955  9.075689  4.6247579
#> 28   2.7  86.41948  9.800787  4.7797342
#> 29   2.8  85.49257 10.574259  4.9331684
#> 30   2.9  84.51700 11.397928  5.0850759
#> 31   3.0  83.49106 12.273468  5.2354719
#> 32   3.1  82.41326 13.202371  5.3843715
#> 33   3.2  81.28231 14.185902  5.5317894
#> 34   3.3  80.09720 15.225063  5.6777406
#> 35   3.4  78.85722 16.320545  5.8222395
#> 36   3.5  77.56201 17.472688  5.9653006
#> 37   3.6  76.21162 18.681438  6.1069382
#> 38   3.7  74.80653 19.946307  6.2471665
#> 39   3.8  73.34766 21.266340  6.3859995
#> 40   3.9  71.83647 22.640082  6.5234511
#> 41   4.0  70.27491 24.065557  6.6595350
#> 42   4.1  68.66548 25.540252  6.7942649
#> 43   4.2  67.01123 27.061111  6.9276542
#> 44   4.3  65.31574 28.624541  7.0597163
#> 45   4.4  63.58310 30.226432  7.1904643
#> 46   4.5  61.81791 31.862182  7.3199113
#> 47   4.6  60.02519 33.526743  7.4480703
#> 48   4.7  58.21037 35.214671  7.5749542
#> 49   4.8  56.37923 36.920196  7.7005755
#> 50   4.9  54.53777 38.637288  7.8249468
#> 51   5.0  52.69217 40.359744  7.9480806
#> 52   5.1  50.84874 42.081275  8.0699893
#> 53   5.2  49.01372 43.795591  8.1906849
#> 54   5.3  47.19333 45.496491  8.3101796
#> 55   5.4  45.39356 47.177953  8.4284853
#> 56   5.5  43.62017 48.834211  8.5456138
#> 57   5.6  41.87859 50.459833  8.6615769
#> 58   5.7  40.17383 52.049781  8.7763861
#> 59   5.8  38.51048 53.599466  8.8900530
#> 60   5.9  36.89262 55.104794  9.0025888
#> 61   6.0  35.32381 56.562188  9.1140049
#> 62   6.1  33.80708 57.968612  9.2243124
#> 63   6.2  32.34490 59.321574  9.3335223
#> 64   6.3  30.93924 60.619119  9.4416456
#> 65   6.4  29.59149 61.859818  9.5486930
#> 66   6.5  28.30258 63.042742  9.6546753
#> 67   6.6  27.07297 64.167430  9.7596030
#> 68   6.7  25.90265 65.233859  9.8634867
#> 69   6.8  24.79126 66.242398  9.9663367
#> 70   6.9  23.73806 67.193772 10.0681634
#> 71   7.0  22.74201 68.089015 10.1689768
#> 72   7.1  21.80178 68.929428 10.2687872
#> 73   7.2  20.91586 69.716538 10.3676044
#> 74   7.3  20.08250 70.452057 10.4654384
#> 75   7.4  19.29986 71.137845 10.5622989
#> 76   7.5  18.56593 71.775873 10.6581956
#> 77   7.6  17.87867 72.368194 10.7531382
#> 78   7.7  17.23595 72.916911 10.8471360
#> 79   7.8  16.63565 73.424153 10.9401986
#> 80   7.9  16.07561 73.892054 11.0323351
#> 81   8.0  15.55371 74.322733 11.1235549
#> 82   8.1  15.06786 74.718277 11.2138670
#> 83   8.2  14.61599 75.080728 11.3032806
#> 84   8.3  14.19612 75.412073 11.3918044
#> 85   8.4  13.80632 75.714234 11.4794474
#> 86   8.5  13.44472 75.989063 11.5662184
#> 87   8.6  13.10954 76.238335 11.6521259
#> 88   8.7  12.79907 76.463747 11.7371787
#> 89   8.8  12.51170 76.666915 11.8213852
#> 90   8.9  12.24587 76.849374 11.9047538
#> 91   9.0  12.00013 77.012574 11.9872929
#> 92   9.1  11.77310 77.157888 12.0690107
#> 93   9.2  11.56348 77.286609 12.1499154
#> 94   9.3  11.37003 77.399952 12.2300150
#> 95   9.4  11.19162 77.499058 12.3093177
#> 96   9.5  11.02717 77.584996 12.3878313
#> 97   9.6  10.87567 77.658767 12.4655637
#> 98   9.7  10.73617 77.721304 12.5425226
#> 99   9.8  10.60780 77.773480 12.6187158
#> 100  9.9  10.48974 77.816107 12.6941508
#> 101 10.0  10.38122 77.849943 12.7688353