Learn R Programming

freedom (version 1.0.1)

hse_finite: hse_finite

Description

Herd Sensitivity calculated with the assumption of a finite population

Usage

hse_finite(id, n_tested, N, test_Se, dp)

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. This may have length == 1 if all URG and all herds have the same test_Se. It may also have length(test_Se) == length(n_tested).

dp

The design prevalence (dp) could be length(dp) == 1 if all URG and herds have the same dp. It could alternatively be length(dp) == length(n_tested) if different design prevalences are to be applied to each URG.

Value

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

Details

Calculate the Herd sensitivity when multiple samples from individual units within the herd. The function uses the total population size to adjust the estimates consistent with a finite population. This method for calculation of HSe is typically used when greater than 10

Examples

Run this code
# NOT RUN {
df <- data.frame(id = seq(1:20),
                 n_tested = rpois(20, 5),
                 N = 100,
                 test_Se = 0.3,
                 dp = 0.05)
## Calculate the herd level sensitivity for each of these herds
hse_finite(df$id,
           df$n_tested,
           df$N,
           df$test_Se,
           df$dp)
# }

Run the code above in your browser using DataLab