public class Histogram extends SimpleStatsTally
Modifier and Type | Field and Description |
---|---|
private double |
cellWidth
Contains the bin width.
|
private int[] |
frequency
Contains the number of observations that fall into each bin.
|
private double |
lowValue
Contains the lower bound of the first bin.
|
private int |
total
Contains the total number of observations.
|
private double[] |
values |
count, DEFAULT_NAME, DEFAULT_NUMBER_FORMAT, maxObs, minObs, name, numberFormat
EOL
Constructor and Description |
---|
Histogram(java.lang.String name,
double lowVal,
double hiVal,
int number)
Creates a new Histogram.
|
Histogram(java.lang.String name,
int number)
Creates a new Histogram with a lower bound of 0 and a bin width of 1.
|
Modifier and Type | Method and Description |
---|---|
double |
getCellWidth() |
int[] |
getFrequencies() |
int[] |
getFrequency() |
double |
getLowValue() |
double[] |
getProportions()
Note that if any observations were less than the lower bound or greater
than the upper bound, then the proportions will not add up to 1.
|
double[] |
getScaledProportions() |
int |
getTotal() |
double[] |
getValues() |
void |
newObservation(double x)
Update counters with a new observation.
|
void |
reset()
Should reset/initialize all relevant counters.
|
java.lang.String |
toString()
Return a String containing the Name, SamplingType, and the DataLine for
this SampleStatistic.
|
getMean, getSamplingType, getStandardDeviation, getVariance
clone, getCount, getDataLine, getMaxObs, getMinObs, getName, newObservation, newObservation, newObservation, propertyChange, setName, setNumberFormat, setSamplingType
private double[] values
private int[] frequency
private int total
private double lowValue
private double cellWidth
public Histogram(java.lang.String name, int number)
name
- The name of the property for which this Histogram collects
statistics.number
- The number of bins.public Histogram(java.lang.String name, double lowVal, double hiVal, int number)
name
- The name of the property for which this Histogram collects
statistics.lowVal
- The lower bound of the first bin.hiVal
- The upper bound of the last bin.number
- The number of bins.public void newObservation(double x)
SimpleStatsTally
newObservation
in interface SampleStatistics
newObservation
in class SimpleStatsTally
x
- The new (primitive) observation.public void reset()
SampleStatistics
reset
in interface SampleStatistics
reset
in class SimpleStatsTally
public int[] getFrequencies()
public double[] getProportions()
public double[] getScaledProportions()
public java.lang.String toString()
AbstractSimpleStats
toString
in class AbstractSimpleStats
AbstractSimpleStats.getDataLine()
public double[] getValues()
public int[] getFrequency()
public int getTotal()
public double getLowValue()
public double getCellWidth()