JMSLTM Numerical Library 5.0.1

com.imsl.stat
Class TableMultiWay

java.lang.Object
  extended by com.imsl.stat.TableMultiWay
All Implemented Interfaces:
Serializable, Cloneable

public class TableMultiWay
extends Object
implements Serializable, Cloneable

Tallies observations into a multi-way frequency table.

The TableMultiWay class determines the distinct values in multivariate data and computes frequencies for the data. This class accepts the data in the matrix x, but performs computations only for the variables (columns) in the first nKeys columns of x or by the variables specified in indkeys. In general, the variables for which frequencies should be computed are discrete; they should take on a relatively small number of different values. Variables that are continuous can be grouped first. TableMultiWay can be used to group variables and determine the frequencies of groups.

When method getBalancedTable is called, the inner class BalancedTable fills the vector values with the unique values in the vector of the variables and tallies the number of unique values of each variable table. Each combination of one value from each variable forms a cell in a multi-way table. The frequencies of these cells are entered in a table so that the first variable cycles through its values exactly once, and the last variable cycles through its values most rapidly. Some cells cannot correspond to any observations in the data; in other words, "missing cells" are included in table and have a value of 0. The frequency table is returned by the BalancedTable method getTable.

When method getUnbalancedTable is called, an instance of inner class UnbalancedTable is created, the frequency of each cell is entered in the unbalanced table so that the first variable cycles through its values exactly once and the last variable cycles through its values most rapidly. table is returned by UnbalancedTable method getTable. All cells have a frequency of at least 1, i.e., there is no "missing cell." The array listCells, returned by method getListCells can be considered "parallel" to table because row i of listCells is the set of nKeys values that describes the cell for which row i of table contains the corresponding frequency.

See Also:
Example, Example, Example, Serialized Form

Nested Class Summary
 class TableMultiWay.BalancedTable
          Tallies the number of unique values of each variable.
 class TableMultiWay.UnbalancedTable
          Tallies the frequency of each cell in x.
 
Field Summary
static long serialVersionUID
           
 
Constructor Summary
TableMultiWay(double[][] x, int nKeys)
          Constructor for TableMultiWay.
TableMultiWay(double[][] x, int[] indkeys)
          Constructor for TableMultiWay.
 
Method Summary
 TableMultiWay.BalancedTable getBalancedTable()
          Returns an object containing the balanced table.
 int[] getGroups()
          Returns the number of observations (rows) in each group.
 TableMultiWay.UnbalancedTable getUnbalancedTable()
          Returns an object containing the unbalanced table.
 void setFrequencies(double[] frequencies)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

TableMultiWay

public TableMultiWay(double[][] x,
                     int nKeys)
Constructor for TableMultiWay.

Parameters:
x - A double matrix containing the observations and variables.
nKeys - int array containing the variables(columns) for which computations are to be performed.

TableMultiWay

public TableMultiWay(double[][] x,
                     int[] indkeys)
Constructor for TableMultiWay.

Parameters:
x - A double matrix containing the observations and variables.
indkeys - int array containing the variables(columns) for which computations are to be performed.
Method Detail

getBalancedTable

public TableMultiWay.BalancedTable getBalancedTable()
Returns an object containing the balanced table.

Returns:
a TableBalanced object.

getGroups

public int[] getGroups()
Returns the number of observations (rows) in each group. The number of groups is the length of the returned array. A group contains observations in x that are equal with respect to the method of comparison. If n contains the returned integer array, then the first n[0] rows of the sorted x are group number 1. The next n[1] rows of the sorted x are group number 2, etc. The last n[n.length - 1] rows of the sorted x are group number n.length.

Returns:
an int array containing the number of observations (row) in each group.

getUnbalancedTable

public TableMultiWay.UnbalancedTable getUnbalancedTable()
Returns an object containing the unbalanced table.

Returns:
a TableUnBalanced object.

setFrequencies

public void setFrequencies(double[] frequencies)

JMSLTM Numerical Library 5.0.1

Copyright © 1970-2008 Visual Numerics, Inc.
Built July 8 2008.