NAControl-class: Class '"NAControl"'

Description Objects from the Class Slots Extends Accessor methods Methods UML class diagram Author(s) References See Also Examples

Description

Class for controlling the insertion of missing values in a simulation experiment.

Objects from the Class

Objects can be created by calls of the form NAControl(...).

Slots

target:

A character vector specifying the variables (columns) into which missing values should be inserted, or NULL to insert missing values into all variables (except additional ones generated internally).

NARate:

A numeric matrix giving the missing value rates. In case of only one column, the same missing value rates are used for all target variables. Otherwise the missing value rates to be used for each target variable are given by the respective column. A vector is converted to a matrix during initialization.

grouping:

An optional character string specifying a grouping variable (column) to be used for setting whole groups to NA rather than individual values.

aux:

An optional character vector specifying auxiliary variables (columns) whose values are used as probability weights for selecting the items to be set to NA in the respective target variables. If only one variable (column) is specified, it is used for all target variables.

intoContamination:

A logical indicating whether missing values should also be inserted into contaminated observations. The default is to insert missing values only into non-contaminated observations.

Extends

Class "VirtualNAControl", directly. Class "OptNAControl", distance 2.

Accessor methods

The following accessor methods are available in addition to the inherited ones:

getGrouping

signature(x = "NAControl"): get slot grouping.

getAux

signature(x = "NAControl"): get slot aux.

getIntoContamination

signature(x = "NAControl"): get slot intoContamination.

Methods

The following methods are available in addition to the inherited ones:

setNA

signature(x = "data.frame", control = "NAControl"): set missing values.

show

signature(object = "NAControl"): print the object on the R console.

UML class diagram

A slightly simplified UML class diagram of the framework can be found in Figure 1 of the package vignette An Object-Oriented Framework for Statistical Simulation: The R Package simFrame. Use vignette("simFrame-intro") to view this vignette.

Author(s)

Andreas Alfons

References

Alfons, A., Templ, M. and Filzmoser, P. (2010) An Object-Oriented Framework for Statistical Simulation: The R Package simFrame. Journal of Statistical Software, 37(3), 1–36. URL http://www.jstatsoft.org/v37/i03/.

See Also

setNA

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data("eusilcP")
eusilcP$age[eusilcP$age < 0] <- 0  # this actually occurs
sam <- draw(eusilcP[, c("id", "age", "eqIncome")], size = 20)

# missing completely at random
mcarc <- NAControl(target = "eqIncome", NARate = 0.2)
setNA(sam, mcarc)

# missing at random
marc <- NAControl(target = "eqIncome", NARate = 0.2, aux = "age")
setNA(sam, marc)

# missing not at random
mnarc <- NAControl(target = "eqIncome", 
    NARate = 0.2, aux = "eqIncome")
setNA(sam, mnarc)

aalfons/simFrame documentation built on June 3, 2017, 10:52 a.m.