hse {freedom}R Documentation

hse

Description

Herd Sensitivity

Usage

hse(id, n_tested, N, test_Se, dp, threshold = 0.1, 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.

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 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)

[Package freedom version 1.0.1 Index]