sample_data {freedom} | R Documentation |
sample_data
Description
A function to generate some synthetic data based on a few parameters.
Usage
sample_data(
nherds = 500,
mean_herd_size = 50,
n_herd_urg = 2,
herd_dist = c(0.8, 0.2),
herd_samp_frac = 0.5,
herd_samp_dist = c(0.5, 0.5),
n_animal_urg = 2,
animal_dist = c(0.5, 0.5),
animal_samp_frac = 0.15,
animal_samp_dist = c(0.5, 0.5),
seed = NULL
)
Arguments
nherds |
The total number of herds |
mean_herd_size |
The mean herd size in the population |
n_herd_urg |
The number of different herd risk groups |
herd_dist |
The fraction of herds in each risk group |
herd_samp_frac |
The total sampling fraction at the herd level |
herd_samp_dist |
The fraction of samples to be collected from each herd risk group |
n_animal_urg |
The number of animal level risk groups |
animal_dist |
The fraction of animals within herds that are part of each risk group |
animal_samp_frac |
The total sampling fraction of animals within herds |
animal_samp_dist |
The fraction of samples that are collected from each animal risk group |
seed |
The seed for the random number generator. Default is a random seed |
Value
A data.frame
Examples
## Generate the default example data. This will generate a
## data.frame with a herd identifier (ppn), a herd level unit risk
## group identifier (herd_urg), a animal level unit risk group
## identifier (animal_urg), the total number of animals in the unit
## risk group (N_animal_urg) and the number of animals tested in the
## unit risk group (n_animals_urg).
df <- sample_data()
[Package freedom version 1.0.1 Index]