]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/doc/html/math_toolkit/dist_ref/dists/f_dist.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / dist_ref / dists / f_dist.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>F Distribution</title>
5 <link rel="stylesheet" href="../../../math.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
7 <link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
8 <link rel="up" href="../dists.html" title="Distributions">
9 <link rel="prev" href="extreme_dist.html" title="Extreme Value Distribution">
10 <link rel="next" href="gamma_dist.html" title="Gamma (and Erlang) Distribution">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="extreme_dist.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="gamma_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="math_toolkit.dist_ref.dists.f_dist"></a><a class="link" href="f_dist.html" title="F Distribution">F Distribution</a>
28 </h4></div></div></div>
29 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">distributions</span><span class="special">/</span><span class="identifier">fisher_f</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></pre>
30 <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span>
31
32 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RealType</span> <span class="special">=</span> <span class="keyword">double</span><span class="special">,</span>
33 <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> <span class="special">=</span> <a class="link" href="../../pol_ref/pol_ref_ref.html" title="Policy Class Reference">policies::policy&lt;&gt;</a> <span class="special">&gt;</span>
34 <span class="keyword">class</span> <span class="identifier">fisher_f_distribution</span><span class="special">;</span>
35
36 <span class="keyword">typedef</span> <span class="identifier">fisher_f_distribution</span><span class="special">&lt;&gt;</span> <span class="identifier">fisher_f</span><span class="special">;</span>
37
38 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
39 <span class="keyword">class</span> <span class="identifier">fisher_f_distribution</span>
40 <span class="special">{</span>
41 <span class="keyword">public</span><span class="special">:</span>
42 <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span>
43
44 <span class="comment">// Construct:</span>
45 <span class="identifier">fisher_f_distribution</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&amp;</span> <span class="identifier">i</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&amp;</span> <span class="identifier">j</span><span class="special">);</span>
46
47 <span class="comment">// Accessors:</span>
48 <span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom1</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
49 <span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom2</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
50 <span class="special">};</span>
51
52 <span class="special">}}</span> <span class="comment">//namespaces</span>
53 </pre>
54 <p>
55 The F distribution is a continuous distribution that arises when testing
56 whether two samples have the same variance. If &#967;<sup>2</sup><sub>m</sub> &#160; and &#967;<sup>2</sup><sub>n</sub> &#160; are independent
57 variates each distributed as Chi-Squared with <span class="emphasis"><em>m</em></span> and
58 <span class="emphasis"><em>n</em></span> degrees of freedom, then the test statistic:
59 </p>
60 <p>
61 F<sub>n,m</sub> &#160; = (&#967;<sup>2</sup><sub>n</sub> &#160; / n) / (&#967;<sup>2</sup><sub>m</sub> &#160; / m)
62 </p>
63 <p>
64 Is distributed over the range [0, &#8734;] with an F distribution, and has the
65 PDF:
66 </p>
67 <p>
68 <span class="inlinemediaobject"><img src="../../../../equations/fisher_pdf.svg"></span>
69 </p>
70 <p>
71 The following graph illustrates how the PDF varies depending on the two
72 degrees of freedom parameters.
73 </p>
74 <p>
75 <span class="inlinemediaobject"><img src="../../../../graphs/fisher_f_pdf.svg" align="middle"></span>
76 </p>
77 <h5>
78 <a name="math_toolkit.dist_ref.dists.f_dist.h0"></a>
79 <span class="phrase"><a name="math_toolkit.dist_ref.dists.f_dist.member_functions"></a></span><a class="link" href="f_dist.html#math_toolkit.dist_ref.dists.f_dist.member_functions">Member Functions</a>
80 </h5>
81 <pre class="programlisting"><span class="identifier">fisher_f_distribution</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&amp;</span> <span class="identifier">df1</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&amp;</span> <span class="identifier">df2</span><span class="special">);</span>
82 </pre>
83 <p>
84 Constructs an F-distribution with numerator degrees of freedom <span class="emphasis"><em>df1</em></span>
85 and denominator degrees of freedom <span class="emphasis"><em>df2</em></span>.
86 </p>
87 <p>
88 Requires that <span class="emphasis"><em>df1</em></span> and <span class="emphasis"><em>df2</em></span> are
89 both greater than zero, otherwise <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
90 is called.
91 </p>
92 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom1</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
93 </pre>
94 <p>
95 Returns the numerator degrees of freedom parameter of the distribution.
96 </p>
97 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom2</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
98 </pre>
99 <p>
100 Returns the denominator degrees of freedom parameter of the distribution.
101 </p>
102 <h5>
103 <a name="math_toolkit.dist_ref.dists.f_dist.h1"></a>
104 <span class="phrase"><a name="math_toolkit.dist_ref.dists.f_dist.non_member_accessors"></a></span><a class="link" href="f_dist.html#math_toolkit.dist_ref.dists.f_dist.non_member_accessors">Non-member
105 Accessors</a>
106 </h5>
107 <p>
108 All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
109 functions</a> that are generic to all distributions are supported:
110 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
111 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
112 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard Function</a>,
113 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mean">mean</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.median">median</a>,
114 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.variance">variance</a>,
115 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
116 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess</a>,
117 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.range">range</a> and <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.support">support</a>.
118 </p>
119 <p>
120 The domain of the random variable is [0, +&#8734;].
121 </p>
122 <h5>
123 <a name="math_toolkit.dist_ref.dists.f_dist.h2"></a>
124 <span class="phrase"><a name="math_toolkit.dist_ref.dists.f_dist.examples"></a></span><a class="link" href="f_dist.html#math_toolkit.dist_ref.dists.f_dist.examples">Examples</a>
125 </h5>
126 <p>
127 Various <a class="link" href="../../stat_tut/weg/f_eg.html" title="F Distribution Examples">worked examples</a>
128 are available illustrating the use of the F Distribution.
129 </p>
130 <h5>
131 <a name="math_toolkit.dist_ref.dists.f_dist.h3"></a>
132 <span class="phrase"><a name="math_toolkit.dist_ref.dists.f_dist.accuracy"></a></span><a class="link" href="f_dist.html#math_toolkit.dist_ref.dists.f_dist.accuracy">Accuracy</a>
133 </h5>
134 <p>
135 The normal distribution is implemented in terms of the <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">incomplete
136 beta function</a> and its <a class="link" href="../../sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">inverses</a>,
137 refer to those functions for accuracy data.
138 </p>
139 <h5>
140 <a name="math_toolkit.dist_ref.dists.f_dist.h4"></a>
141 <span class="phrase"><a name="math_toolkit.dist_ref.dists.f_dist.implementation"></a></span><a class="link" href="f_dist.html#math_toolkit.dist_ref.dists.f_dist.implementation">Implementation</a>
142 </h5>
143 <p>
144 In the following table <span class="emphasis"><em>v1</em></span> and <span class="emphasis"><em>v2</em></span>
145 are the first and second degrees of freedom parameters of the distribution,
146 <span class="emphasis"><em>x</em></span> is the random variate, <span class="emphasis"><em>p</em></span> is
147 the probability, and <span class="emphasis"><em>q = 1-p</em></span>.
148 </p>
149 <div class="informaltable"><table class="table">
150 <colgroup>
151 <col>
152 <col>
153 </colgroup>
154 <thead><tr>
155 <th>
156 <p>
157 Function
158 </p>
159 </th>
160 <th>
161 <p>
162 Implementation Notes
163 </p>
164 </th>
165 </tr></thead>
166 <tbody>
167 <tr>
168 <td>
169 <p>
170 pdf
171 </p>
172 </td>
173 <td>
174 <p>
175 The usual form of the PDF is given by:
176 </p>
177 <p>
178 <span class="inlinemediaobject"><img src="../../../../equations/fisher_pdf.svg"></span>
179 </p>
180 <p>
181 However, that form is hard to evaluate directly without incurring
182 problems with either accuracy or numeric overflow.
183 </p>
184 <p>
185 Direct differentiation of the CDF expressed in terms of the incomplete
186 beta function
187 </p>
188 <p>
189 led to the following two formulas:
190 </p>
191 <p>
192 f<sub>v1,v2</sub>(x) = y * <a class="link" href="../../sf_beta/beta_derivative.html" title="Derivative of the Incomplete Beta Function">ibeta_derivative</a>(v2
193 / 2, v1 / 2, v2 / (v2 + v1 * x))
194 </p>
195 <p>
196 with y = (v2 * v1) / ((v2 + v1 * x) * (v2 + v1 * x))
197 </p>
198 <p>
199 and
200 </p>
201 <p>
202 f<sub>v1,v2</sub>(x) = y * <a class="link" href="../../sf_beta/beta_derivative.html" title="Derivative of the Incomplete Beta Function">ibeta_derivative</a>(v1
203 / 2, v2 / 2, v1 * x / (v2 + v1 * x))
204 </p>
205 <p>
206 with y = (z * v1 - x * v1 * v1) / z<sup>2</sup>
207 </p>
208 <p>
209 and z = v2 + v1 * x
210 </p>
211 <p>
212 The first of these is used for v1 * x &gt; v2, otherwise the
213 second is used.
214 </p>
215 <p>
216 The aim is to keep the <span class="emphasis"><em>x</em></span> argument to <a class="link" href="../../sf_beta/beta_derivative.html" title="Derivative of the Incomplete Beta Function">ibeta_derivative</a>
217 away from 1 to avoid rounding error.
218 </p>
219 </td>
220 </tr>
221 <tr>
222 <td>
223 <p>
224 cdf
225 </p>
226 </td>
227 <td>
228 <p>
229 Using the relations:
230 </p>
231 <p>
232 p = <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibeta</a>(v1
233 / 2, v2 / 2, v1 * x / (v2 + v1 * x))
234 </p>
235 <p>
236 and
237 </p>
238 <p>
239 p = <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibetac</a>(v2
240 / 2, v1 / 2, v2 / (v2 + v1 * x))
241 </p>
242 <p>
243 The first is used for v1 * x &gt; v2, otherwise the second is
244 used.
245 </p>
246 <p>
247 The aim is to keep the <span class="emphasis"><em>x</em></span> argument to <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibeta</a> well
248 away from 1 to avoid rounding error.
249 </p>
250 </td>
251 </tr>
252 <tr>
253 <td>
254 <p>
255 cdf complement
256 </p>
257 </td>
258 <td>
259 <p>
260 Using the relations:
261 </p>
262 <p>
263 p = <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibetac</a>(v1
264 / 2, v2 / 2, v1 * x / (v2 + v1 * x))
265 </p>
266 <p>
267 and
268 </p>
269 <p>
270 p = <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibeta</a>(v2
271 / 2, v1 / 2, v2 / (v2 + v1 * x))
272 </p>
273 <p>
274 The first is used for v1 * x &lt; v2, otherwise the second is
275 used.
276 </p>
277 <p>
278 The aim is to keep the <span class="emphasis"><em>x</em></span> argument to <a class="link" href="../../sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibeta</a> well
279 away from 1 to avoid rounding error.
280 </p>
281 </td>
282 </tr>
283 <tr>
284 <td>
285 <p>
286 quantile
287 </p>
288 </td>
289 <td>
290 <p>
291 Using the relation:
292 </p>
293 <p>
294 x = v2 * a / (v1 * b)
295 </p>
296 <p>
297 where:
298 </p>
299 <p>
300 a = <a class="link" href="../../sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibeta_inv</a>(v1
301 / 2, v2 / 2, p)
302 </p>
303 <p>
304 and
305 </p>
306 <p>
307 b = 1 - a
308 </p>
309 <p>
310 Quantities <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span>
311 are both computed by <a class="link" href="../../sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibeta_inv</a>
312 without the subtraction implied above.
313 </p>
314 </td>
315 </tr>
316 <tr>
317 <td>
318 <p>
319 quantile
320 </p>
321 <p>
322 from the complement
323 </p>
324 </td>
325 <td>
326 <p>
327 Using the relation:
328 </p>
329 <p>
330 x = v2 * a / (v1 * b)
331 </p>
332 <p>
333 where
334 </p>
335 <p>
336 a = <a class="link" href="../../sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibetac_inv</a>(v1
337 / 2, v2 / 2, p)
338 </p>
339 <p>
340 and
341 </p>
342 <p>
343 b = 1 - a
344 </p>
345 <p>
346 Quantities <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span>
347 are both computed by <a class="link" href="../../sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibetac_inv</a>
348 without the subtraction implied above.
349 </p>
350 </td>
351 </tr>
352 <tr>
353 <td>
354 <p>
355 mean
356 </p>
357 </td>
358 <td>
359 <p>
360 v2 / (v2 - 2)
361 </p>
362 </td>
363 </tr>
364 <tr>
365 <td>
366 <p>
367 variance
368 </p>
369 </td>
370 <td>
371 <p>
372 2 * v2<sup>2 </sup> * (v1 + v2 - 2) / (v1 * (v2 - 2) * (v2 - 2) * (v2 - 4))
373 </p>
374 </td>
375 </tr>
376 <tr>
377 <td>
378 <p>
379 mode
380 </p>
381 </td>
382 <td>
383 <p>
384 v2 * (v1 - 2) / (v1 * (v2 + 2))
385 </p>
386 </td>
387 </tr>
388 <tr>
389 <td>
390 <p>
391 skewness
392 </p>
393 </td>
394 <td>
395 <p>
396 2 * (v2 + 2 * v1 - 2) * sqrt((2 * v2 - 8) / (v1 * (v2 + v1 -
397 2))) / (v2 - 6)
398 </p>
399 </td>
400 </tr>
401 <tr>
402 <td>
403 <p>
404 kurtosis and kurtosis excess
405 </p>
406 </td>
407 <td>
408 <p>
409 Refer to, <a href="http://mathworld.wolfram.com/F-Distribution.html" target="_top">Weisstein,
410 Eric W. "F-Distribution." From MathWorld--A Wolfram
411 Web Resource.</a>
412 </p>
413 </td>
414 </tr>
415 </tbody>
416 </table></div>
417 </div>
418 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
419 <td align="left"></td>
420 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
421 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
422 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
423 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
424 Distributed under the Boost Software License, Version 1.0. (See accompanying
425 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
426 </p>
427 </div></td>
428 </tr></table>
429 <hr>
430 <div class="spirit-nav">
431 <a accesskey="p" href="extreme_dist.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="gamma_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
432 </div>
433 </body>
434 </html>