Contains the parameters and the data necessary for a survey to substantiate freedom from disease using "individual sampling". Additionally to the survey parameters: design prevalence (=prevalence of the disease under the null hypothesis), overall significance level (=1-confidence), intra-herd prevalence, sensitivity of the diagnostic test, cost per tested animal and cost per tested herd, the object contains the herd sensitivity the number of herds to be tested, the mean overall number of animals to be tested, the expected costs, as well as a lookup table for the number of animals to test depending on the herd size.

Objects can be created by calls of the form `new("IndSampling", ...)`

.

`surveyData`

:Object of class

`"SurveyData"`

. Contains all the necessary data and specifications for the survey.`herdSensitivity`

:Object of class

`"numeric"`

with values between 0 and 1. Desired herd sensitivity.`nHerds`

:Object of class

`"numeric"`

. Number of herds to be tested according to the herd sensitivity`herdSensitivity`

.`nHerdsPerRiskGroup`

:Object of class

`"numeric"`

. Number of herds to be tested per risk group (if population is stratified by risk groups).`nSampleFixVec`

:Object of class

`"numeric"`

. Numeric vector containing some NAs (optional argument). For risk groups for which the sample size is fixed it specifies the sample size. For the risk groups for which the sample size was computed it was set to NA (order of the risk groups is the same as in`survey.Data@riskValueData`

).`probVec`

:Object of class

`"numeric"`

. Contains the sample probabilities for those risk groups for which the sample size was computed (=NA entries in`nSampleFixVec`

).`nAnimalsMean`

:Object of class

`"numeric"`

. Expected total number of animals to be tested in the survey.`expectedCost`

:Object of class

`"numeric"`

. Expected costs of the survey.`lookupTable`

:Object of class

`"matrix"`

with columns`N_lower`

,`N_upper`

and`sampleSize`

containing the number of animals to test for each herd size.

- HTML
`signature(x = "IndSampling")`

: Creates an html file containing the summary data and the diagnostic plots. Title, file name, output directory, css-file, etc. can additionally be specified using the parameters,`filename`

,`outdir`

,`CSSFile`

,`Title`

, as well as all the other parameters of the R2HTML-function`HTMLInitFile`

.- sample
`signature(x = "IndSampling", size = c("fixed", "dynamic"))`

: Sample herds using individual sampling. Additionally to the argument`x`

of type`IndSampling`

the method takes an argument`size`

, which is a character string. For`size == "fixed"`

the fixed number of herds given in`x@nHerds`

is sampled using simple random sampling. For`size == "dynamic"`

dynamic sampling is used, i.e., based on real-time computation of the a-posteriori alpha- error the sample is updated until the a-posteriori alpha-error falls below the predefined significance level x@alpha. The return value is a list with two items:`indexSample`

is a vector of indices of the sample corresponding to`x@surveyData@nAnimalVec`

and`aPostAlpha`

containing the a-posteriori alpha-error of the sample.- show
`signature(object = "IndSampling")`

: Display structure of the class and content of the slots.- summary
`signature(object = "IndSampling")`

: Display structure of the class and a summary of the content of the slots.

No notes yet.

Ian Kopacka <ian.kopacka@ages.at>

The slot `surveyData`

contains an object of the class
`SurveyData`

which is created using `surveyData`

.
Objects of the class `IndSampling`

are create using the constructor
`indSampling`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
## Show the structure of the class:
showClass("IndSampling")
## Create an object:
data(sheepData)
mySurvey <- surveyData(nAnimalVec = sheepData$nSheep,
populationData = sheepData, designPrevalence = 0.002,
alpha = 0.05, intraHerdPrevalence = 0.13,
diagSensitivity = 0.9, costHerd = 30, costAnimal = 7.1)
myIndSampling <- indSampling(survey.Data = mySurvey, herdSensitivity = 0.7)
## Display results:
summary(myIndSampling)
## Write results to an html-file:
## Not run:
target <- HTMLInitFile(getwd(), filename = "IndSampling")
HTML(myIndSampling)
HTMLEndFile()
## End(Not run)
``` |

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

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