Learn R Programming

saeSim (version 0.11.0)

sim_gen_x: Preconfigured generation components

Description

These are some preconfigured generation components and all wrappers around sim_gen and sim_gen_cont.

Usage

sim_gen_x(simSetup, mean = 0, sd = 4, name = "x")

sim_gen_e(simSetup, mean = 0, sd = 4, name = "e")

sim_gen_ec( simSetup, mean = 0, sd = 150, name = "e", nCont = 0.05, type = "unit", areaVar = "idD", fixed = TRUE )

sim_gen_v(simSetup, mean = 0, sd = 1, name = "v")

sim_gen_vc( simSetup, mean = 0, sd = 40, name = "v", nCont = 0.05, type = "area", areaVar = "idD", fixed = TRUE )

Arguments

simSetup

a sim_setup.

mean

the mean passed to the random number generator, for example rnorm.

sd

the standard deviation passed to the random number generator, for example rnorm.

name

name of variable as character in which random numbers are stored.

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. c(1, 3) is interpreted as the first and 3rd area in the data is contaminated.

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.

Details

x: fixed-effect component; e: model-error; ec: contaminated model error; v: random-effect (error constant for each domain); vc contaminated random-effect. Note that for contamination you are expected to add both, a non-contaminated component and a contaminated component.