public class TableMultiWay extends Object implements Serializable, Cloneable
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.
Modifier and Type | Class and Description |
---|---|
class |
TableMultiWay.BalancedTable
Tallies the number of unique values of each variable.
|
class |
TableMultiWay.UnbalancedTable
Tallies the frequency of each cell in
x . |
Constructor and Description |
---|
TableMultiWay(double[][] x,
int nKeys)
Constructor for
TableMultiWay . |
TableMultiWay(double[][] x,
int[] indkeys)
Constructor for
TableMultiWay . |
Modifier and Type | Method and Description |
---|---|
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)
Sets the frequencies for each observation in x.
|
public TableMultiWay(double[][] x, int nKeys)
TableMultiWay
.x
- A double
matrix containing the observations and
variables.nKeys
- int
equal to the number of keys. The first
nKeys
variables (columns) of x
are to be used
as the sorting keys.public TableMultiWay(double[][] x, int[] indkeys)
TableMultiWay
.x
- A double
matrix containing the observations and
variables.indkeys
- int
array containing the variables (columns)
which are to be used as the sorting keys.public int[] getGroups()
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
.int
array containing the number of observations
(row) in each group.public TableMultiWay.BalancedTable getBalancedTable()
TableBalanced object
.public TableMultiWay.UnbalancedTable getUnbalancedTable()
TableUnBalanced object
.public void setFrequencies(double[] frequencies)
x
.frequencies
- a double
array containing the
frequency for each observation in x.
Default frequencies
[] =1.Copyright © 2020 Rogue Wave Software. All rights reserved.