Calculates system sensitivity for 2 stage risk-based sampling, llowing for a single risk factor at each stage and using either binomial or hypergeometric approxiation

1 2 | ```
sse.rb.2stage(C = NA, pstar.c, pstar.u, rr.c, ppr.c, rr.u, ppr.u, N = NA, n,
rg, se)
``` |

`C` |
Population size (number of clusters), NA = unknown (default) |

`pstar.c` |
cluster level design prevalence (scalar) |

`pstar.u` |
unit level design prevalence (scalar) |

`rr.c` |
cluster level relative risks (vector with length corresponding to the number of risk strata), use rr.c = c(1,1) if risk factor does not apply |

`ppr.c` |
cluster level population proportions for risk categories (vector), NA if no cluster level risk factor |

`rr.u` |
unit level relative risks (vector with length corresponding to the number of risk strata), use rr.u = c(1,1) if risk factor does not apply |

`ppr.u` |
unit level population proportions for each risk group (optional) matrix, 1 row for each cluster, columns = unit level risk groups, not required if N is provided |

`N` |
population size per risk group for each cluster, NA or matrix of N for each risk group for each cluster, N=NA means cluster sizes not provided |

`n` |
sample size per risk group for each cluster sampled, matrix, 1 row for each cluster, columns = unit level risk groups |

`rg` |
vector of cluster level risk group (index) for each cluster |

`se` |
unit sensitivity for each cluster, scalar or vector of values for each cluster, equal in length to n |

list of 2 elements, a scalar of population-level (surveillance system) sensitivity and a vector of cluster-level sensitivities

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
# examples for sse.rb.2stage
pstar.c<- 0.02
pstar.u<- 0.1
rr.c<- c(5, 1)
ppr.c<- c(0.1, 0.9)
rr.u<- c(3, 1)
se<- 0.9
n<- cbind(rep(10, 50), rep(5, 50))
rg<- c(rep(1, 30), rep(2, 20))
ppr.u<- cbind(rep(0.2, 50), rep(0.8, 50))
N<- cbind(rep(30, 50), rep(120, 50))
C<- 500
sse.rb.2stage(C=NA, pstar.c, pstar.u, rr.c, ppr.c, rr.u, ppr.u, N=NA, n, rg, se)
sse.rb.2stage(C, pstar.c, pstar.u, rr.c, ppr.c, rr.u, ppr.u, N=NA, n, rg, se)
sse.rb.2stage(C=NA, pstar.c, pstar.u, rr.c, ppr.c, rr.u, ppr.u, N, n, rg, se)
sse.rb.2stage(C, pstar.c, pstar.u, rr.c, ppr.c, rr.u, ppr.u, N, n, rg, se)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.