JMSLTM Numerical Library 4.0

com.imsl.stat
Class TableTwoWay

java.lang.Object
  extended bycom.imsl.stat.TableTwoWay
All Implemented Interfaces:
Cloneable, Serializable

public class TableTwoWay
extends Object
implements Serializable, Cloneable

Tallies observations into a two-way frequency table.

See Also:
Example, Serialized Form

Constructor Summary
TableTwoWay(double[] x, int xIntervals, double[] y, int yIntervals)
          Constructor for TableTwoWay.
 
Method Summary
 double[][] getFrequencyTable()
          Returns the two-way frequency table.
 double[][] getFrequencyTable(double xLowerBound, double xUpperBound, double yLowerBound, double yUpperBound)
          Compute a two-way frequency table using intervals of equal length and user supplied upper and lower bounds, xLowerBound, xUpperBound, yLowerBound, yUpperBound.
 double[][] getFrequencyTableUsingClassmarks(double[] cx, double[] cy)
          Returns the two-way frequency table using either cutpoints or class marks.
 double[][] getFrequencyTableUsingCutpoints(double[] cx, double[] cy)
          Returns the two-way frequency table using cutpoints.
 double getMaximumX()
          Returns the maximum value of x.
 double getMaximumY()
          Returns the maximum value of y.
 double getMinimumX()
          Returns the minimum value of x.
 double getMinimumY()
          Returns the minimum value of y.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableTwoWay

public TableTwoWay(double[] x,
                   int xIntervals,
                   double[] y,
                   int yIntervals)
Constructor for TableTwoWay.

Parameters:
x - A double array containing the data for the first variable.
xIntervals - An int scalar containing the number of intervals (bins) for variable x.
y - A double array containing the data for the second variable.
yIntervals - An int scalar containing the number of intervals (bins) for variable y.
Method Detail

getFrequencyTable

public double[][] getFrequencyTable()
Returns the two-way frequency table. Intervals of equal length are used. Let xmin and xmax be the minimum and maximum values in x, respectively, with similiar meanings for ymin and ymax. Then, the first row of the output table is the tally of observations with the x value less than or equal to xmin + (xmax - xmin)/xIntervals, and the y value less than or equal to ymin + (ymax - ymin)/yIntervals.

Returns:
A two-dimensional double array containing the two-way frequency table.

getFrequencyTable

public double[][] getFrequencyTable(double xLowerBound,
                                    double xUpperBound,
                                    double yLowerBound,
                                    double yUpperBound)
Compute a two-way frequency table using intervals of equal length and user supplied upper and lower bounds, xLowerBound, xUpperBound, yLowerBound, yUpperBound. The first and last intervals for both variables are semi-infinite in length. xIntervals and yIntervals must be greater than or equal to 3.

Parameters:
xLowerBound - double specifies the right endpoint for x.
xUpperBound - double specifies the left endpoint for x.
yLowerBound - double specifies the right endpoint for y.
yUpperBound - double specifies the left endpoint for y.
Returns:
A two dimensional double array containing the two-way frequency table.

getFrequencyTableUsingClassmarks

public double[][] getFrequencyTableUsingClassmarks(double[] cx,
                                                   double[] cy)
Returns the two-way frequency table using either cutpoints or class marks. Cutpoints are boundaries and class marks are the midpoints of xIntervals and yIntervals. Equally spaced class marks in ascending order must be provided in the arrays cx and cy. The class marks are the midpoints of each interval. Each interval is taken to have length cx[1] - cx[0] in the x direction and cy[1] - cy[0] in the y direction. The total number of elements in the output table may be less than the number of observations of input data. Arguments xIntervals and yIntervals must be greater than or equal to 2 for this option.

Parameters:
cx - double array containing either the cutpoints or the class marks for x.
cy - double array containing either the cutpoints or the class marks for y.
Returns:
A two dimensional double array containing the two-way frequency table.

getFrequencyTableUsingCutpoints

public double[][] getFrequencyTableUsingCutpoints(double[] cx,
                                                  double[] cy)
Returns the two-way frequency table using cutpoints. The cutpoints (boundaries) must be provided in the arrays cx and cy, of length (xIntervals-1) and (yIntervals-1) respectively. The first row of the output table is the tally of observations for which the x value is less than or equal to cx[0], and the y value is less than or equal to cy[0]. This option allows unequal interval lengths. Arguments cx and cy must be greater than or equal to 2.

Parameters:
cx - double array containing either the cutpoints or the class marks for x.
cy - double array containing either the cutpoints or the class marks for y.
Returns:
A two dimensional double array containing the two-way frequency table.

getMaximumX

public double getMaximumX()
Returns the maximum value of x.

Returns:
a double containing the maximum data bound for x.

getMaximumY

public double getMaximumY()
Returns the maximum value of y.

Returns:
a double containing the maximum data bound for y.

getMinimumX

public double getMinimumX()
Returns the minimum value of x.

Returns:
a double containing the minimum data bound for x.

getMinimumY

public double getMinimumY()
Returns the minimum value of y.

Returns:
a double containing the minimum data bound for y.

JMSLTM Numerical Library 4.0

Copyright 1970-2006 Visual Numerics, Inc.
Built June 1 2006.