impute.sub: Imputing by Substitution

Description Usage Arguments Details Value See Also Examples

View source: R/impute_sub.R

Description

The values below the detection limit for each chemical are substituted by its detection limit/sqrt(2).

Usage

1
impute.sub(X, DL, verbose = FALSE)

Arguments

X

A numeric vector, matrix, or data-frame of chemical concentration levels with n subjects and C chemicals to be imputed. Missing values are indicated by NA's. Ideally, a numeric matrix.

DL

The detection limit for each chemical as a numeric vector with length equal to C chemicals. Vector must be complete (no NA's); any chemical that has a missing detection limit is not imputed. If DL is a data-frame or matrix with 1 row or 1 column, it is forced as a numeric vector.

verbose

Logical; if TRUE, prints more information. Useful to check for any errors in the code. Default: FALSE.

Details

A n x C matrix of components X are interval-censored between zero and different detection limits DL. Although X may refer to a variable with no obvious DL, we consider each chemical concentration being partially observed in mixture X.

Value

A n x C matrix where the BDL values of each chemical are substituted by its detection limit/sqrt(2).

See Also

Other imputation: impute.Lubin(), impute.boot(), impute.multivariate.bayesian()

Examples

1
2
3
4
5
6
7
8
data("simdata87")

X.sub <- impute.sub(X = simdata87$X.bdl, DL = simdata87$DL, verbose = TRUE)

# Compare substituted imputed data against the truth
probs <- c(0.01, 0.05, 0.09, 0.25, 0.5, 0.8, 1)
apply(X.sub, 2, quantile, probs)
round(apply(simdata87$X.true, 2, quantile, probs), 5)

miWQS documentation built on April 3, 2021, 1:06 a.m.