n.c.freecalc: Freecalc optimum sample size and cut-point number of...

Description Usage Arguments Value Examples

View source: R/freedom_functions_2.R

Description

Calculates optimum sample size and cut-point number of positives to achieve specified population sensitivity, for given population size and other parameters, using freecalc algorithm, all paramaters must be scalars

Usage

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

Arguments

N

population size

sep

target population sensitivity

c

The maximum allowed 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 3 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, a vector of SeP values and a vector of SpP values, for n = 1:N

Examples

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

Example output

   n       SeP       SpP   N c pstar
1 27 0.9555394 0.9999933 120 1   0.1
$`Suggested n`
   n       SeP       SpP  N c pstar
1 40 0.9547116 0.9999508 65 1  0.05

$SeP
            [,1]          [,2]          [,3]          [,4]          [,5]
 [1,] 0.05338462 -2.220446e-16 -2.220446e-16 -2.220446e-16 -2.220446e-16
 [2,] 0.10452712  2.242115e-03  0.000000e+00  0.000000e+00  0.000000e+00
 [3,] 0.15349876  6.583820e-03  7.126328e-05 -2.220446e-16 -2.220446e-16
 [4,] 0.20036911  1.288771e-02  2.799267e-04  1.708800e-06  0.000000e+00
 [5,] 0.24520605  2.102138e-02  6.872050e-04  8.407887e-06  3.402866e-08
 [6,] 0.28807580  3.085728e-02  1.349589e-03  2.482130e-05  2.011795e-07
 [7,] 0.32904300  4.227258e-02  2.319037e-03  5.699131e-05  6.937992e-07
 [8,] 0.36817071  5.514905e-02  3.643163e-03  1.121596e-04  1.822968e-06
 [9,] 0.40552043  6.937295e-02  5.365417e-03  1.986542e-04  4.041405e-06
[10,] 0.44115216  8.483487e-02  7.525261e-03  3.257811e-04  7.963933e-06
[11,] 0.47512441  1.014297e-01  1.015834e-02  5.037214e-04  1.438562e-05
[12,] 0.50749424  1.190563e-01  1.329664e-02  7.434332e-04  2.429773e-05
[13,] 0.53831729  1.376176e-01  1.696866e-02  1.056558e-03  3.890158e-05
[14,] 0.56764780  1.570207e-01  2.119957e-02  1.455334e-03  5.962044e-05
[15,] 0.59553865  1.771759e-01  2.601134e-02  1.952506e-03  8.810957e-05
[16,] 0.62204137  1.979978e-01  3.142290e-02  2.561253e-03  1.262645e-04
[17,] 0.64720620  2.194041e-01  3.745028e-02  3.295107e-03  1.762275e-04
[18,] 0.67108208  2.413163e-01  4.410676e-02  4.167883e-03  2.403930e-04
[19,] 0.69371669  2.636590e-01  5.140298e-02  5.193608e-03  3.214108e-04
[20,] 0.71515650  2.863604e-01  5.934707e-02  6.386463e-03  4.221884e-04
[21,] 0.73544675  3.093515e-01  6.794479e-02  7.760715e-03  5.458919e-04
[22,] 0.75463151  3.325667e-01  7.719966e-02  9.330664e-03  6.959458e-04
[23,] 0.77275371  3.559432e-01  8.711302e-02  1.111059e-02  8.760315e-04
[24,] 0.78985512  3.794213e-01  9.768421e-02  1.311469e-02  1.090084e-03
[25,] 0.80597642  4.029440e-01  1.089106e-01  1.535705e-02  1.342291e-03
[26,] 0.82115719  4.264570e-01  1.207879e-01  1.785159e-02  1.637085e-03
[27,] 0.83543598  4.499087e-01  1.333099e-01  2.061201e-02  1.979140e-03
[28,] 0.84885027  4.732503e-01  1.464689e-01  2.365179e-02  2.373365e-03
[29,] 0.86143653  4.964350e-01  1.602556e-01  2.698409e-02  2.824899e-03
[30,] 0.87323023  5.194190e-01  1.746593e-01  3.062178e-02  3.339099e-03
[31,] 0.88426589  5.421605e-01  1.896681e-01  3.457737e-02  3.921538e-03
[32,] 0.89457705  5.646199e-01  2.052686e-01  3.886300e-02  4.577992e-03
[33,] 0.90419633  5.867602e-01  2.214465e-01  4.349039e-02  5.314431e-03
[34,] 0.91315543  6.085460e-01  2.381860e-01  4.847084e-02  6.137013e-03
[35,] 0.92148516  6.299445e-01  2.554708e-01  5.381519e-02  7.052069e-03
[36,] 0.92921546  6.509246e-01  2.732832e-01  5.953383e-02  8.066099e-03
[37,] 0.93637542  6.714572e-01  2.916050e-01  6.563663e-02  9.185752e-03
[38,] 0.94299327  6.915150e-01  3.104169e-01  7.213296e-02  1.041783e-02
[39,] 0.94909644  7.110726e-01  3.296990e-01  7.903167e-02  1.176925e-02
[40,] 0.95471157  7.301064e-01  3.494307e-01  8.634106e-02  1.324708e-02
[41,] 0.95986450  7.485943e-01  3.695909e-01  9.406891e-02  1.485846e-02
[42,] 0.96458032  7.665162e-01  3.901577e-01  1.022224e-01  1.661066e-02
[43,] 0.96888335  7.838531e-01  4.111089e-01  1.108082e-01  1.851102e-02
[44,] 0.97279719  8.005879e-01  4.324218e-01  1.198323e-01  2.056695e-02
[45,] 0.97634475  8.167049e-01  4.540733e-01  1.293003e-01  2.278594e-02
[46,] 0.97954819  8.321896e-01  4.760401e-01  1.392169e-01  2.517552e-02
[47,] 0.98242904  8.470293e-01  4.982983e-01  1.495865e-01  2.774326e-02
[48,] 0.98500812  8.612121e-01  5.208240e-01  1.604129e-01  3.049674e-02
[49,] 0.98730563  8.747278e-01  5.435930e-01  1.716991e-01  3.344358e-02
[50,] 0.98934111  8.875673e-01  5.665810e-01  1.834475e-01  3.659140e-02
[51,] 0.99113348  8.997225e-01  5.897635e-01  1.956603e-01  3.994779e-02
[52,] 0.99270106  9.111868e-01  6.131161e-01  2.083386e-01  4.352034e-02
[53,] 0.99406158  9.219543e-01  6.366140e-01  2.214833e-01  4.731660e-02
[54,] 0.99523216  9.320205e-01  6.602328e-01  2.350944e-01  5.134407e-02
[55,] 0.99622939  9.413818e-01  6.839479e-01  2.491716e-01  5.561022e-02
[56,] 0.99706928  9.500354e-01  7.077347e-01  2.637138e-01  6.012242e-02
[57,] 0.99776731  9.579796e-01  7.315689e-01  2.787196e-01  6.488800e-02
[58,] 0.99833843  9.652137e-01  7.554261e-01  2.941866e-01  6.991417e-02
[59,] 0.99879706  9.717376e-01  7.792822e-01  3.101124e-01  7.520806e-02
[60,] 0.99915715  9.775522e-01  8.031132e-01  3.264935e-01  8.077670e-02
[61,] 0.99943211  9.826592e-01  8.268953e-01  3.433262e-01  8.662699e-02
[62,] 0.99963492  9.870610e-01  8.506049e-01  3.606062e-01  9.276570e-02
[63,] 0.99977805  9.907608e-01  8.742187e-01  3.783287e-01  9.919948e-02
[64,] 0.99987354  9.937623e-01  8.977137e-01  3.964883e-01  1.059348e-01
[65,] 0.99993297  9.960701e-01  9.210669e-01  4.150792e-01  1.129781e-01

$SpP
           [,1]      [,2]      [,3]      [,4]      [,5]
 [1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [2,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [3,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [4,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [5,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [6,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [7,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [8,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [9,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[10,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[11,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[12,] 0.9999999 0.9999999 0.9999999 0.9999999 0.9999999
[13,] 0.9999999 0.9999999 0.9999999 0.9999999 0.9999999
[14,] 0.9999998 0.9999998 0.9999998 0.9999998 0.9999998
[15,] 0.9999997 0.9999997 0.9999997 0.9999997 0.9999997
[16,] 0.9999996 0.9999996 0.9999996 0.9999996 0.9999996
[17,] 0.9999994 0.9999994 0.9999994 0.9999994 0.9999994
[18,] 0.9999992 0.9999992 0.9999992 0.9999992 0.9999992
[19,] 0.9999990 0.9999990 0.9999990 0.9999990 0.9999990
[20,] 0.9999986 0.9999986 0.9999986 0.9999986 0.9999986
[21,] 0.9999982 0.9999982 0.9999982 0.9999982 0.9999982
[22,] 0.9999977 0.9999977 0.9999977 0.9999977 0.9999977
[23,] 0.9999971 0.9999971 0.9999971 0.9999971 0.9999971
[24,] 0.9999964 0.9999964 0.9999964 0.9999964 0.9999964
[25,] 0.9999955 0.9999955 0.9999955 0.9999955 0.9999955
[26,] 0.9999945 0.9999945 0.9999945 0.9999945 0.9999945
[27,] 0.9999933 0.9999933 0.9999933 0.9999933 0.9999933
[28,] 0.9999919 0.9999919 0.9999919 0.9999919 0.9999919
[29,] 0.9999903 0.9999903 0.9999903 0.9999903 0.9999903
[30,] 0.9999884 0.9999884 0.9999884 0.9999884 0.9999884
[31,] 0.9999863 0.9999863 0.9999863 0.9999863 0.9999863
[32,] 0.9999839 0.9999839 0.9999839 0.9999839 0.9999839
[33,] 0.9999812 0.9999812 0.9999812 0.9999812 0.9999812
[34,] 0.9999782 0.9999782 0.9999782 0.9999782 0.9999782
[35,] 0.9999747 0.9999747 0.9999747 0.9999747 0.9999747
[36,] 0.9999709 0.9999709 0.9999709 0.9999709 0.9999709
[37,] 0.9999666 0.9999666 0.9999666 0.9999666 0.9999666
[38,] 0.9999619 0.9999619 0.9999619 0.9999619 0.9999619
[39,] 0.9999566 0.9999566 0.9999566 0.9999566 0.9999566
[40,] 0.9999508 0.9999508 0.9999508 0.9999508 0.9999508
[41,] 0.9999445 0.9999445 0.9999445 0.9999445 0.9999445
[42,] 0.9999375 0.9999375 0.9999375 0.9999375 0.9999375
[43,] 0.9999299 0.9999299 0.9999299 0.9999299 0.9999299
[44,] 0.9999215 0.9999215 0.9999215 0.9999215 0.9999215
[45,] 0.9999124 0.9999124 0.9999124 0.9999124 0.9999124
[46,] 0.9999026 0.9999026 0.9999026 0.9999026 0.9999026
[47,] 0.9998919 0.9998919 0.9998919 0.9998919 0.9998919
[48,] 0.9998803 0.9998803 0.9998803 0.9998803 0.9998803
[49,] 0.9998678 0.9998678 0.9998678 0.9998678 0.9998678
[50,] 0.9998543 0.9998543 0.9998543 0.9998543 0.9998543
[51,] 0.9998398 0.9998398 0.9998398 0.9998398 0.9998398
[52,] 0.9998242 0.9998242 0.9998242 0.9998242 0.9998242
[53,] 0.9998075 0.9998075 0.9998075 0.9998075 0.9998075
[54,] 0.9997896 0.9997896 0.9997896 0.9997896 0.9997896
[55,] 0.9997705 0.9997705 0.9997705 0.9997705 0.9997705
[56,] 0.9997501 0.9997501 0.9997501 0.9997501 0.9997501
[57,] 0.9997283 0.9997283 0.9997283 0.9997283 0.9997283
[58,] 0.9997051 0.9997051 0.9997051 0.9997051 0.9997051
[59,] 0.9996804 0.9996804 0.9996804 0.9996804 0.9996804
[60,] 0.9996542 0.9996542 0.9996542 0.9996542 0.9996542
[61,] 0.9996265 0.9996265 0.9996265 0.9996265 0.9996265
[62,] 0.9995970 0.9995970 0.9995970 0.9995970 0.9995970
[63,] 0.9995659 0.9995659 0.9995659 0.9995659 0.9995659
[64,] 0.9995330 0.9995330 0.9995330 0.9995330 0.9995330
[65,] 0.9994982 0.9994982 0.9994982 0.9994982 0.9994982

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