Learn R Programming

robCompositions (version 1.3.2)

alrEM: alr-EM Imputation for Rounded Zeros

Description

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

Usage

alrEM(x, pos = ncol(x), dl = rep(0.05, ncol(x) - 1), eps = 1e-04, maxit = 50)

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

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. Details can be found in Palarea-Albaladej and Martinn-Fernandez (2008).

The major difference between their MATLAB implementation and this R function is that they use the reg.sweep methodology for regression analysis. Nevertheless, we use the standard lm function from R which based on QR-decompositons, which is more accurate than sweep.

References

Palarea-Albaladej, J. and Mart'in-Fern'andez, J.A. (2008) A modified EM alr-algorithm for replacing rounded zeros in compositional data sets. Computers and Geosciences, 34, 902-917

See Also

impCoda

Examples

Run this code
data(arcticLake)
x <- arcticLake
## generate rounded zeros artificially:
x[x < 5] <- 0
xia <- alrEM(x, pos=2, dl=rep(5,3))
xia$xImp

Run the code above in your browser using DataLab