# n.rb.2stage.1: sample size for 2-stage risk-based surveillance, risk factor... In RSurveillance: Design and Analysis of Disease Surveillance Activities

## Description

Calculates sample size required (clusters and units) for a 2-stage risk-based survey with a single risk factor at the cluster level only.

## Usage

 ```1 2``` ```n.rb.2stage.1(rr, ppr, spr, pstar.c, pstar.u, se = 1, sep.c = 0.95, sep.sys = 0.95) ```

## Arguments

 `rr` relative risk values (vector of values, corresponding to the number of risk strata) `ppr` population proportions corresponding to rr values (vector of equal length to rr) `spr` planned surveillance proportions corresponding to rr values - the proportions of the total sample to be collected from each risk stratum (vector of equal length to rr). `pstar.c` cluster (herd) level design prevalence, scalar, either proportion or integer `pstar.u` unit (animal) level design prevalence, scalar, either proportion or integer `se` unit sensitivity of test (proportion), scalar, default = 1 `sep.c` desired cluster-level sensitivity (proportion), scalar, default = 0.95 `sep.sys` desired population-level sensitivity (proportion), scalar, default = 0.95

## Value

A list of seven elements: 1) a vector (of the same length as rr) of the numbers of clusters to sample from each risk stratum, 2) the total number of clusters to be sampled, 3) a vector of EPI values for each risk stratum, 4) a vector of adjusted risk values for each risk stratum, 5) the number of untis to be sampled per cluster 6) a vector of the total numbers of units to be sampled for each risk stratum 7) the overall total number of units to be sampled

## Examples

 ```1 2 3 4 5``` ```rr<- c(5,3,1) ppr<- c(0.1, 0.2, 0.7) spr<- c(0.4, 0.4, 0.2) n.rb.2stage.1(rr, ppr, spr, pstar.c=0.01, pstar.u=0.1, se =0.9, sep.c=0.8, sep.sys=0.95) n.rb.2stage.1(c(3,1), c(0.2,0.8), c(0.7,0.3),0.05, 0.1, 0.9, 0.95, 0.99) ```

### Example output

```\$n
[1] 79 79 39

\$total
[1] 197

\$epi
[1] 0.027777778 0.016666667 0.005555556

[1] 2.7777778 1.6666667 0.5555556

\$units
[1] 18

\$risk.units
[1] 1422 1422  702

\$total.units
[1] 3546

\$n
[1] 39 16

\$total
[1] 55

\$epi
[1] 0.10714286 0.03571429

[1] 2.1428571 0.7142857

\$units
[1] 32

\$risk.units
[1] 1248  512

\$total.units
[1] 1760
```

RSurveillance documentation built on May 29, 2017, 11:52 p.m.