|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.imsl.stat.TableTwoWay
public class TableTwoWay
Class TableTwoWay
calculates a two-dimensional frequency table for
a data array based upon two variables.
A two-way frequency table can be used to visualize the shape of the bivariate distribution and look for anomalies in the data. There are many approaches to constructing two-way frequency tables. Four approaches are implemented in this class:
The TableTwoWay
class implements the first two approaches by
overloading the getFrequencyTable method. If getFrequencyTable()
is used without
input arguments, xIntervals
intervals of equal length are formed between the minimum
and maximum values in x, and similarly, yIntervals
intervals are formed for y. The
frequency table returned from this method
contains tallies of the number of observations in each interval. The
data minimum and maximum can be obtained using getMinimumX
,
getMinimumY
, getMaximumX
and getMaximumY
.
Instead of using the minimum and maximum to define the boundaries of the
smallest and largest classes, specified boundaries can be used by calling
getFrequencyTable(xLowerBound
, xUpperBound
,
yLowerBound
, yUpperBound)
). This method tallies
all data less than or equal to the xLowerBound
and
yLowerBound
into the first class, and all data greater
than or equal to xUpperBound
and YUpperBround
into the last class
The third approach is implemented using the getFrequencyTableUsingClassmarks
method. Equally spaced intervals can be defined using class marks.
In this approach two double precision arrays of length xIntervals
and
yIntervals
containing the class midpoints for x and y respectively are passed
to the getFrequencyTableUsingClassmarks(cx[]
, cy[])
.
The class marks, or midpoints, must be equally spaced.
Finally in those applications where unequal length intervals are preferred, the
getFrequencyTableUsingCutpoints(cx[]
, cy[])
method can
be used. The double precision arrays cx
and cy
with
lengths xIntervals-1
and yIntervals-1
respectively
contain the class boundaries listed in ascending order. The first cut point
defines the first class which is used to tally all data less than or equal
to the first cut point value. The last cut point defines the last
class which is used to tally all data greater than or equal to the
last cut point value.
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 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 |
---|
public TableTwoWay(double[] x, int xIntervals, double[] y, int yIntervals)
TableTwoWay
.
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 |
---|
public double[][] getFrequencyTable()
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
.
double
array containing
the two-way frequency table.public double[][] getFrequencyTable(double xLowerBound, double xUpperBound, double yLowerBound, double yUpperBound)
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.
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
.
double
array containing
the two-way frequency table.public double[][] getFrequencyTableUsingClassmarks(double[] cx, double[] cy)
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.
cx
- double
array containing
the class marks for x
.cy
- double
array containing
the class marks for y
.
double
array containing
the two-way frequency table.public double[][] getFrequencyTableUsingCutpoints(double[] cx, double[] cy)
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.
cx
- double
array containing the cutpoints
for x
.cy
- double
array containing the cutpoints
for y
.
double
array containing
the two-way frequency table.public double getMaximumX()
double
containing the maximum
data bound for x.public double getMaximumY()
double
containing the maximum
data bound for y.public double getMinimumX()
double
containing the minimum
data bound for x.public double getMinimumY()
double
containing the minimum
data bound for y.
|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |