pfree.calc: Probability of freedom over time

Description Usage Arguments Value Examples

View source: R/freedom_functions_1.R

Description

Calculates the probability (confidence) of disease freedom for given prior, sep and p.intro over 1 or more time periods

Usage

1
pfree.calc(sep, p.intro, prior = 0.5, discount.1 = TRUE)

Arguments

sep

population sensitivity for each time period (vector)

p.intro

probability of introduction for each time period (scalar or vector of same length as sep)

prior

prior probability of freedom before surveillance (scalar)

discount.1

logical variable whether or not to discount first time period.

Value

data.frame with columns for sep, p.intro, discounted prior, probability of freedom, equilibrium probability of freedom and equilibrium prior

Examples

1
2
3
4
5
6
7
# examples for pfree.calc
pfree.calc(0.8, 0.01, 0.5)
pfree.calc(0.8, 0.01, 0.5, FALSE)
pfree.calc(rep(0.6,24), 0.01, 0.5)
pfree.calc(rep(0.6,24), 0.01, 0.5, FALSE)
pfree.calc(runif(10, 0.4, 0.6), 0.01, 0.5)
pfree.calc(runif(10, 0.4, 0.6), runif(10, 0.005, 0.015), 0.5)

Example output

  Period SeP PIntro Discounted.prior     PFree Equilibrium.PFree
1      1 0.8   0.01            0.495 0.8305369         0.9974747
  Equilibrium.prior
1            0.9875
  Period SeP PIntro Discounted.prior     PFree Equilibrium.PFree
1      1 0.8      0              0.5 0.8333333                 1
  Equilibrium.prior
1                 1
   Period SeP PIntro Discounted.prior     PFree Equilibrium.PFree
1       1 0.6   0.01        0.4950000 0.7101865          0.993266
2       2 0.6   0.01        0.7030846 0.8554894          0.993266
3       3 0.6   0.01        0.8469345 0.9325822          0.993266
4       4 0.6   0.01        0.9232564 0.9678208          0.993266
5       5 0.6   0.01        0.9581426 0.9828257          0.993266
6       6 0.6   0.01        0.9729975 0.9890211          0.993266
7       7 0.6   0.01        0.9791309 0.9915465          0.993266
8       8 0.6   0.01        0.9816310 0.9925705          0.993266
9       9 0.6   0.01        0.9826448 0.9929849          0.993266
10     10 0.6   0.01        0.9830550 0.9931524          0.993266
11     11 0.6   0.01        0.9832209 0.9932201          0.993266
12     12 0.6   0.01        0.9832879 0.9932474          0.993266
13     13 0.6   0.01        0.9833150 0.9932585          0.993266
14     14 0.6   0.01        0.9833259 0.9932630          0.993266
15     15 0.6   0.01        0.9833303 0.9932648          0.993266
16     16 0.6   0.01        0.9833321 0.9932655          0.993266
17     17 0.6   0.01        0.9833328 0.9932658          0.993266
18     18 0.6   0.01        0.9833331 0.9932659          0.993266
19     19 0.6   0.01        0.9833333 0.9932660          0.993266
20     20 0.6   0.01        0.9833333 0.9932660          0.993266
21     21 0.6   0.01        0.9833333 0.9932660          0.993266
22     22 0.6   0.01        0.9833333 0.9932660          0.993266
23     23 0.6   0.01        0.9833333 0.9932660          0.993266
24     24 0.6   0.01        0.9833333 0.9932660          0.993266
   Equilibrium.prior
1          0.9833333
2          0.9833333
3          0.9833333
4          0.9833333
5          0.9833333
6          0.9833333
7          0.9833333
8          0.9833333
9          0.9833333
10         0.9833333
11         0.9833333
12         0.9833333
13         0.9833333
14         0.9833333
15         0.9833333
16         0.9833333
17         0.9833333
18         0.9833333
19         0.9833333
20         0.9833333
21         0.9833333
22         0.9833333
23         0.9833333
24         0.9833333
   Period SeP PIntro Discounted.prior     PFree Equilibrium.PFree
