org.jscience.mathematics.statistics
Class IntervalData

java.lang.Object
  extended by org.jscience.mathematics.statistics.IntervalData
All Implemented Interfaces:
java.io.Serializable, Named

public class IntervalData
extends java.lang.Object
implements java.io.Serializable, Named

This class defines a simple implementation of an interval data distribution. The data distribution is based on a specified domain (that is, a partition of an interval). When values are added, frequency counts for the subintervals are computed and various statistic updated.

See Also:
Serialized Form

Constructor Summary
IntervalData()
          This default constructor creates a new data distribution on the interval [0, 1] with subintervals of length 0.1, and the default name "X".
IntervalData(DistributionDomain d)
          This special constructor creates a new data distribution with a specified domain and the default name "X".
IntervalData(DistributionDomain d, java.lang.String n)
          This general constructor creates a new data distribution with a specified domain and a specified name.
IntervalData(double a, double b, double w)
          This spcial constructor creates a new data distribution with a specified (continuous) domain and the name "X".
IntervalData(double a, double b, double w, java.lang.String n)
          This general constructor creates a new data distribution with a specified (continuous) domain and a specified name.
 
Method Summary
 double getDensity(double x)
          This method returns the density of the data distribution at a given value.
 DistributionDomain getDomain()
          This method returns the domain.
 double getDomainValue(double x)
          This method returns the domain value (midpoint) closest to given value of x.
 int getFreq(double x)
          This method returns the frequency of the class containing a given value.
 int[] getFrequencies()
          DOCUMENT ME!
 double getIntervalMean()
          This method returns the mean of the frequency distribution.
 double getIntervalSD()
          This method returns the interval standard deviation.
 double getIntervalVariance()
          This method returns the variance of the frequency distribution.
 double getMAD()
          This method computes the mean absoulte deviation from the median.
 double getMaxDensity()
          This method returns the maximum density of the data set.
 int getMaxFreq()
          This method returns the maximum frequency of the data set.
 double getMaxRelFreq()
          This method returns the maximum relative frequency of the data set.
 double getMaxValue()
          This method returns the maximum value of the data set.
 double getMean()
          This method returns the true mean of the data set.
 double getMedian()
          This method computes the median of the entire data set.
 double getMedian(double a, double b)
          This method computes the median of the values in the data set between two specified values.
 double getMinValue()
          This method returns the minimum value of the data set.
 double getMode()
          This method returns the mode of the distribution, if it is unique.
 java.lang.String getName()
          This method gets the name of the data set.
 double getQuartile(int i)
          This method returns the quartiles of the data set.
 double getRelFreq(double x)
          This method returns the relative frequency of the class containing a given value.
 double getSD()
          This method returns the standard deviation of the data set treated as a sample (that is, the sum is divided by n − 1 where n is the number of points.
 double getSDP()
          This method returns the standard deviation of the data set treated as a population (that is, the sum is divided by the number of points n rather than n − 1).
 int getSize()
          This method returns the number of points in the data set.
 double getValue()
          This method returns the current value of the data set.
 double getVariance()
          This method returns the variance of the data set treated as a sample (that is, the sum is divided by n − 1 where n is the number of points).
 double getVarianceP()
          This method returns the variance of the data set treated as a population (that is, the sum is divided by the number of points n rather than n − 1).
 void reset()
          This method resets the data set.
 void setDomain(DistributionDomain d)
          This method sets the domain of the data set.
 void setName(java.lang.String n)
          This method sets the name of the data set.
 void setValue(double x)
          This method adds a new number to the data set and re-computes the mean, mean square, minimum and maximum values, the frequency distribution, and the mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntervalData

public IntervalData(DistributionDomain d,
                    java.lang.String n)
This general constructor creates a new data distribution with a specified domain and a specified name.

Parameters:
d - the domain
n - the name

IntervalData

public IntervalData(double a,
                    double b,
                    double w,
                    java.lang.String n)
This general constructor creates a new data distribution with a specified (continuous) domain and a specified name.

Parameters:
a - the lower bound
b - the upper bound
w - the step size
n - the name

IntervalData

public IntervalData(DistributionDomain d)
This special constructor creates a new data distribution with a specified domain and the default name "X".

Parameters:
d - the domain

IntervalData

public IntervalData(double a,
                    double b,
                    double w)
This spcial constructor creates a new data distribution with a specified (continuous) domain and the name "X".

Parameters:
a - the lower bound
b - the upper bound
w - the step size

IntervalData

public IntervalData()
This default constructor creates a new data distribution on the interval [0, 1] with subintervals of length 0.1, and the default name "X".

Method Detail

setDomain

public void setDomain(DistributionDomain d)
This method sets the domain of the data set.

Parameters:
d - the domain

getDomain

public DistributionDomain getDomain()
This method returns the domain.

Returns:
the domain

setName

public void setName(java.lang.String n)
This method sets the name of the data set.

Parameters:
n - the name

getName

public java.lang.String getName()
This method gets the name of the data set.

Specified by:
getName in interface Named
Returns:
the name

reset

public void reset()
This method resets the data set. The frequency distribution is cleared and the minimum and maximum values are reset.


setValue

public void setValue(double x)
This method adds a new number to the data set and re-computes the mean, mean square, minimum and maximum values, the frequency distribution, and the mode.

Parameters:
x - the number to be added to the data set

getValue

public double getValue()
This method returns the current value of the data set.

Returns:
the current (last) value of the data set

getDomainValue

public double getDomainValue(double x)
This method returns the domain value (midpoint) closest to given value of x.

Parameters:
x - a real number
Returns:
the midpoint of the subinterval containing x

getFreq

public int getFreq(double x)
This method returns the frequency of the class containing a given value.

Parameters:
x - a real number
Returns:
the frequency of the subinterval containing x

getFrequencies

public int[] getFrequencies()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getRelFreq

public double getRelFreq(double x)
This method returns the relative frequency of the class containing a given value.

Parameters:
x - a real number
Returns:
the relative frequency of the class containing x

getDensity

public double getDensity(double x)
This method returns the density of the data distribution at a given value. The density is the relative frequency divided by the width of the subinterval.

Parameters:
x - a real number
Returns:
the density at x

getMean

public double getMean()
This method returns the true mean of the data set.

Returns:
the mean

getIntervalMean

public double getIntervalMean()
This method returns the mean of the frequency distribution. The interval mean is an approximation of the true mean of the data set, and is equivalent to rounding each value in the data set to the nearest interval midpoint.

Returns:
the interval mean

getVarianceP

public double getVarianceP()
This method returns the variance of the data set treated as a population (that is, the sum is divided by the number of points n rather than n − 1).

Returns:
the variance

getSDP

public double getSDP()
This method returns the standard deviation of the data set treated as a population (that is, the sum is divided by the number of points n rather than n − 1).

Returns:
DOCUMENT ME!

getVariance

public double getVariance()
This method returns the variance of the data set treated as a sample (that is, the sum is divided by n − 1 where n is the number of points).

Returns:
the variance.

getSD

public double getSD()
This method returns the standard deviation of the data set treated as a sample (that is, the sum is divided by n − 1 where n is the number of points.

Returns:
the standard deviation

getIntervalVariance

public double getIntervalVariance()
This method returns the variance of the frequency distribution. This is an approximation to the true variance, and is equivalent to rounding each value in the data set to the nearest interval midpoint.

Returns:
the interval variance

getIntervalSD

public double getIntervalSD()
This method returns the interval standard deviation. This is an approximation to the true standard deviation, and is equivalent to rounding each value in the data set to the nearest interval midpoint.

Returns:
the interval standard deviation

getMinValue

public double getMinValue()
This method returns the minimum value of the data set.

Returns:
the minimum value

getMaxValue

public double getMaxValue()
This method returns the maximum value of the data set.

Returns:
the maximum value

getMedian

public double getMedian(double a,
                        double b)
This method computes the median of the values in the data set between two specified values.

Parameters:
a - the lower value
b - the upper value
Returns:
the median of the values between a and b

getMedian

public double getMedian()
This method computes the median of the entire data set.

Returns:
the median

getQuartile

public double getQuartile(int i)
This method returns the quartiles of the data set.

Parameters:
i - the index of the quartile (1, 2, or 3)
Returns:
the quartile of index i

getMAD

public double getMAD()
This method computes the mean absoulte deviation from the median.

Returns:
the mean absoluted deviation

getSize

public int getSize()
This method returns the number of points in the data set.

Returns:
the size of hte data set.

getMaxFreq

public int getMaxFreq()
This method returns the maximum frequency of the data set.

Returns:
the maximum frequency

getMaxRelFreq

public double getMaxRelFreq()
This method returns the maximum relative frequency of the data set.

Returns:
the maximum relative frequency

getMaxDensity

public double getMaxDensity()
This method returns the maximum density of the data set.

Returns:
the maximum density

getMode

public double getMode()
This method returns the mode of the distribution, if it is unique. Otherwise, the mode does not exist. The mode is the midpoint of the interval with the largest frequency.

Returns:
the mode