org.expasy.jpl.commons.collection.stat
Class HistogramDataSet

java.lang.Object
  extended by org.expasy.jpl.commons.collection.stat.HistogramDataSet

public final class HistogramDataSet
extends Object

In statistics, a histogram is a graphical representation, showing a visual impression of the distribution of data. A histogram consists of tabular frequencies, shown as adjacent rectangles, erected over discrete intervals (bins), with an area equal to the frequency of the observations in the interval. The height of a rectangle is also equal to the frequency density of the interval, i.e., the frequency divided by the width of the interval. The total area of the histogram is equal to the number of data. A histogram may also be normalized displaying relative frequencies. It then shows the proportion of cases that fall into each of several categories, with the total area equaling 1. The categories are usually specified as consecutive, non-overlapping intervals of a variable. The categories (intervals) must be adjacent, and often are chosen to be of the same size.

Version:
1.0
Author:
nikitin

Nested Class Summary
static class HistogramDataSet.Builder
          Build a binned peak list with binNumber bins, the bins precision is deduced.
static class HistogramDataSet.OutOfUpperBoundException
           
 
Field Summary
static double DEFAULT_BIN_WIDTH
          default bin width
static int DEFAULT_SMOOTHING_WINDOW_WIDTH
          default window width
 
Constructor Summary
HistogramDataSet(HistogramDataSet.Builder builder)
          Create a binned peak list from a builder.
 
Method Summary
 double binWidth()
           
 int getBinIndex(double value)
          Get the index of bin containing the given value.
static int getBinIndex(double value, Interval interval, double binWidth)
          Get the index of bin containing the given value.
 double[] getBins()
           
 double getBinWidth()
           
 int[] getBoundIndicesAtBin(int i)
          Get bounds indices
 Interval getIntervalBinAt(int i)
           
 Interval getIntervalOfDefinition()
           
 IntegerSequence getLoadedValuesIndices()
           
 double getMaxValue()
           
 double getMinValue()
           
 double getNormalizedValue()
           
 double getPpm()
           
 double getStdError()
           
 double[] getValues()
           
 double[] getValuesAtBin(int index)
           
 double[] getValuesAtInterval(Interval interval)
           
 IntegerSequence getValuesIndicesAtInterval(Interval interval)
           
 double getWeighAtBin(int i)
           
 double getWeighAtInterval(Interval interval)
           
 double[] getWeights()
           
 boolean hasBin(double value)
           
 boolean isDataNormalized()
           
 boolean isNormalizedSum()
           
 int size()
           
static HistogramDataSet smoothHisto(HistogramDataSet histo)
           
static HistogramDataSet smoothHisto(HistogramDataSet histo, int windowWidth)
          A local smoothing by medians, of given window size is applied to the given histogram.
 StatisticalCategory toCategory(int i)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BIN_WIDTH

public static double DEFAULT_BIN_WIDTH
default bin width


DEFAULT_SMOOTHING_WINDOW_WIDTH

public static int DEFAULT_SMOOTHING_WINDOW_WIDTH
default window width

Constructor Detail

HistogramDataSet

public HistogramDataSet(HistogramDataSet.Builder builder)
Create a binned peak list from a builder.

Parameters:
builder - the builder that provides data.
Method Detail

smoothHisto

public static HistogramDataSet smoothHisto(HistogramDataSet histo)

smoothHisto

public static HistogramDataSet smoothHisto(HistogramDataSet histo,
                                           int windowWidth)
A local smoothing by medians, of given window size is applied to the given histogram.

Parameters:
histo - the dataset to convert.
windowWidth - the window width.
Returns:
a baseline histogram dataset.

getIntervalOfDefinition

public Interval getIntervalOfDefinition()
Returns:
the intervalOfDefinition

getBinWidth

public double getBinWidth()
Returns:
the binWidth

getStdError

public double getStdError()
Returns:
the stdError

getPpm

public double getPpm()
Returns:
the ppm

hasBin

public boolean hasBin(double value)

getBinIndex

public static int getBinIndex(double value,
                              Interval interval,
                              double binWidth)
                       throws HistogramDataSet.OutOfUpperBoundException
Get the index of bin containing the given value.

Parameters:
value - the value to look for bin index from.
interval - the boundaries.
binWidth - the bin width.
Returns:
a positive integer if found else -1.
Throws:
HistogramDataSet.OutOfUpperBoundException

getBinIndex

public int getBinIndex(double value)
                throws HistogramDataSet.OutOfUpperBoundException
Get the index of bin containing the given value.

Parameters:
value - the value to look for bin index from.
Returns:
a positive integer if found else -1.
Throws:
HistogramDataSet.OutOfUpperBoundException
OutOfLowerBoundException

getIntervalBinAt

public Interval getIntervalBinAt(int i)

getBoundIndicesAtBin

public int[] getBoundIndicesAtBin(int i)
Get bounds indices

Parameters:
i -
Returns:

getValuesIndicesAtInterval

public IntegerSequence getValuesIndicesAtInterval(Interval interval)

getValues

public double[] getValues()

getLoadedValuesIndices

public IntegerSequence getLoadedValuesIndices()

getMinValue

public double getMinValue()

getMaxValue

public double getMaxValue()

getValuesAtBin

public double[] getValuesAtBin(int index)

getValuesAtInterval

public double[] getValuesAtInterval(Interval interval)

getWeighAtBin

public double getWeighAtBin(int i)

getWeighAtInterval

public double getWeighAtInterval(Interval interval)

getWeights

public double[] getWeights()
Returns:
the weights

getBins

public double[] getBins()
Returns:
the bins

getNormalizedValue

public double getNormalizedValue()
Returns:
the normalized value

isNormalizedSum

public boolean isNormalizedSum()

isDataNormalized

public boolean isDataNormalized()

size

public int size()

binWidth

public double binWidth()

toCategory

public StatisticalCategory toCategory(int i)

toString

public String toString()
Overrides:
toString in class Object


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.