selmod function

Selecting the mode.

Selecting the mode.

Select the mode in which the column has to be sign reversed. Below is an heuristic algorithm but a fully rational choice is hard to come by. Maximal number of sign reversals = p+q+r-2, but this number can be much smaller. Sign reverse a component, determine which if any of p, q and r is available for reversal. If one of them is wholly positieve way never choose it, else if one is wholly negative choose that one from A, B, C respectively; else if there is a component with a largest absolute value which is negative choose that one, or the one from A,B,C in that order; else choose the column of the longest mode; end if FreeA, FreeB, FreeC = 0 component is not available; = 1 component is available.

selmod(aptr, bptr, cptr, posptrA, negptrA, bigptrA, posptrB, negptrB, bigptrB, posptrC, negptrC, bigptrC, IA, IB, IC, I, J, K, p, q, r, longest)

Arguments

  • aptr: The pointer to the first component matrix.
  • bptr: The pointer to the second component matrix.
  • cptr: The pointer to the third component matrix.
  • posptrA: The pointer to the positive component of the first component matrix.
  • negptrA: The pointer to the negative component of the first component matrix.
  • bigptrA: The pointer to the biggest component (a larger negative positive value than a positive one) of the first component matrix.
  • posptrB: The pointer to the positive component of the first component matrix.
  • negptrB: The pointer to the negative component of the second component matrix.
  • bigptrB: The pointer to the biggest component (a larger negative positive value than a positive one) of the second component matrix.
  • posptrC: The pointer to the positive component of the third component matrix.
  • negptrC: The pointer to the negative component of the third component matrix.
  • bigptrC: The pointer to the biggest component (a larger negative positive value than a positive one) of the third component matrix.
  • IA: The pointer to the columns of the first component matrix, given the pointer to an element in core.
  • IB: The pointer to the columns of the second component matrix, given the pointer to an element in core.
  • IC: The pointer to the columns of the third component matrix, given the pointer to an element in core.
  • I: The row number of the three-way contingency table.
  • J: The column number of the three-way contingency table.
  • K: The tube number of the three-way contingency table.
  • p: The dimension number of the first mode.
  • q: The dimension number of the second mode.
  • r: The dimension number of the third mode.
  • longest: The component matrix of the longest mode to change sign (when no special reason for selection could be found).

Returns

  • success: The flag variable to indicate if one of the components has to be sign reversed.

  • chgmode: Select the mode (1, 2 or 3) in which the column has to be sign reversed.

  • chgcomp: The pointer to the columns of the component matrices (A, B or C)

    that are responsible for the value in the ordered core array.

References

Kroonenberg PM (1994) The TUCKALS line: a suite of programs for three-way data analysis. Computational Statistics and Data Analysis, 18, 73--96.

Author(s)

Rosaria Lombardo and Pieter M Kroonenberg.