edu.ucla.util
Class DataSetStatistic

Object
  extended by DataSetStatistic

public class DataSetStatistic
extends Object

Based on Chrisanna Waldrop, Copyright Officer, 805-893-7773, waldrop@research.ucsb.edu, package edu.ucsb.nmsl.tools, url http://www.nmsl.cs.ucsb.edu/autocap

Since:
20060217
Author:
keith cascio

Constructor Summary
DataSetStatistic(String name, Collection<T> c)
          This constructor creates a DataSetStatistic with a given name and with data from the specified collection.
DataSetStatistic(String name, int inititalSize)
          Empty data set.
 
Method Summary
 void addDataPoint(double x)
           
 void clear()
           
static String format(double value, NumberFormat format)
           
 double getMax()
           
 double getMean()
          This method returns the mean of all data points in the set.
 double getMedian()
          This method calculates and returns the median value of the data points in the set.
 double getMin()
           
 double getMode()
           
 int getModeFrequency()
           
 double getStdDev()
          This method calculates are returns the standard deviation of all the data in the set.
 int getZeroFrequency()
           
 boolean removeDataPoint(double x)
           
 Appendable report(Appendable buff)
           
 Appendable report(Appendable buff, NumberFormat format)
           
 void sort()
           
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSetStatistic

public DataSetStatistic(String name,
                        int inititalSize)
Empty data set.

Parameters:
name - Descriptive name for data.
inititalSize - Allocate initial size ArrayList.

DataSetStatistic

public DataSetStatistic(String name,
                        Collection<T> c)
This constructor creates a DataSetStatistic with a given name and with data from the specified collection.

Parameters:
name - Descriptive name for data.
c - A collection of data that becomes the data points in the data set.
Method Detail

addDataPoint

public void addDataPoint(double x)

removeDataPoint

public boolean removeDataPoint(double x)

getStdDev

public double getStdDev()
This method calculates are returns the standard deviation of all the data in the set. The calculation is sped up by keeping a running sum and variance as data points are added and subtracted from the set.

Returns:
The standard deviation of all the data points in the set.

getMean

public double getMean()
This method returns the mean of all data points in the set. The calculation is sped up by using a running sum of all the data points as they are added to and subracted from the set.

Returns:
The mean of all data points in the set.

getMedian

public double getMedian()
This method calculates and returns the median value of the data points in the set. This is the straight forward linear implementation of the median algorithm. Perhaps in the future a faster median algorithm can be used.

Returns:
The median value of the data points in the set.

getMode

public double getMode()

getModeFrequency

public int getModeFrequency()

getZeroFrequency

public int getZeroFrequency()

getMin

public double getMin()

getMax

public double getMax()

sort

public void sort()

report

public Appendable report(Appendable buff)

report

public Appendable report(Appendable buff,
                         NumberFormat format)
Since:
20060313

format

public static String format(double value,
                            NumberFormat format)

clear

public void clear()
Since:
20060312


Copyright 2010 UCLA Automated Reasoning Group