2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
17
package org.apache.commons.math.distribution;
19
import org.apache.commons.math.MathException;
22
* Interface for discrete distributions of integer-valued random variables.
24
* @version $Revision: 617953 $ $Date: 2008-02-02 22:54:00 -0700 (Sat, 02 Feb 2008) $
26
public interface IntegerDistribution extends DiscreteDistribution {
28
* For a random variable X whose values are distributed according
29
* to this distribution, this method returns P(X = x). In other words, this
30
* method represents the probability mass function for the distribution.
32
* @param x the value at which the probability density function is evaluated.
33
* @return the value of the probability density function at x
35
double probability(int x);
38
* For a random variable X whose values are distributed according
39
* to this distribution, this method returns P(X ≤ x). In other words,
40
* this method represents the probability distribution function, or PDF
41
* for the distribution.
43
* @param x the value at which the PDF is evaluated.
44
* @return PDF for this distribution.
45
* @throws MathException if the cumulative probability can not be
46
* computed due to convergence or other numerical errors.
48
double cumulativeProbability(int x) throws MathException;
51
* For this distribution, X, this method returns P(x0 ≤ X ≤ x1).
52
* @param x0 the inclusive, lower bound
53
* @param x1 the inclusive, upper bound
54
* @return the cumulative probability.
55
* @throws MathException if the cumulative probability can not be
56
* computed due to convergence or other numerical errors.
57
* @throws IllegalArgumentException if x0 > x1
59
double cumulativeProbability(int x0, int x1) throws MathException;
62
* For this distribution, X, this method returns the largest x such that
65
* Note that this definition implies: <ul>
66
* <li> If there is a minimum value, <code>m</code>, with postive
67
* probablility under (the density of) X, then <code>m - 1</code> is
68
* returned by <code>inverseCumulativeProbability(0).</code> If there is
69
* no such value <code>m, Integer.MIN_VALUE</code> is
71
* <li> If there is a maximum value, <code>M</code>, such that
72
* P(X ≤ M) =1, then <code>M</code> is returned by
73
* <code>inverseCumulativeProbability(1).</code>
74
* If there is no such value, <code>M, Integer.MAX_VALUE</code> is
75
* returned.</li></ul></p>
77
* @param p the cumulative probability.
78
* @return the largest x such that P(X ≤ x) <= p
79
* @throws MathException if the inverse cumulative probability can not be
80
* computed due to convergence or other numerical errors.
81
* @throws IllegalArgumentException if p is not between 0 and 1 (inclusive)
83
int inverseCumulativeProbability(double p) throws MathException;