Learn R Programming

rrcov3way (version 0.1-10)

Parafac: Robust Parafac estimator for compositional data

Description

Compute a robust Parafac model for compositional data

Usage

Parafac(X, ncomp = 2, conv = 1e-06, center = FALSE, 
    scale=FALSE, scale.mode=c("B", "A", "C"), 
    orth=c(), robust = FALSE, ilr = FALSE, ncomp.rpca = 2, 
    alpha = 0.75, maxiter = 100, crit=0.975, trace = FALSE)

Arguments

X

3-way array of data

ncomp

Number of components

conv

Convergence criterion, defaults to 1e-6

center

Whether to center the data

scale

Whether to scale the data

scale.mode

If centering and/or scaling the data, on which mode to do this

orth

Orthogonality constraints

robust

Whether to apply a robust estimation

ilr

If the data are a composition, use an ilr transformation

ncomp.rpca

Number of components for robust PCA

alpha

Measures the fraction of outliers the algorithm should resist. Allowed values are between 0.5 and 1 and the default is 0.75

maxiter

Maximal number of iterations

crit

Cut-off for identifying outliers, default crit=0.975

trace

Logical, provide trace output

Value

An object of class "parafac" which is basically a list with components:

fit

Fit value

fp

Fit percentage

A

Orthogonal loading matrix for the A-mode

B

Orthogonal loading matrix for the A-mode

Bclr

Orthogonal loading matrix for the B-mode, clr transformed. Available only if ilr=TRUE (default), otherwise NULL

C

Orthogonal loading matrix for the C-mode

Xhat

Robust reconstructed array

iter

Number of iterations

RD

Residual distances

flag

The observations whose residual distance RD is larger than cutoff.RD can be considered as outliers and receive a flag equal to zero. The regular observations receive a flag 1

robust

The paramater robust, whether robust method is used or not

ilr

The paramater ilr, whether ilr transformation is used or not

Details

The function can compute four versions of the Parafac model:

  1. Classical Parafac,

  2. Parafac for compositional data,

  3. Robust Parafac and

  4. Robust Parafac for compositional data.

This is controlled though the paramters robust=TRUE and ilr=TRUE.

References

Harshman, R.A. (1970). Foundations of Parafac procedure: models and conditions for an "explanatory" multi-mode factor analysis. UCLA Working Papers in Phonetics, 16: 1--84.

Engelen, S., Frosch, S. and Jorgensen, B.M. (2009). A fully robust PARAFAC method analyzing fluorescence data. Journal of Chemometrics, 23(3): 124--131.

Kroonenberg, P.M. (1983).Three-mode principal component analysis: Theory and applications (Vol. 2), DSWO press.

Rousseeuw, P.J. and Driessen, K.V. (1999). A fast algorithm for the minimum covariance determinant estimator. Technometrics, 41(3): 212--223.

Egozcue J.J., Pawlowsky-Glahn V., Mateu-Figueras G. and Barcel'o-Vidal, C. (2003). Isometric logratio transformations for compositional data analysis. Mathematical Geology, 35(3): 279-300

Examples

Run this code
# NOT RUN {
#############
##
## Example with the UNIDO Manufacturing value added data

data(va3way)
dim(va3way)

## Treat quickly and dirty the zeros in the data set (if any) 
va3way[va3way==0] <- 0.001

## 
res <- Parafac(va3way)
res
print(res$fit)
print(res$A)

## Distance-distance plot
plot(res, which="dd", main="Distance-distance plot")

data(ulabor)
res <- Parafac(ulabor, robust=TRUE, ilr=TRUE)
res

## Plot Orthonormalized A-mode component plot
plot(res, which="comp", mode="A", main="Component plot, A-mode")

## Plot Orthonormalized B-mode component plot
plot(res, which="comp", mode="B", main="Component plot, B-mode")

## Plot Orthonormalized B-mode component plot
plot(res, which="comp", mode="C", main="Component plot, C-mode")


# }

Run the code above in your browser using DataLab