Learn R Programming

robCompositions (version 1.9.1)

impRZalr: alr EM-based Imputation for Rounded Zeros

Description

A modified EM alr-algorithm for replacing rounded zeros in compositional data sets.

Usage

impRZalr(x, pos = ncol(x), dl = rep(0.05, ncol(x) - 1), eps = 1e-04, 
   maxit = 50, bruteforce=FALSE, method="lm", step=FALSE, 
   nComp = "boot", R = 10, verbose = FALSE)

Arguments

x
Compositional data
pos
Position of the rationing variable for alr transformation
dl
Detection limit for each part
eps
convergence criteria
maxit
maximum number of iterations
bruteforce
if TRUE, imputations over dl are set to dl. If FALSE, truncated (Tobit) regression is applied.
method
either lm (default) or MM
step
if TRUE, a stepwise (AIC) procedure is applied when fitting models
nComp
if determined, it fixes the number of pls components. If boot, the number of pls components are estimated using a bootstraped cross validation approach.
R
number of bootstrap samples for the determination of pls components. Only important for method pls.
verbose
additional print output during calculations.

Value

  • xOrigOriginal data frame or matrix
  • xImpImputed data
  • windIndex of the missing values in the data
  • iterNumber of iterations
  • epseps

Details

Statistical analysis of compositional data including zeros runs into problems, because log-ratios cannot be applied. Usually, rounded zeros are considerer as missing not at random missing values. The algorithm first applies an additive log-ratio transformation to the compositions. Then the rounded zeros are imputed using a modified EM algorithm.

See Also

impRZilr

Examples

Run this code
data(arcticLake)
x <- arcticLake
## generate rounded zeros artificially:
x[x[,1] < 5, 1] <- 0
x[x[,2] < 47, 2] <- 0
xia <- impRZalr(x, pos=3, dl=c(5,47), eps=0.05)
xia$xImp

Run the code above in your browser using DataLab