blob: 47f9de5608babfd7e3f2afc66cddbc03f4b45cd5 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>EmpiricalDistribution (Apache Commons Math 3.3 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="EmpiricalDistribution (Apache Commons Math 3.3 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/EmpiricalDistribution.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/math3/random/CorrelatedRandomVectorGenerator.html" title="class in org.apache.commons.math3.random"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/math3/random/GaussianRandomGenerator.html" title="class in org.apache.commons.math3.random"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/math3/random/EmpiricalDistribution.html" target="_top">Frames</a></li>
<li><a href="EmpiricalDistribution.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.math3.random</div>
<h2 title="Class EmpiricalDistribution" class="title">Class EmpiricalDistribution</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html" title="class in org.apache.commons.math3.distribution">org.apache.commons.math3.distribution.AbstractRealDistribution</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.math3.random.EmpiricalDistribution</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>, <a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">EmpiricalDistribution</span>
extends <a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html" title="class in org.apache.commons.math3.distribution">AbstractRealDistribution</a></pre>
<div class="block"><p>Represents an <a href="http://http://en.wikipedia.org/wiki/Empirical_distribution_function">
empirical probability distribution</a> -- a probability distribution derived
from observed data without making any assumptions about the functional form
of the population distribution that the data come from.</p>
<p>An <code>EmpiricalDistribution</code> maintains data structures, called
<i>distribution digests</i>, that describe empirical distributions and
support the following operations: <ul>
<li>loading the distribution from a file of observed data values</li>
<li>dividing the input data into "bin ranges" and reporting bin frequency
counts (data for histogram)</li>
<li>reporting univariate statistics describing the full set of data values
as well as the observations within each bin</li>
<li>generating random values from the distribution</li>
</ul>
Applications can use <code>EmpiricalDistribution</code> to build grouped
frequency histograms representing the input data or to generate random values
"like" those in the input file -- i.e., the values generated will follow the
distribution of the values in the file.</p>
<p>The implementation uses what amounts to the
<a href="http://nedwww.ipac.caltech.edu/level5/March02/Silverman/Silver2_6.html">
Variable Kernel Method</a> with Gaussian smoothing:<p>
<strong>Digesting the input file</strong>
<ol><li>Pass the file once to compute min and max.</li>
<li>Divide the range from min-max into <code>binCount</code> "bins."</li>
<li>Pass the data file again, computing bin counts and univariate
statistics (mean, std dev.) for each of the bins </li>
<li>Divide the interval (0,1) into subintervals associated with the bins,
with the length of a bin's subinterval proportional to its count.</li></ol>
<strong>Generating random values from the distribution</strong><ol>
<li>Generate a uniformly distributed value in (0,1) </li>
<li>Select the subinterval to which the value belongs.
<li>Generate a random Gaussian value with mean = mean of the associated
bin and std dev = std dev of associated bin.</li></ol></p>
<p>EmpiricalDistribution implements the <a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution"><code>RealDistribution</code></a> interface
as follows. Given x within the range of values in the dataset, let B
be the bin containing x and let K be the within-bin kernel for B. Let P(B-)
be the sum of the probabilities of the bins below B and let K(B) be the
mass of B under K (i.e., the integral of the kernel density over B). Then
set P(X < x) = P(B-) + P(B) * K(x) / K(B) where K(x) is the kernel distribution
evaluated at x. This results in a cdf that matches the grouped frequency
distribution at the bin endpoints and interpolates within bins using
within-bin kernels.</p>
<strong>USAGE NOTES:</strong><ul>
<li>The <code>binCount</code> is set by default to 1000. A good rule of thumb
is to set the bin count to approximately the length of the input file divided
by 10. </li>
<li>The input file <i>must</i> be a plain text file containing one valid numeric
entry per line.</li>
</ul></p></div>
<dl><dt><span class="strong">Version:</span></dt>
<dd>$Id: EmpiricalDistribution.java 1587494 2014-04-15 10:02:54Z erans $</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../serialized-form.html#org.apache.commons.math3.random.EmpiricalDistribution">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#DEFAULT_BIN_COUNT">DEFAULT_BIN_COUNT</a></strong></code>
<div class="block">Default bin count</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../../../../org/apache/commons/math3/random/RandomDataGenerator.html" title="class in org.apache.commons.math3.random">RandomDataGenerator</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#randomData">randomData</a></strong></code>
<div class="block">RandomDataGenerator instance to use in repeated calls to getNext()</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_org.apache.commons.math3.distribution.AbstractRealDistribution">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;org.apache.commons.math3.distribution.<a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html" title="class in org.apache.commons.math3.distribution">AbstractRealDistribution</a></h3>
<code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#random">random</a>, <a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#SOLVER_DEFAULT_ABSOLUTE_ACCURACY">SOLVER_DEFAULT_ABSOLUTE_ACCURACY</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution()">EmpiricalDistribution</a></strong>()</code>
<div class="block">Creates a new EmpiricalDistribution with the default bin count.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(int)">EmpiricalDistribution</a></strong>(int&nbsp;binCount)</code>
<div class="block">Creates a new EmpiricalDistribution with the specified bin count.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(int, org.apache.commons.math3.random.RandomDataImpl)">EmpiricalDistribution</a></strong>(int&nbsp;binCount,
<a href="../../../../../org/apache/commons/math3/random/RandomDataImpl.html" title="class in org.apache.commons.math3.random">RandomDataImpl</a>&nbsp;randomData)</code>
<div class="block"><strong>Deprecated.</strong>&nbsp;
<div class="block"><i>As of 3.1. Please use <a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(int, org.apache.commons.math3.random.RandomGenerator)"><code>EmpiricalDistribution(int,RandomGenerator)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(int, org.apache.commons.math3.random.RandomGenerator)">EmpiricalDistribution</a></strong>(int&nbsp;binCount,
<a href="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</a>&nbsp;generator)</code>
<div class="block">Creates a new EmpiricalDistribution with the specified bin count using the
provided <a href="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random"><code>RandomGenerator</code></a> as the source of random data.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(org.apache.commons.math3.random.RandomDataImpl)">EmpiricalDistribution</a></strong>(<a href="../../../../../org/apache/commons/math3/random/RandomDataImpl.html" title="class in org.apache.commons.math3.random">RandomDataImpl</a>&nbsp;randomData)</code>
<div class="block"><strong>Deprecated.</strong>&nbsp;
<div class="block"><i>As of 3.1. Please use <a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(org.apache.commons.math3.random.RandomGenerator)"><code>EmpiricalDistribution(RandomGenerator)</code></a> instead.</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(org.apache.commons.math3.random.RandomGenerator)">EmpiricalDistribution</a></strong>(<a href="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</a>&nbsp;generator)</code>
<div class="block">Creates a new EmpiricalDistribution with default bin count using the
provided <a href="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random"><code>RandomGenerator</code></a> as the source of random data.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#cumulativeProbability(double)">cumulativeProbability</a></strong>(double&nbsp;x)</code>
<div class="block">For a random variable <code>X</code> whose values are distributed according
to this distribution, this method returns <code>P(X &lt;= x)</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#density(double)">density</a></strong>(double&nbsp;x)</code>
<div class="block">Returns the probability density function (PDF) of this distribution
evaluated at the specified point <code>x</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getBinCount()">getBinCount</a></strong>()</code>
<div class="block">Returns the number of bins.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../org/apache/commons/math3/stat/descriptive/SummaryStatistics.html" title="class in org.apache.commons.math3.stat.descriptive">SummaryStatistics</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getBinStats()">getBinStats</a></strong>()</code>
<div class="block">Returns a List of <a href="../../../../../org/apache/commons/math3/stat/descriptive/SummaryStatistics.html" title="class in org.apache.commons.math3.stat.descriptive"><code>SummaryStatistics</code></a> instances containing
statistics describing the values in each of the bins.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getGeneratorUpperBounds()">getGeneratorUpperBounds</a></strong>()</code>
<div class="block">Returns a fresh copy of the array of upper bounds of the subintervals
of [0,1] used in generating data from the empirical distribution.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getKernel(org.apache.commons.math3.stat.descriptive.SummaryStatistics)">getKernel</a></strong>(<a href="../../../../../org/apache/commons/math3/stat/descriptive/SummaryStatistics.html" title="class in org.apache.commons.math3.stat.descriptive">SummaryStatistics</a>&nbsp;bStats)</code>
<div class="block">The within-bin smoothing kernel.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getNextValue()">getNextValue</a></strong>()</code>
<div class="block">Generates a random value from this distribution.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getNumericalMean()">getNumericalMean</a></strong>()</code>
<div class="block">Use this method to get the numerical value of the mean of this
distribution.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getNumericalVariance()">getNumericalVariance</a></strong>()</code>
<div class="block">Use this method to get the numerical value of the variance of this
distribution.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/commons/math3/stat/descriptive/StatisticalSummary.html" title="interface in org.apache.commons.math3.stat.descriptive">StatisticalSummary</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getSampleStats()">getSampleStats</a></strong>()</code>
<div class="block">Returns a <a href="../../../../../org/apache/commons/math3/stat/descriptive/StatisticalSummary.html" title="interface in org.apache.commons.math3.stat.descriptive"><code>StatisticalSummary</code></a> describing this distribution.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getSupportLowerBound()">getSupportLowerBound</a></strong>()</code>
<div class="block">Access the lower bound of the support.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getSupportUpperBound()">getSupportUpperBound</a></strong>()</code>
<div class="block">Access the upper bound of the support.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getUpperBounds()">getUpperBounds</a></strong>()</code>
<div class="block">Returns a fresh copy of the array of upper bounds for the bins.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#inverseCumulativeProbability(double)">inverseCumulativeProbability</a></strong>(double&nbsp;p)</code>
<div class="block">Computes the quantile function of this distribution.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#isLoaded()">isLoaded</a></strong>()</code>
<div class="block">Property indicating whether or not the distribution has been loaded.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#isSupportConnected()">isSupportConnected</a></strong>()</code>
<div class="block">Use this method to get information about whether the support is connected,
i.e.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#isSupportLowerBoundInclusive()">isSupportLowerBoundInclusive</a></strong>()</code>
<div class="block">Whether or not the lower bound of support is in the domain of the density
function.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#isSupportUpperBoundInclusive()">isSupportUpperBoundInclusive</a></strong>()</code>
<div class="block">Whether or not the upper bound of support is in the domain of the density
function.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#load(double[])">load</a></strong>(double[]&nbsp;in)</code>
<div class="block">Computes the empirical distribution from the provided
array of numbers.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#load(java.io.File)">load</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>&nbsp;file)</code>
<div class="block">Computes the empirical distribution from the input file.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#load(java.net.URL)">load</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a>&nbsp;url)</code>
<div class="block">Computes the empirical distribution using data read from a URL.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#probability(double)">probability</a></strong>(double&nbsp;x)</code>
<div class="block">For a random variable <code>X</code> whose values are distributed according
to this distribution, this method returns <code>P(X = x)</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#reSeed(long)">reSeed</a></strong>(long&nbsp;seed)</code>
<div class="block">Reseeds the random number generator used by <a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getNextValue()"><code>getNextValue()</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#reseedRandomGenerator(long)">reseedRandomGenerator</a></strong>(long&nbsp;seed)</code>
<div class="block">Reseed the random generator used to generate samples.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#sample()">sample</a></strong>()</code>
<div class="block">Generate a random value sampled from this distribution.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.commons.math3.distribution.AbstractRealDistribution">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.apache.commons.math3.distribution.<a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html" title="class in org.apache.commons.math3.distribution">AbstractRealDistribution</a></h3>
<code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#cumulativeProbability(double, double)">cumulativeProbability</a>, <a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#getSolverAbsoluteAccuracy()">getSolverAbsoluteAccuracy</a>, <a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#logDensity(double)">logDensity</a>, <a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#probability(double, double)">probability</a>, <a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#sample(int)">sample</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="DEFAULT_BIN_COUNT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_BIN_COUNT</h4>
<pre>public static final&nbsp;int DEFAULT_BIN_COUNT</pre>
<div class="block">Default bin count</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#org.apache.commons.math3.random.EmpiricalDistribution.DEFAULT_BIN_COUNT">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="randomData">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>randomData</h4>
<pre>protected final&nbsp;<a href="../../../../../org/apache/commons/math3/random/RandomDataGenerator.html" title="class in org.apache.commons.math3.random">RandomDataGenerator</a> randomData</pre>
<div class="block">RandomDataGenerator instance to use in repeated calls to getNext()</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="EmpiricalDistribution()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EmpiricalDistribution</h4>
<pre>public&nbsp;EmpiricalDistribution()</pre>
<div class="block">Creates a new EmpiricalDistribution with the default bin count.</div>
</li>
</ul>
<a name="EmpiricalDistribution(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EmpiricalDistribution</h4>
<pre>public&nbsp;EmpiricalDistribution(int&nbsp;binCount)</pre>
<div class="block">Creates a new EmpiricalDistribution with the specified bin count.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>binCount</code> - number of bins</dd></dl>
</li>
</ul>
<a name="EmpiricalDistribution(int, org.apache.commons.math3.random.RandomGenerator)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EmpiricalDistribution</h4>
<pre>public&nbsp;EmpiricalDistribution(int&nbsp;binCount,
<a href="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</a>&nbsp;generator)</pre>
<div class="block">Creates a new EmpiricalDistribution with the specified bin count using the
provided <a href="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random"><code>RandomGenerator</code></a> as the source of random data.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>binCount</code> - number of bins</dd><dd><code>generator</code> - random data generator (may be null, resulting in default JDK generator)</dd><dt><span class="strong">Since:</span></dt>
<dd>3.0</dd></dl>
</li>
</ul>
<a name="EmpiricalDistribution(org.apache.commons.math3.random.RandomGenerator)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EmpiricalDistribution</h4>
<pre>public&nbsp;EmpiricalDistribution(<a href="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</a>&nbsp;generator)</pre>
<div class="block">Creates a new EmpiricalDistribution with default bin count using the
provided <a href="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random"><code>RandomGenerator</code></a> as the source of random data.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>generator</code> - random data generator (may be null, resulting in default JDK generator)</dd><dt><span class="strong">Since:</span></dt>
<dd>3.0</dd></dl>
</li>
</ul>
<a name="EmpiricalDistribution(int, org.apache.commons.math3.random.RandomDataImpl)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EmpiricalDistribution</h4>
<pre><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
public&nbsp;EmpiricalDistribution(int&nbsp;binCount,
<a href="../../../../../org/apache/commons/math3/random/RandomDataImpl.html" title="class in org.apache.commons.math3.random">RandomDataImpl</a>&nbsp;randomData)</pre>
<div class="block"><span class="strong">Deprecated.</span>&nbsp;<i>As of 3.1. Please use <a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(int, org.apache.commons.math3.random.RandomGenerator)"><code>EmpiricalDistribution(int,RandomGenerator)</code></a> instead.</i></div>
<div class="block">Creates a new EmpiricalDistribution with the specified bin count using the
provided <a href="../../../../../org/apache/commons/math3/random/RandomDataImpl.html" title="class in org.apache.commons.math3.random"><code>RandomDataImpl</code></a> instance as the source of random data.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>binCount</code> - number of bins</dd><dd><code>randomData</code> - random data generator (may be null, resulting in default JDK generator)</dd><dt><span class="strong">Since:</span></dt>
<dd>3.0</dd></dl>
</li>
</ul>
<a name="EmpiricalDistribution(org.apache.commons.math3.random.RandomDataImpl)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>EmpiricalDistribution</h4>
<pre><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
public&nbsp;EmpiricalDistribution(<a href="../../../../../org/apache/commons/math3/random/RandomDataImpl.html" title="class in org.apache.commons.math3.random">RandomDataImpl</a>&nbsp;randomData)</pre>
<div class="block"><span class="strong">Deprecated.</span>&nbsp;<i>As of 3.1. Please use <a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#EmpiricalDistribution(org.apache.commons.math3.random.RandomGenerator)"><code>EmpiricalDistribution(RandomGenerator)</code></a> instead.</i></div>
<div class="block">Creates a new EmpiricalDistribution with default bin count using the
provided <a href="../../../../../org/apache/commons/math3/random/RandomDataImpl.html" title="class in org.apache.commons.math3.random"><code>RandomDataImpl</code></a> as the source of random data.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>randomData</code> - random data generator (may be null, resulting in default JDK generator)</dd><dt><span class="strong">Since:</span></dt>
<dd>3.0</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="load(double[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>load</h4>
<pre>public&nbsp;void&nbsp;load(double[]&nbsp;in)
throws <a href="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></pre>
<div class="block">Computes the empirical distribution from the provided
array of numbers.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>in</code> - the input data array</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if in is null</dd></dl>
</li>
</ul>
<a name="load(java.net.URL)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>load</h4>
<pre>public&nbsp;void&nbsp;load(<a href="http://docs.oracle.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</a>&nbsp;url)
throws <a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a>,
<a href="../../../../../org/apache/commons/math3/exception/ZeroException.html" title="class in org.apache.commons.math3.exception">ZeroException</a></pre>
<div class="block">Computes the empirical distribution using data read from a URL.
<p>The input file <i>must</i> be an ASCII text file containing one
valid numeric entry per line.</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>url</code> - url of the input file</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an IO error occurs</dd>
<dd><code><a href="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if url is null</dd>
<dd><code><a href="../../../../../org/apache/commons/math3/exception/ZeroException.html" title="class in org.apache.commons.math3.exception">ZeroException</a></code> - if URL contains no data</dd></dl>
</li>
</ul>
<a name="load(java.io.File)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>load</h4>
<pre>public&nbsp;void&nbsp;load(<a href="http://docs.oracle.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>&nbsp;file)
throws <a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></pre>
<div class="block">Computes the empirical distribution from the input file.
<p>The input file <i>must</i> be an ASCII text file containing one
valid numeric entry per line.</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>file</code> - the input file</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an IO error occurs</dd>
<dd><code><a href="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if file is null</dd></dl>
</li>
</ul>
<a name="getNextValue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNextValue</h4>
<pre>public&nbsp;double&nbsp;getNextValue()
throws <a href="../../../../../org/apache/commons/math3/exception/MathIllegalStateException.html" title="class in org.apache.commons.math3.exception">MathIllegalStateException</a></pre>
<div class="block">Generates a random value from this distribution.
<strong>Preconditions:</strong><ul>
<li>the distribution must be loaded before invoking this method</li></ul></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the random value.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/exception/MathIllegalStateException.html" title="class in org.apache.commons.math3.exception">MathIllegalStateException</a></code> - if the distribution has not been loaded</dd></dl>
</li>
</ul>
<a name="getSampleStats()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSampleStats</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/commons/math3/stat/descriptive/StatisticalSummary.html" title="interface in org.apache.commons.math3.stat.descriptive">StatisticalSummary</a>&nbsp;getSampleStats()</pre>
<div class="block">Returns a <a href="../../../../../org/apache/commons/math3/stat/descriptive/StatisticalSummary.html" title="interface in org.apache.commons.math3.stat.descriptive"><code>StatisticalSummary</code></a> describing this distribution.
<strong>Preconditions:</strong><ul>
<li>the distribution must be loaded before invoking this method</li></ul></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the sample statistics</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if the distribution has not been loaded</dd></dl>
</li>
</ul>
<a name="getBinCount()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBinCount</h4>
<pre>public&nbsp;int&nbsp;getBinCount()</pre>
<div class="block">Returns the number of bins.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the number of bins.</dd></dl>
</li>
</ul>
<a name="getBinStats()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBinStats</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../org/apache/commons/math3/stat/descriptive/SummaryStatistics.html" title="class in org.apache.commons.math3.stat.descriptive">SummaryStatistics</a>&gt;&nbsp;getBinStats()</pre>
<div class="block">Returns a List of <a href="../../../../../org/apache/commons/math3/stat/descriptive/SummaryStatistics.html" title="class in org.apache.commons.math3.stat.descriptive"><code>SummaryStatistics</code></a> instances containing
statistics describing the values in each of the bins. The list is
indexed on the bin number.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>List of bin statistics.</dd></dl>
</li>
</ul>
<a name="getUpperBounds()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUpperBounds</h4>
<pre>public&nbsp;double[]&nbsp;getUpperBounds()</pre>
<div class="block"><p>Returns a fresh copy of the array of upper bounds for the bins.
Bins are: <br/>
[min,upperBounds[0]],(upperBounds[0],upperBounds[1]],...,
(upperBounds[binCount-2], upperBounds[binCount-1] = max].</p>
<p>Note: In versions 1.0-2.0 of commons-math, this method
incorrectly returned the array of probability generator upper
bounds now returned by <a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getGeneratorUpperBounds()"><code>getGeneratorUpperBounds()</code></a>.</p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>array of bin upper bounds</dd><dt><span class="strong">Since:</span></dt>
<dd>2.1</dd></dl>
</li>
</ul>
<a name="getGeneratorUpperBounds()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getGeneratorUpperBounds</h4>
<pre>public&nbsp;double[]&nbsp;getGeneratorUpperBounds()</pre>
<div class="block"><p>Returns a fresh copy of the array of upper bounds of the subintervals
of [0,1] used in generating data from the empirical distribution.
Subintervals correspond to bins with lengths proportional to bin counts.</p>
<strong>Preconditions:</strong><ul>
<li>the distribution must be loaded before invoking this method</li></ul>
<p>In versions 1.0-2.0 of commons-math, this array was (incorrectly) returned
by <a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getUpperBounds()"><code>getUpperBounds()</code></a>.</p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>array of upper bounds of subintervals used in data generation</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - unless a <code>load</code> method has been
called beforehand.</dd><dt><span class="strong">Since:</span></dt>
<dd>2.1</dd></dl>
</li>
</ul>
<a name="isLoaded()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isLoaded</h4>
<pre>public&nbsp;boolean&nbsp;isLoaded()</pre>
<div class="block">Property indicating whether or not the distribution has been loaded.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true if the distribution has been loaded</dd></dl>
</li>
</ul>
<a name="reSeed(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reSeed</h4>
<pre>public&nbsp;void&nbsp;reSeed(long&nbsp;seed)</pre>
<div class="block">Reseeds the random number generator used by <a href="../../../../../org/apache/commons/math3/random/EmpiricalDistribution.html#getNextValue()"><code>getNextValue()</code></a>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>seed</code> - random generator seed</dd><dt><span class="strong">Since:</span></dt>
<dd>3.0</dd></dl>
</li>
</ul>
<a name="probability(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>probability</h4>
<pre>public&nbsp;double&nbsp;probability(double&nbsp;x)</pre>
<div class="block">For a random variable <code>X</code> whose values are distributed according
to this distribution, this method returns <code>P(X = x)</code>. In other
words, this method represents the probability mass function (PMF)
for the distribution.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html#probability(double)">probability</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#probability(double)">probability</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html" title="class in org.apache.commons.math3.distribution">AbstractRealDistribution</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - the point at which the PMF is evaluated</dd>
<dt><span class="strong">Returns:</span></dt><dd>zero.</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="density(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>density</h4>
<pre>public&nbsp;double&nbsp;density(double&nbsp;x)</pre>
<div class="block">Returns the probability density function (PDF) of this distribution
evaluated at the specified point <code>x</code>. In general, the PDF is
the derivative of the <a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html#cumulativeProbability(double)"><code>CDF</code></a>.
If the derivative does not exist at <code>x</code>, then an appropriate
replacement should be returned, e.g. <code>Double.POSITIVE_INFINITY</code>,
<code>Double.NaN</code>, or the limit inferior or limit superior of the
difference quotient.
<p>Returns the kernel density normalized so that its integral over each bin
equals the bin mass.</p>
<p>Algorithm description: <ol>
<li>Find the bin B that x belongs to.</li>
<li>Compute K(B) = the mass of B with respect to the within-bin kernel (i.e., the
integral of the kernel density over B).</li>
<li>Return k(x) * P(B) / K(B), where k is the within-bin kernel density
and P(B) is the mass of B.</li></ol></p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - the point at which the PDF is evaluated</dd>
<dt><span class="strong">Returns:</span></dt><dd>the value of the probability density function at point <code>x</code></dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="cumulativeProbability(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cumulativeProbability</h4>
<pre>public&nbsp;double&nbsp;cumulativeProbability(double&nbsp;x)</pre>
<div class="block">For a random variable <code>X</code> whose values are distributed according
to this distribution, this method returns <code>P(X &lt;= x)</code>. In other
words, this method represents the (cumulative) distribution function
(CDF) for this distribution.
<p>Algorithm description:<ol>
<li>Find the bin B that x belongs to.</li>
<li>Compute P(B) = the mass of B and P(B-) = the combined mass of the bins below B.</li>
<li>Compute K(B) = the probability mass of B with respect to the within-bin kernel
and K(B-) = the kernel distribution evaluated at the lower endpoint of B</li>
<li>Return P(B-) + P(B) * [K(x) - K(B-)] / K(B) where
K(x) is the within-bin kernel distribution function evaluated at x.</li></ol></p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - the point at which the CDF is evaluated</dd>
<dt><span class="strong">Returns:</span></dt><dd>the probability that a random variable with this
distribution takes a value less than or equal to <code>x</code></dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="inverseCumulativeProbability(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>inverseCumulativeProbability</h4>
<pre>public&nbsp;double&nbsp;inverseCumulativeProbability(double&nbsp;p)
throws <a href="../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</a></pre>
<div class="block">Computes the quantile function of this distribution. For a random
variable <code>X</code> distributed according to this distribution, the
returned value is
<ul>
<li><code>inf{x in R | P(X<=x) >= p}</code> for <code>0 &lt; p &lt;= 1</code>,</li>
<li><code>inf{x in R | P(X<=x) > 0}</code> for <code>p = 0</code>.</li>
</ul>
The default implementation returns
<ul>
<li><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html#getSupportLowerBound()"><code>RealDistribution.getSupportLowerBound()</code></a> for <code>p = 0</code>,</li>
<li><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html#getSupportUpperBound()"><code>RealDistribution.getSupportUpperBound()</code></a> for <code>p = 1</code>.</li>
</ul>
<p>Algorithm description:<ol>
<li>Find the smallest i such that the sum of the masses of the bins
through i is at least p.</li>
<li>
Let K be the within-bin kernel distribution for bin i.</br>
Let K(B) be the mass of B under K. <br/>
Let K(B-) be K evaluated at the lower endpoint of B (the combined
mass of the bins below B under K).<br/>
Let P(B) be the probability of bin i.<br/>
Let P(B-) be the sum of the bin masses below bin i. <br/>
Let pCrit = p - P(B-)<br/>
<li>Return the inverse of K evaluated at <br/>
K(B-) + pCrit * K(B) / P(B) </li>
</ol></p></div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html#inverseCumulativeProbability(double)">inverseCumulativeProbability</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#inverseCumulativeProbability(double)">inverseCumulativeProbability</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html" title="class in org.apache.commons.math3.distribution">AbstractRealDistribution</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>p</code> - the cumulative probability</dd>
<dt><span class="strong">Returns:</span></dt><dd>the smallest <code>p</code>-quantile of this distribution
(largest 0-quantile for <code>p = 0</code>)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</a></code> - if <code>p &lt; 0</code> or <code>p &gt; 1</code></dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="getNumericalMean()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNumericalMean</h4>
<pre>public&nbsp;double&nbsp;getNumericalMean()</pre>
<div class="block">Use this method to get the numerical value of the mean of this
distribution.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the mean or <code>Double.NaN</code> if it is not defined</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="getNumericalVariance()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNumericalVariance</h4>
<pre>public&nbsp;double&nbsp;getNumericalVariance()</pre>
<div class="block">Use this method to get the numerical value of the variance of this
distribution.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the variance (possibly <code>Double.POSITIVE_INFINITY</code> as
for certain cases in <a href="../../../../../org/apache/commons/math3/distribution/TDistribution.html" title="class in org.apache.commons.math3.distribution"><code>TDistribution</code></a>) or <code>Double.NaN</code> if it
is not defined</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="getSupportLowerBound()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSupportLowerBound</h4>
<pre>public&nbsp;double&nbsp;getSupportLowerBound()</pre>
<div class="block">Access the lower bound of the support. This method must return the same
value as <code>inverseCumulativeProbability(0)</code>. In other words, this
method must return
<p><code>inf {x in R | P(X <= x) > 0}</code>.</p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>lower bound of the support (might be
<code>Double.NEGATIVE_INFINITY</code>)</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="getSupportUpperBound()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSupportUpperBound</h4>
<pre>public&nbsp;double&nbsp;getSupportUpperBound()</pre>
<div class="block">Access the upper bound of the support. This method must return the same
value as <code>inverseCumulativeProbability(1)</code>. In other words, this
method must return
<p><code>inf {x in R | P(X <= x) = 1}</code>.</p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>upper bound of the support (might be
<code>Double.POSITIVE_INFINITY</code>)</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="isSupportLowerBoundInclusive()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSupportLowerBoundInclusive</h4>
<pre>public&nbsp;boolean&nbsp;isSupportLowerBoundInclusive()</pre>
<div class="block">Whether or not the lower bound of support is in the domain of the density
function. Returns true iff <code>getSupporLowerBound()</code> is finite and
<code>density(getSupportLowerBound())</code> returns a non-NaN, non-infinite
value.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true if the lower bound of support is finite and the density
function returns a non-NaN, non-infinite value there</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="isSupportUpperBoundInclusive()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSupportUpperBoundInclusive</h4>
<pre>public&nbsp;boolean&nbsp;isSupportUpperBoundInclusive()</pre>
<div class="block">Whether or not the upper bound of support is in the domain of the density
function. Returns true iff <code>getSupportUpperBound()</code> is finite and
<code>density(getSupportUpperBound())</code> returns a non-NaN, non-infinite
value.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true if the upper bound of support is finite and the density
function returns a non-NaN, non-infinite value there</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="isSupportConnected()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSupportConnected</h4>
<pre>public&nbsp;boolean&nbsp;isSupportConnected()</pre>
<div class="block">Use this method to get information about whether the support is connected,
i.e. whether all values between the lower and upper bound of the support
are included in the support.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>whether the support is connected or not</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="sample()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sample</h4>
<pre>public&nbsp;double&nbsp;sample()</pre>
<div class="block">Generate a random value sampled from this distribution.
The default implementation uses the
<a href="http://en.wikipedia.org/wiki/Inverse_transform_sampling">
inversion method.
</a></div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html#sample()">sample</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#sample()">sample</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html" title="class in org.apache.commons.math3.distribution">AbstractRealDistribution</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>a random value.</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="reseedRandomGenerator(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reseedRandomGenerator</h4>
<pre>public&nbsp;void&nbsp;reseedRandomGenerator(long&nbsp;seed)</pre>
<div class="block">Reseed the random generator used to generate samples.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html#reseedRandomGenerator(long)">reseedRandomGenerator</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html#reseedRandomGenerator(long)">reseedRandomGenerator</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../org/apache/commons/math3/distribution/AbstractRealDistribution.html" title="class in org.apache.commons.math3.distribution">AbstractRealDistribution</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>seed</code> - the new seed</dd><dt><span class="strong">Since:</span></dt>
<dd>3.1</dd></dl>
</li>
</ul>
<a name="getKernel(org.apache.commons.math3.stat.descriptive.SummaryStatistics)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getKernel</h4>
<pre>protected&nbsp;<a href="../../../../../org/apache/commons/math3/distribution/RealDistribution.html" title="interface in org.apache.commons.math3.distribution">RealDistribution</a>&nbsp;getKernel(<a href="../../../../../org/apache/commons/math3/stat/descriptive/SummaryStatistics.html" title="class in org.apache.commons.math3.stat.descriptive">SummaryStatistics</a>&nbsp;bStats)</pre>
<div class="block">The within-bin smoothing kernel.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>bStats</code> - summary statistics for the bin</dd>
<dt><span class="strong">Returns:</span></dt><dd>within-bin kernel parameterized by bStats</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/EmpiricalDistribution.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/math3/random/CorrelatedRandomVectorGenerator.html" title="class in org.apache.commons.math3.random"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/math3/random/GaussianRandomGenerator.html" title="class in org.apache.commons.math3.random"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/math3/random/EmpiricalDistribution.html" target="_top">Frames</a></li>
<li><a href="EmpiricalDistribution.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2003&#x2013;2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>