com.bayesserver.analysis

Class HistogramDensity

• All Implemented Interfaces:
EmpiricalDensity

```public final class HistogramDensity
extends Object
implements EmpiricalDensity```
Represents an empirical density function built from a histogram, which can represent arbitrary univariate distributions.
• Constructor Summary

Constructors
Constructor and Description
```HistogramDensity(List<Interval<Double>> intervals, List<Double> intervalCounts)```
Constructs an empirical density function.
• Method Summary

Methods
Modifier and Type Method and Description
`double` `cdf(double x)`
Calculates an approximate value for cdf(x).
`double` `inverseCdf(double probability)`
Calculates an approximate value for the inverse cumulative distribution function.
`static HistogramDensity` ```learn(Iterable<WeightedValue> values, HistogramDensityOptions options)```
Learns a univariate empirical density from data.
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Constructor Detail

• HistogramDensity

```public HistogramDensity(List<Interval<Double>> intervals,
List<Double> intervalCounts)```
Constructs an empirical density function.
Parameters:
`intervals` - The intervals making up the approximate density.
`intervalCounts` - The number of elements in each interval.
• Method Detail

• inverseCdf

`public double inverseCdf(double probability)`
Calculates an approximate value for the inverse cumulative distribution function.
Specified by:
`inverseCdf` in interface `EmpiricalDensity`
Parameters:
`probability` - The probability p at which to return x when p = Cdf(x) .
Returns:
The approximate inverse cdf.
• cdf

`public double cdf(double x)`
Calculates an approximate value for cdf(x).
Specified by:
`cdf` in interface `EmpiricalDensity`
Parameters:
`x` - The value at which to evaluate the cdf.
Returns:
The approximate cdf(x).
• learn

```public static HistogramDensity learn(Iterable<WeightedValue> values,
HistogramDensityOptions options)```
Learns a univariate empirical density from data.
Parameters:
`values` - The values to learn from.
`options` - Options affecting the learning process.
Returns:
An empirical density.