Class Histogram

java.lang.Object
ubic.basecode.math.distribution.Histogram

public class Histogram extends Object
A simple histogram.
Author:
keshav
  • Constructor Details

    • Histogram

      public Histogram(String name, int nbins, double min, double max)
      Parameters:
      name -
      nbins -
      min -
      max -
    • Histogram

      public Histogram(String name, int nbins, DoubleMatrix1D data)
      Parameters:
      name -
      nbins -
      data -
  • Method Details

    • entries

      public int entries()
      The number of entries in the histogram (the number of times fill has been called).
      Returns:
      number of entries
    • fill

      public void fill(double x)
      Fill the histogram with x.
      Parameters:
      x - is the value to add in to the histogram
    • fill

      public void fill(DoubleMatrix1D ghr)
      Parameters:
      ghr -
    • fill

      public void fill(int binNum, int count)
      Add the given number of counts to the given bin.
      Parameters:
      binNum -
      count -
    • getApproximateQuantile

      public Double getApproximateQuantile(int q)
      Find the bin below which i% of the values are contained. This is only approximate (especially if the number of bins is invalid input: '<'~100)
      Parameters:
      q -
      Returns:
      approximate quantile. Passing values of 0 and 100 is equivalent to min() and max() respectively.
    • getArray

      public double[] getArray()
      Returns the bin heights.
      Returns:
      array of bin heights
    • getBiggestBinSize

      public int getBiggestBinSize()
      Returns:
      the number of items in the bin that has the most members.
    • getBinEdges

      public Double[] getBinEdges()
      Returns:
    • getBinEdgesStrings

      public String[] getBinEdgesStrings()
    • getBinOf

      public int getBinOf(double x)
      Parameters:
      x -
      Returns:
      the index of the bin where x would fall. If x is out of range you get 0 or (nbins - 1).
    • getName

      public String getName()
      The name of the histogram.
      Returns:
      histogram name
    • max

      public double max()
      Returns:
      maximum x value covered by histogram
    • min

      public double min()
      Returns:
      minimum x value covered by histogram
    • numberOfBins

      public int numberOfBins()
      Get the number of bins in the histogram. The range of the histogram defined by min and max, and the range is divided into the number of returned.
      Returns:
      number of bins
    • overflow

      public double overflow()
      The height of the overflow bin.
      Returns:
      number of overflows
    • stepSize

      public double stepSize()
      Returns:
      size of each bin
    • underflow

      public double underflow()
      The height of the underflow bin.
      Returns:
      number of underflows
    • writeToFile

      public void writeToFile(FileWriter out) throws IOException
      Write the histogram to a file. The format is:

      bin (lower edge), number in bin.

      Parameters:
      out -
      Throws:
      IOException