sim_gen_cont {saeSim} | R Documentation |
Generation Component for contamination
Description
One of the components which can be added to a sim_setup
. It is applied after functions added with sim_gen
.
Usage
sim_gen_cont(simSetup, generator, nCont, type, areaVar = NULL, fixed = TRUE)
Arguments
simSetup |
a |
generator |
generator function used to generate random numbers. |
nCont |
gives the number of contaminated observations. Values between 0
and 1 will be treated as probability. If type is 'unit' and length is
larger than 1, the expected length is the number of areas. If type is
'area' and length is larger than 1 the values are interpreted as area
positions; i.e. |
type |
"unit" or "area" - unit- or area-level contamination. |
areaVar |
character with variable name(s) identifying areas. |
fixed |
TRUE fixes the observations which will be contaminated. FALSE will result in a random selection of observations or areas. |
See Also
Examples
sim_base_lm() %>%
sim_gen_cont(gen_norm(name = "e"), nCont = 0.05, type = "unit", areaVar = "idD") %>%
as.data.frame