impute.Lubin: Lubin et al. 2004: Bootstrapping Imputation for One Chemical

Description Usage Arguments Value See Also Examples

View source: R/impute_Lubin.R

Description

Softly DEPRECATED. Use impute.boot instead.

For one chemical, this function creates an imputed dataset using a bootstrap procedure as described in Lubin et al. 2004.

Usage

1
impute.Lubin(chemcol, dlcol, Z = NULL, K = 5L, verbose = FALSE)

Arguments

chemcol

A numeric vector, the chemical concentration levels of length C. Censored values are indicated by NA. On original scale.

dlcol

The detection limit of the chemical. A value or a numeric vector of length C. Must be complete; a missing detection limit is ignored.

Z

Any covariates used in imputing the chemical concentrations. Ideally, a numeric matrix; however, Z can be a factor, vector, or data-frame. Assumed to be complete; observations with missing covariate variables are ignored in the imputation, with a warning printed. If none, enter NULL.

K

A natural number of imputed datasets to generate. Default: 5L.

verbose

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

Value

A list of:

X.imputed

A matrix with n subjects and K imputed datasets is returned.

bootstrap_index

A n x K matrix of bootstrap indices selected for the imputation. Each column is saved as a factor.

indicator.miss

A check; the sum of imputed missing values above detection limit, which should be 0.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#   ###Example 2: Simulation
# Apply to an example simulated dataset.
# A seed of 202 is executed before each run for reproducibility.
data(simdata87)

# No Covariates
set.seed(202)
results_Lubin <- impute.Lubin(chemcol = simdata87$X.bdl[, 1], dlcol = simdata87$DL[1],
  K = 5, verbose = TRUE)
str(results_Lubin)
summary(results_Lubin$imputed_values)

# 1 Covariate
set.seed(202)
sim.z1 <- impute.Lubin(simdata87$X.bdl[, 1], simdata87$DL[1],
  K = 5, Z = simdata87$Z.sim[, 1], verbose = TRUE)
summary(sim.z1$imputed_values)

# 2 Covariates
set.seed(202)
sim.z2 <- impute.Lubin(simdata87$X.bdl[, 1], simdata87$DL[1],
  K = 5, Z = simdata87$Z.sim[, -2])
summary(sim.z2$imputed_values)
summary(sim.z2$bootstrap_index)

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