|
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.TableOneWay
public class TableOneWay
Class TableOneWay
calculates a frequency table for a data array.
A one-way frequency table can be used to visualize the shape of the
data distribution and look for anomalies in the data. There are many
approaches to constructing frequency tables. Four approaches are
implemented in this class:
The TableOneWay
class implements the first two approaches by
overloading the getFrequencyTable
method. If
getFrequencyTable()
is used without input arguments,
nIntervals
of equal length are formed between the minimum and maximum values
in the data. 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 getMinimum
and getMaximum
.
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(lower_bound, upper_bound)
. This method
tallies all data less than or equal to the lower_bound
into
the first class, and all data greater than or equal to upper_bound
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 a double precision array
of length nIntervals containing the class midpoints is passed to the
getFrequencyTableUsingClassmarks(classmarks[])
. The class marks,
or midpoints, must be equally spaced.
Finally in those applications where unequal length intervals are preferred,
the getFrequencyTableUsingCutpoints(cutpoints[])
method can be used.
The double precision array cutpoints
has length
nIntervals-1
and contains 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 | |
---|---|
TableOneWay(double[] x,
int nIntervals)
Constructor for TableOneWay . |
Method Summary | |
---|---|
double[] |
getFrequencyTable()
Returns the one-way frequency table. |
double[] |
getFrequencyTable(double lower_bound,
double upper_bound)
Returns a one-way frequency table using known bounds. |
double[] |
getFrequencyTableUsingClassmarks(double[] classmarks)
Returns the one-way frequency table using class marks. |
double[] |
getFrequencyTableUsingCutpoints(double[] cutpoints)
Returns the one-way frequency table using cutpoints. |
double |
getMaximum()
Returns maximum value of x . |
double |
getMinimum()
Returns the minimum value of x . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableOneWay(double[] x, int nIntervals)
TableOneWay
.
x
- A double
array containing
the observations.nIntervals
- An int
scalar containing the
number of intervals (bins).Method Detail |
---|
public double[] getFrequencyTable()
nIntervals
intervals of equal length are used with the initial interval
starting with the minimum value in x
and the last interval
ending with the maximum value in x
. The initial interval is
closed on the left and the right. The remaining intervals are
open on the left and the closed on the right. Each interval is
of length (max-min)/nIntervals
, where max
is the
maximum value of x and min
is the minimum value of x
.
double
array containing the one-way frequency
table.public double[] getFrequencyTable(double lower_bound, double upper_bound)
lower_bound
as its right endpoint. The last interval is open on the left
and includes all values greater than upper_bound
.
The remaining nIntervals - 2
intervals are each
of length
(upper_bound - lower_bound)/ (nIntervals - 2)
and are open on the left and closed on the right.
nIntervals
must be greater than or equal to 3.
lower_bound
- double
specifies the right endpoint.upper_bound
- double
specifies the left endpoint.
double
array containing the one-way frequency
table.public double[] getFrequencyTableUsingClassmarks(double[] classmarks)
classmarks
of length nIntervals
.
The class marks are the midpoints of each of the nIntervals
.
Each interval is assumed to have length classmarks[1] - classmarks[0]
.
nIntervals
must be greater than or equal to 2.
classmarks
- double
array containing either the cutpoints or
the class marks.
double
array containing the one-way frequency
table.public double[] getFrequencyTableUsingCutpoints(double[] cutpoints)
cutpoints
of length nIntervals
-1. This
option allows unequal interval lengths. The initial interval
is closed on the right and includes the initial cutpoint as
its right endpoint. The last interval is open on the left
and includes all values greater than the last cutpoint.
The remaining nIntervals
-2 intervals are open
on the left and closed on the right. Argument nIntervals
must be greater than or equal to 3 for this option.
cutpoints
- double
array containing the cutpoints.
double
array containing the one-way frequency
table.public double getMaximum()
x
.
double
containing the maximum
data bound.public double getMinimum()
x
.
double
containing the minimum
data bound.
|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |