hse: hse

View source: R/herd_se.R

hseR Documentation

hse

Description

Herd Sensitivity

Usage

hse(
  id,
  n_tested,
  N,
  test_Se,
  dp,
  threshold = 0.1,
  rounding = c("none", "ceiling", "round", "floor"),
  force = FALSE
)

Arguments

id

The herdid

n_tested

The number tested in each URG

N

The number of units in each of the URG

test_Se

The sensitivity of the test (length = 1). If you have reason to believe that the test sensitivity is different for different URG. Then supply a vector of Sensitivities. This could conceivably be because of using different tests for different samples from different URG.

dp

The is a vector (length 1) of the design prevalence (df) in the case where there is only one unit risk group (URG) in the herd. Or a vector (length n) of EPIn for each of the URG in the herd.

threshold

The breakpoint above which the finite population size calculation will be used. The default is 0.1 which means that if > 10 population will be assumed; less than or equal to 10 infinite population will be assumed.

rounding

How should the proportion of animals be rounded? Default value is 'none' which does no rounding. Other options are 'round', 'ceiling', and 'floor'. 'round' rounds the dp * N to the nearest integer and then selects 1 if the value is 0. 'ceiling' takes the ceiling of dp * N, this is consistent with the method in the Rsurveillance package. 'floor' takes the floor of dp * N and makes it 1 if the result is 0.

force

If force = FALSE (default) then the function errors if n>N. If force = TRUE then this is allowed and uses the hse_infinite to calculate HSe.

Details

Calculate the Herd sensitivity when multiple samples from individual units within the herd. The function uses the assumption of finite population when greater than 10 otherwise the assumption of infinite population.

Value

A data.frame. A dataframe is returned with 2 columns: "id"

A vector (length 1)

Examples

df <- data.frame(id = seq(1:20),
                 n_tested = rpois(20, 6),
                 N = rpois(20, 50),
                 test_Se = 0.3,
                 dp = 0.05)
## Calculate the herd level sensitivity for each of these herds. If
## the ratio of the number tested to number of animals in the herd
## exceeds the threshold then the finite method is used, otherwise the
## infinite method is used.
hse(df$id,
    df$n_tested,
    df$N,
    df$test_Se,
    df$dp,
    threshold = 0.1)

SVA-SE/freedom documentation built on Feb. 1, 2023, 5:50 p.m.