comparison libs/commons-math-2.1/docs/userguide/distribution.html @ 10:5f2c5fb36e93

commons-math-2.1 added
author dwinter
date Tue, 04 Jan 2011 10:00:53 +0100
parents
children
comparison
equal deleted inserted replaced
9:e63a64652f4d 10:5f2c5fb36e93
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
3
4
5
6
7
8
9
10
11
12
13 <html xmlns="http://www.w3.org/1999/xhtml">
14 <head>
15 <title>Math - The Commons Math User Guide - Statistics</title>
16 <style type="text/css" media="all">
17 @import url("../css/maven-base.css");
18 @import url("../css/maven-theme.css");
19 @import url("../css/site.css");
20 </style>
21 <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
22 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
23 </head>
24 <body class="composite">
25 <div id="banner">
26 <span id="bannerLeft">
27
28 Commons Math User Guide
29
30 </span>
31 <div class="clear">
32 <hr/>
33 </div>
34 </div>
35 <div id="breadcrumbs">
36
37
38
39
40
41
42
43
44 <div class="xright">
45
46
47
48
49
50
51
52 </div>
53 <div class="clear">
54 <hr/>
55 </div>
56 </div>
57 <div id="leftColumn">
58 <div id="navcolumn">
59
60
61
62
63
64
65
66
67 <h5>User Guide</h5>
68 <ul>
69
70 <li class="none">
71 <a href="../userguide/index.html">Contents</a>
72 </li>
73
74 <li class="none">
75 <a href="../userguide/overview.html">Overview</a>
76 </li>
77
78 <li class="none">
79 <a href="../userguide/stat.html">Statistics</a>
80 </li>
81
82 <li class="none">
83 <a href="../userguide/random.html">Data Generation</a>
84 </li>
85
86 <li class="none">
87 <a href="../userguide/linear.html">Linear Algebra</a>
88 </li>
89
90 <li class="none">
91 <a href="../userguide/analysis.html">Numerical Analysis</a>
92 </li>
93
94 <li class="none">
95 <a href="../userguide/special.html">Special Functions</a>
96 </li>
97
98 <li class="none">
99 <a href="../userguide/utilities.html">Utilities</a>
100 </li>
101
102 <li class="none">
103 <a href="../userguide/complex.html">Complex Numbers</a>
104 </li>
105
106 <li class="none">
107 <strong>Distributions</strong>
108 </li>
109
110 <li class="none">
111 <a href="../userguide/fraction.html">Fractions</a>
112 </li>
113
114 <li class="none">
115 <a href="../userguide/transform.html">Transform Methods</a>
116 </li>
117
118 <li class="none">
119 <a href="../userguide/geometry.html">3D Geometry</a>
120 </li>
121
122 <li class="none">
123 <a href="../userguide/optimization.html">Optimization</a>
124 </li>
125
126 <li class="none">
127 <a href="../userguide/ode.html">Ordinary Differential Equations</a>
128 </li>
129
130 <li class="none">
131 <a href="../userguide/genetics.html">Genetic Algorithms</a>
132 </li>
133 </ul>
134 <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
135 <img alt="Built by Maven" src="../images/logos/maven-feather.png"></img>
136 </a>
137
138
139
140
141
142
143
144
145 </div>
146 </div>
147 <div id="bodyColumn">
148 <div id="contentBox">
149 <div class="section"><h2><a name="a8_Probability_Distributions"></a>8 Probability Distributions</h2>
150 <div class="section"><h3><a name="a8.1_Overview"></a>8.1 Overview</h3>
151 <p>
152 The distributions package provide a framework for some commonly used
153 probability distributions.
154 </p>
155 </div>
156 <div class="section"><h3><a name="a8.2_Distribution_Framework"></a>8.2 Distribution Framework</h3>
157 <p>
158 The distribution framework provides the means to compute probability density
159 function (PDF) probabilities and cumulative distribution function (CDF)
160 probabilities for common probability distributions. Along with the direct
161 computation of PDF and CDF probabilities, the framework also allows for the
162 computation of inverse PDF and inverse CDF values.
163 </p>
164 <p>
165 Using a distribution object, PDF and CDF probabilities are easily computed
166 using the <code>cumulativeProbability</code> methods. For a distribution <code>X</code>,
167 and a domain value, <code>x</code>, <code>cumulativeProbability</code> computes
168 <code>P(X &lt;= x)</code> (i.e. the lower tail probability of <code>X</code>).
169 </p>
170 <div class="source"><pre>TDistribution t = new TDistributionImpl(29);
171 double lowerTail = t.cumulativeProbability(-2.656); // P(T &lt;= -2.656)
172 double upperTail = 1.0 - t.cumulativeProbability(2.75); // P(T &gt;= 2.75)</pre>
173 </div>
174 <p>
175 The inverse PDF and CDF values are just as easily computed using the
176 <code>inverseCumulativeProbability</code> methods. For a distribution <code>X</code>,
177 and a probability, <code>p</code>, <code>inverseCumulativeProbability</code>
178 computes the domain value <code>x</code>, such that:
179 <ul><li><code>P(X &lt;= x) = p</code>, for continuous distributions</li>
180 <li><code>P(X &lt;= x) &lt;= p</code>, for discrete distributions</li>
181 </ul>
182
183 Notice the different cases for continuous and discrete distributions. This is the result
184 of PDFs not being invertible functions. As such, for discrete distributions, an exact
185 domain value can not be returned. Only the &quot;best&quot; domain value. For Commons-Math, the &quot;best&quot;
186 domain value is determined by the largest domain value whose cumulative probability is
187 less-than or equal to the given probability.
188 </p>
189 </div>
190 <div class="section"><h3><a name="a8.3_User_Defined_Distributions"></a>8.3 User Defined Distributions</h3>
191 <p>
192 Since there are numerous distributions and Commons-Math only directly supports a handful,
193 it may be necessary to extend the distribution framework to satisfy individual needs. It
194 is recommended that the <code>Distribution</code>, <code>ContinuousDistribution</code>,
195 <code>DiscreteDistribution</code>, and <code>IntegerDistribution</code> interfaces serve as
196 base types for any extension. These serve as the basis for all the distributions directly
197 supported by Commons-Math and using those interfaces for implementation purposes will
198 insure any extension is compatible with the remainder of Commons-Math. To aid in
199 implementing a distribution extension, the <code>AbstractDistribution</code>,
200 <code>AbstractContinuousDistribution</code>, and <code>AbstractIntegerDistribution</code>
201 provide implementation building blocks and offer a lot of default distribution
202 functionality. By extending these abstract classes directly, a good portion of the
203 repetitive distribution implementation is already developed and should save time and effort
204 in developing user defined distributions.
205 </p>
206 </div>
207 </div>
208
209 </div>
210 </div>
211 <div class="clear">
212 <hr/>
213 </div>
214 <div id="footer">
215 <div class="xright">&#169;
216 2003-2010
217
218
219
220
221
222
223
224
225
226 </div>
227 <div class="clear">
228 <hr/>
229 </div>
230 </div>
231 </body>
232 </html>