1       1 0.6   0.00        0.5000000 0.7142857          1.000000
2       2 0.6   0.01        0.7071429 0.8578856          0.993266
3       3 0.6   0.01        0.8493068 0.9337309          0.993266
4       4 0.6   0.01        0.9243936 0.9683203          0.993266
5       5 0.6   0.01        0.9586371 0.9830338          0.993266
6       6 0.6   0.01        0.9732035 0.9891062          0.993266
7       7 0.6   0.01        0.9792152 0.9915811          0.993266
8       8 0.6   0.01        0.9816653 0.9925845          0.993266
9       9 0.6   0.01        0.9826587 0.9929905          0.993266
10     10 0.6   0.01        0.9830606 0.9931547          0.993266
11     11 0.6   0.01        0.9832231 0.9932210          0.993266
12     12 0.6   0.01        0.9832888 0.9932478          0.993266
13     13 0.6   0.01        0.9833153 0.9932587          0.993266
14     14 0.6   0.01        0.9833261 0.9932630          0.993266
15     15 0.6   0.01        0.9833304 0.9932648          0.993266
16     16 0.6   0.01        0.9833321 0.9932655          0.993266
17     17 0.6   0.01        0.9833329 0.9932658          0.993266
18     18 0.6   0.01        0.9833331 0.9932659          0.993266
19     19 0.6   0.01        0.9833333 0.9932660          0.993266
20     20 0.6   0.01        0.9833333 0.9932660          0.993266
21     21 0.6   0.01        0.9833333 0.9932660          0.993266
22     22 0.6   0.01        0.9833333 0.9932660          0.993266
23     23 0.6   0.01        0.9833333 0.9932660          0.993266
24     24 0.6   0.01        0.9833333 0.9932660          0.993266
   Equilibrium.prior
1          1.0000000
2          0.9833333
3          0.9833333
4          0.9833333
5          0.9833333
6          0.9833333
7          0.9833333
8          0.9833333
9          0.9833333
10         0.9833333
11         0.9833333
12         0.9833333
13         0.9833333
14         0.9833333
15         0.9833333
16         0.9833333
17         0.9833333
18         0.9833333
19         0.9833333
20         0.9833333
21         0.9833333
22         0.9833333
23         0.9833333
24         0.9833333
   Period       SeP PIntro Discounted.prior     PFree Equilibrium.PFree
1       1 0.5461889   0.01        0.4950000 0.6835368         0.9916074
2       2 0.5804358   0.01        0.6767015 0.8330213         0.9926986
3       3 0.4652301   0.01        0.8246911 0.8979249         0.9883892
4       4 0.5546324   0.01        0.8889457 0.9472936         0.9918889
5       5 0.5597547   0.01        0.9378206 0.9716387         0.9920556
6       6 0.5058342   0.01        0.9619223 0.9808138         0.9901320
7       7 0.4035632   0.01        0.9710056 0.9825019         0.9850714
8       8 0.4248446   0.01        0.9726769 0.9841004         0.9863252
9       9 0.5836574   0.01        0.9742594 0.9891196         0.9927946
10     10 0.5985031   0.01        0.9792284 0.9915553         0.9932239
   Equilibrium.prior
1          0.9816913
2          0.9827716
3          0.9785053
4          0.9819700
5          0.9821350
6          0.9802307
7          0.9752207
8          0.9764620
9          0.9828667
10         0.9832916
   Period       SeP      PIntro Discounted.prior     PFree Equilibrium.PFree
1       1 0.4336293 0.009174317        0.4954128 0.6341721         0.9879063
2       2 0.5006551 0.014358534        0.6250663 0.7695136         0.9854704
3       3 0.4438684 0.008933015        0.7626395 0.8524511         0.9887068
4       4 0.4256178 0.007662213        0.8459194 0.9052877         0.9895798
5       5 0.5369086 0.006093727        0.8997711 0.9509450         0.9947118
6       6 0.5114637 0.005906983        0.9453278 0.9725223         0.9943243
7       7 0.5871751 0.013165133        0.9597189 0.9829681         0.9906205
8       8 0.5209178 0.012483374        0.9706974 0.9857440         0.9883741
9       9 0.4625478 0.011260714        0.9746438 0.9862105         0.9867667
10     10 0.5822418 0.005391283        0.9808936 0.9919284         0.9961108
   Equilibrium.prior
1          0.9788429
2          0.9713205
3          0.9798746
4          0.9819974
5          0.9886503
6          0.9884508
7          0.9775789
8          0.9760358
9          0.9756550
10         0.9907405

RSurveillance documentation built on July 2, 2020, 2:33 a.m.