n.freecalc: Freecalc sample size for a finite population and specified...

Description Usage Arguments Value Examples

View source: R/freedom_functions_2.R

Description

Calculates sample size required for a specified population sensitivity, for a given population size, cut-point number of positives and other parameters, using Freecalc algorithm. All paramaters must be scalars

Usage

1
n.freecalc(N, sep = 0.95, c = 1, se, sp = 1, pstar, minSpH = 0.95)

Arguments

N

population size

sep

target population sensitivity

c

The cut-point number of positives to classify a cluster as positive, default=1, if positives < c result is negative, >= c is positive

se

test unit sensitivity

sp

test unit specificity, default=1

pstar

design prevalence as a proportion or integer (number of infected units)

minSpH

minimium desired population specificity

Value

a list of 2 elements, a dataframe with 1 row and six columns for the recommended sample size and corresponding values for population sensitivity (SeP), population specificity (SpP), N, c and pstar and a dataframe of n rows with SeP and SpP values for each value of n up to the recommended value

Examples

1
2
3
4
# examples for n.freecalc
n.freecalc(65,0.95,c=1,se=0.95,sp=0.99,pstar=0.05, minSpH=0.9)[[1]]
n.freecalc(65,0.95,c=2,se=0.95,sp=0.99,pstar=0.05, minSpH=0.9)[[1]]
n.freecalc(65,0.95,c=3,se=0.95,sp=0.99,pstar=0.05, minSpH=0.9)

Example output

   n       SeP       SpP  N c pstar
1 10 0.4411522 0.9043821 65 1  0.05
   n       SeP      SpP  N c pstar
1 53 0.9219543 0.901309 65 2  0.05
$`Suggested n`
   n       SeP       SpP  N c pstar
1 65 0.9210669 0.9724066 65 3  0.05

$`Detailed results`
    n           SeP       SpP
1   1 -2.220446e-16 1.0000000
2   2  0.000000e+00 1.0000000
3   3  7.126328e-05 0.9999990
4   4  2.799267e-04 0.9999960
5   5  6.872050e-04 0.9999901
6   6  1.349589e-03 0.9999804
7   7  2.319037e-03 0.9999660
8   8  3.643163e-03 0.9999461
9   9  5.365417e-03 0.9999197
10 10  7.525261e-03 0.9998862
11 11  1.015834e-02 0.9998446
12 12  1.329664e-02 0.9997944
13 13  1.696866e-02 0.9997347
14 14  2.119957e-02 0.9996649
15 15  2.601134e-02 0.9995842
16 16  3.142290e-02 0.9994921
17 17  3.745028e-02 0.9993878
18 18  4.410676e-02 0.9992708
19 19  5.140298e-02 0.9991406
20 20  5.934707e-02 0.9989964
21 21  6.794479e-02 0.9988379
22 22  7.719966e-02 0.9986644
23 23  8.711302e-02 0.9984754
24 24  9.768421e-02 0.9982706
25 25  1.089106e-01 0.9980493
26 26  1.207879e-01 0.9978112
27 27  1.333099e-01 0.9975559
28 28  1.464689e-01 0.9972829
29 29  1.602556e-01 0.9969918
30 30  1.746593e-01 0.9966823
31 31  1.896681e-01 0.9963540
32 32  2.052686e-01 0.9960066
33 33  2.214465e-01 0.9956397
34 34  2.381860e-01 0.9952530
35 35  2.554708e-01 0.9948463
36 36  2.732832e-01 0.9944192
37 37  2.916050e-01 0.9939716
38 38  3.104169e-01 0.9935031
39 39  3.296990e-01 0.9930135
40 40  3.494307e-01 0.9925026
41 41  3.695909e-01 0.9919702
42 42  3.901577e-01 0.9914161
43 43  4.111089e-01 0.9908402
44 44  4.324218e-01 0.9902421
45 45  4.540733e-01 0.9896219
46 46  4.760401e-01 0.9889793
47 47  4.982983e-01 0.9883142
48 48  5.208240e-01 0.9876264
49 49  5.435930e-01 0.9869160
50 50  5.665810e-01 0.9861827
51 51  5.897635e-01 0.9854265
52 52  6.131161e-01 0.9846474
53 53  6.366140e-01 0.9838451
54 54  6.602328e-01 0.9830198
55 55  6.839479e-01 0.9821712
56 56  7.077347e-01 0.9812995
57 57  7.315689e-01 0.9804045
58 58  7.554261e-01 0.9794862
59 59  7.792822e-01 0.9785447
60 60  8.031132e-01 0.9775798
61 61  8.268953e-01 0.9765917
62 62  8.506049e-01 0.9755803
63 63  8.742187e-01 0.9745456
64 64  8.977137e-01 0.9734877
65 65  9.210669e-01 0.9724066

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