# corcondia: Core Consistency Diagnostic In multiway: Component Models for Multi-Way Data

## Description

Calculates Bro and Kiers's core consistency diagnostic (CORCONDIA) for a fit `parafac` or `parafac2` model. For Parafac2, the diagnostic is calculated after transforming the data.

## Usage

 `1` ```corcondia(X, object, divisor = c("nfac","core")) ```

## Arguments

 `X` Three-way data array with `dim=c(I,J,K)` or four-way data array with `dim=c(I,J,K,L)`. Can also input a list of two-way or three-way arrays (for Parafac2). `object` Object of class "parafac" (output from `parafac`) or class "parafac2" (output from `parafac2`). `divisor` Divide by number of factors (default) or core sum of squares.

## Details

The core consistency diagnostic is defined as

 ` 100 * ( 1 - sum( (G-S)^2 ) / divisor ) `

where `G` is the least squares estimate of the Tucker core array, `S` is a super-diagonal core array, and `divisor` is the sum of squares of either `S` ("nfac") or `G` ("core"). A value of 100 indiciates a perfect multilinear structure, and smaller values indicate greater violations of multilinear structure.

## Value

Returns CORCONDIA value.

## Author(s)

Nathaniel E. Helwig <[email protected]>

## References

Bro, R., & Kiers, H.A.L. (2003). A new efficient method for determining the number of components in PARAFAC models. Journal of Chemometrics, 17, 274-286.

## 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 25``` ```########## EXAMPLE ########## # create random data array with Parafac structure set.seed(3) mydim <- c(50,20,5) nf <- 2 Amat <- matrix(rnorm(mydim*nf),mydim,nf) Bmat <- matrix(runif(mydim*nf),mydim,nf) Cmat <- matrix(runif(mydim*nf),mydim,nf) Xmat <- array(tcrossprod(Amat,krprod(Cmat,Bmat)),dim=mydim) Emat <- array(rnorm(prod(mydim)),dim=mydim) Emat <- nscale(Emat, 0, ssnew = sumsq(Xmat)) # SNR=1 X <- Xmat + Emat # fit Parafac model (1-4 factors) pfac1 <- parafac(X,nfac=1,nstart=1) pfac2 <- parafac(X,nfac=2,nstart=1) pfac3 <- parafac(X,nfac=3,nstart=1) pfac4 <- parafac(X,nfac=4,nstart=1) # check corcondia corcondia(X, pfac1) corcondia(X, pfac2) corcondia(X, pfac3) corcondia(X, pfac4) ```

multiway documentation built on May 2, 2019, 6:47 a.m.