3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Non-Member Properties</title>
5 <link rel="stylesheet" href="../../math.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Math Toolkit 2.11.0">
8 <link rel="up" href="../dist_ref.html" title="Statistical Distributions Reference">
9 <link rel="prev" href="../dist_ref.html" title="Statistical Distributions Reference">
10 <link rel="next" href="dists.html" title="Distributions">
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>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../dist_ref.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dist_ref.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="dists.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="math_toolkit.dist_ref.nmp"></a><a class="link" href="nmp.html" title="Non-Member Properties">Non-Member Properties</a>
28 </h3></div></div></div>
30 Properties that are common to all distributions are accessed via non-member
31 getter functions: non-membership allows more of these functions to be added
32 over time, as the need arises. Unfortunately the literature uses many different
33 and confusing names to refer to a rather small number of actual concepts;
34 refer to the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.concept_index">concept
35 index</a> to find the property you want by the name you are most familiar
36 with. Or use the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.function_index">function
37 index</a> to go straight to the function you want if you already know
41 <a name="math_toolkit.dist_ref.nmp.h0"></a>
42 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.function_index"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.function_index">Function
45 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
47 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution
51 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.ccdf">Complement of the Cumulative
52 Distribution Function</a>.
55 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard Function</a>.
58 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>.
61 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis</a>.
64 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess</a>
67 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.mean">mean</a>.
70 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.median">median</a>.
73 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>.
76 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>.
79 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.range">range</a>.
82 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>.
85 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile_c">Quantile from the
86 complement of the probability</a>.
89 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness</a>.
92 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>.
95 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.support">support</a>.
98 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.variance">variance</a>.
102 <a name="math_toolkit.dist_ref.nmp.h1"></a>
103 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.concept_index"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.concept_index">Conceptual
106 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
107 <li class="listitem">
108 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.ccdf">Complement of the Cumulative
109 Distribution Function</a>.
111 <li class="listitem">
112 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution
115 <li class="listitem">
116 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard Function</a>.
118 <li class="listitem">
119 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf_inv">Inverse Cumulative
120 Distribution Function</a>.
122 <li class="listitem">
123 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.survival_inv">Inverse Survival
126 <li class="listitem">
127 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>
129 <li class="listitem">
130 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.lower_critical">Lower Critical
133 <li class="listitem">
134 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis</a>.
136 <li class="listitem">
137 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess</a>
139 <li class="listitem">
140 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.mean">mean</a>.
142 <li class="listitem">
143 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.median">median</a>.
145 <li class="listitem">
146 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>.
148 <li class="listitem">
149 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdfPQ">P</a>.
151 <li class="listitem">
152 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.percent">Percent Point Function</a>.
154 <li class="listitem">
155 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>.
157 <li class="listitem">
158 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pmf">Probability Mass Function</a>.
160 <li class="listitem">
161 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.range">range</a>.
163 <li class="listitem">
164 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdfPQ">Q</a>.
166 <li class="listitem">
167 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>.
169 <li class="listitem">
170 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile_c">Quantile from the
171 complement of the probability</a>.
173 <li class="listitem">
174 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness</a>.
176 <li class="listitem">
177 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>
179 <li class="listitem">
180 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.survival">Survival Function</a>.
182 <li class="listitem">
183 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.support">support</a>.
185 <li class="listitem">
186 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.upper_critical">Upper Critical
189 <li class="listitem">
190 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.variance">variance</a>.
194 <a name="math_toolkit.dist_ref.nmp.h2"></a>
195 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.cdf"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative
196 Distribution Function</a>
198 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
199 <span class="identifier">RealType</span> <span class="identifier">cdf</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&</span> <span class="identifier">x</span><span class="special">);</span>
202 The <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution
203 Function</a> is the probability that the variable takes a value less than
204 or equal to x. It is equivalent to the integral from -infinity to x of the
205 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>.
208 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
209 if the random variable is outside the defined range for the distribution.
212 For example, the following graph shows the cdf for the normal distribution:
215 <span class="inlinemediaobject"><img src="../../../graphs/cdf.png"></span>
218 <a name="math_toolkit.dist_ref.nmp.h3"></a>
219 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.ccdf"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.ccdf">Complement
220 of the Cumulative Distribution Function</a>
222 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Distribution</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">></span>
223 <span class="identifier">RealType</span> <span class="identifier">cdf</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Unspecified-Complement-Type</em></span><span class="special"><</span><span class="identifier">Distribution</span><span class="special">,</span> <span class="identifier">RealType</span><span class="special">>&</span> <span class="identifier">comp</span><span class="special">);</span>
226 The complement of the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative
227 Distribution Function</a> is the probability that the variable takes a
228 value greater than x. It is equivalent to the integral from x to infinity
229 of the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density
230 Function</a>, or 1 minus the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative
231 Distribution Function</a> of x.
234 This is also known as the survival function.
237 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
238 if the random variable is outside the defined range for the distribution.
241 In this library, it is obtained by wrapping the arguments to the <code class="computeroutput"><span class="identifier">cdf</span></code> function in a call to <code class="computeroutput"><span class="identifier">complement</span></code>, for example:
243 <pre class="programlisting"><span class="comment">// standard normal distribution object:</span>
244 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">normal</span> <span class="identifier">norm</span><span class="special">;</span>
245 <span class="comment">// print survival function for x=2.0:</span>
246 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">cdf</span><span class="special">(</span><span class="identifier">complement</span><span class="special">(</span><span class="identifier">norm</span><span class="special">,</span> <span class="number">2.0</span><span class="special">))</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
249 For example, the following graph shows the __complement of the cdf for the
253 <span class="inlinemediaobject"><img src="../../../graphs/survival.png"></span>
256 See <a class="link" href="../stat_tut/overview/complements.html#why_complements">why complements?</a> for why the complement
257 is useful and when it should be used.
260 <a name="math_toolkit.dist_ref.nmp.h4"></a>
261 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.hazard"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard
264 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
265 <span class="identifier">RealType</span> <span class="identifier">hazard</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&</span> <span class="identifier">x</span><span class="special">);</span>
268 Returns the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>
269 of <span class="emphasis"><em>x</em></span> and distibution <span class="emphasis"><em>dist</em></span>.
272 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
273 if the random variable is outside the defined range for the distribution.
275 <div class="blockquote"><blockquote class="blockquote"><p>
276 <span class="inlinemediaobject"><img src="../../../equations/hazard.svg"></span>
278 </p></blockquote></div>
279 <div class="caution"><table border="0" summary="Caution">
281 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td>
282 <th align="left">Caution</th>
284 <tr><td align="left" valign="top"><p>
285 Some authors refer to this as the conditional failure density function
286 rather than the hazard function.
290 <a name="math_toolkit.dist_ref.nmp.h5"></a>
291 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.chf"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative
294 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
295 <span class="identifier">RealType</span> <span class="identifier">chf</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&</span> <span class="identifier">x</span><span class="special">);</span>
298 Returns the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard
299 Function</a> of <span class="emphasis"><em>x</em></span> and distibution <span class="emphasis"><em>dist</em></span>.
302 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
303 if the random variable is outside the defined range for the distribution.
305 <div class="blockquote"><blockquote class="blockquote"><p>
306 <span class="inlinemediaobject"><img src="../../../equations/chf.svg"></span>
308 </p></blockquote></div>
309 <div class="caution"><table border="0" summary="Caution">
311 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td>
312 <th align="left">Caution</th>
314 <tr><td align="left" valign="top"><p>
315 Some authors refer to this as simply the "Hazard Function".
319 <a name="math_toolkit.dist_ref.nmp.h6"></a>
320 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.mean"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.mean">mean</a>
322 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
323 <span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
326 Returns the mean of the distribution <span class="emphasis"><em>dist</em></span>.
329 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
330 if the distribution does not have a defined mean (for example the Cauchy
334 <a name="math_toolkit.dist_ref.nmp.h7"></a>
335 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.median"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.median">median</a>
337 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
338 <span class="identifier">RealType</span> <span class="identifier">median</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
341 Returns the median of the distribution <span class="emphasis"><em>dist</em></span>.
344 <a name="math_toolkit.dist_ref.nmp.h8"></a>
345 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.mode"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>
347 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
348 <span class="identifier">RealType</span> <span class="identifier">mode</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
351 Returns the mode of the distribution <span class="emphasis"><em>dist</em></span>.
354 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
355 if the distribution does not have a defined mode.
358 <a name="math_toolkit.dist_ref.nmp.h9"></a>
359 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.pdf"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability
362 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
363 <span class="identifier">RealType</span> <span class="identifier">pdf</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&</span> <span class="identifier">x</span><span class="special">);</span>
366 For a continuous function, the probability density function (pdf) returns
367 the probability that the variate has the value x. Since for continuous distributions
368 the probability at a single point is actually zero, the probability is better
369 expressed as the integral of the pdf between two points: see the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative
370 Distribution Function</a>.
373 For a discrete distribution, the pdf is the probability that the variate
377 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
378 if the random variable is outside the defined range for the distribution.
381 For example, for a standard normal distribution the pdf looks like this:
384 <span class="inlinemediaobject"><img src="../../../graphs/pdf.png"></span>
387 <a name="math_toolkit.dist_ref.nmp.h10"></a>
388 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.range"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.range">Range</a>
390 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
391 <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">RealType</span><span class="special">></span> <span class="identifier">range</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
394 Returns the valid range of the random variable over distribution <span class="emphasis"><em>dist</em></span>.
397 <a name="math_toolkit.dist_ref.nmp.h11"></a>
398 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.quantile"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>
400 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
401 <span class="identifier">RealType</span> <span class="identifier">quantile</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RealType</span><span class="special">&</span> <span class="identifier">p</span><span class="special">);</span>
404 The quantile is best viewed as the inverse of the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative
405 Distribution Function</a>, it returns a value <span class="emphasis"><em>x</em></span> such
406 that <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">dist</span><span class="special">,</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">==</span>
407 <span class="identifier">p</span></code>.
410 This is also known as the <span class="emphasis"><em>percent point function</em></span>, or
411 <span class="emphasis"><em>percentile</em></span>, or <span class="emphasis"><em>fractile</em></span>, it is
412 also the same as calculating the <span class="emphasis"><em>lower critical value</em></span>
416 This function returns a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
417 if the probability lies outside [0,1]. The function may return an <a class="link" href="../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>
418 if there is no finite value that has the specified probability.
421 The following graph shows the quantile function for a standard normal distribution:
424 <span class="inlinemediaobject"><img src="../../../graphs/quantile.png"></span>
427 <a name="math_toolkit.dist_ref.nmp.h12"></a>
428 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.quantile_c"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile_c">Quantile
429 from the complement of the probability.</a>
432 See also <a class="link" href="../stat_tut/overview/complements.html" title="Complements are supported too - and when to use them">complements</a>.
434 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Distribution</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">></span>
435 <span class="identifier">RealType</span> <span class="identifier">quantile</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Unspecified-Complement-Type</em></span><span class="special"><</span><span class="identifier">Distribution</span><span class="special">,</span> <span class="identifier">RealType</span><span class="special">>&</span> <span class="identifier">comp</span><span class="special">);</span>
438 This is the inverse of the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.ccdf">Complement
439 of the Cumulative Distribution Function</a>. It is calculated by wrapping
440 the arguments in a call to the quantile function in a call to <span class="emphasis"><em>complement</em></span>.
443 <pre class="programlisting"><span class="comment">// define a standard normal distribution:</span>
444 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">normal</span> <span class="identifier">norm</span><span class="special">;</span>
445 <span class="comment">// print the value of x for which the complement</span>
446 <span class="comment">// of the probability is 0.05:</span>
447 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">quantile</span><span class="special">(</span><span class="identifier">complement</span><span class="special">(</span><span class="identifier">norm</span><span class="special">,</span> <span class="number">0.05</span><span class="special">))</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
450 The function computes a value <span class="emphasis"><em>x</em></span> such that <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">complement</span><span class="special">(</span><span class="identifier">dist</span><span class="special">,</span>
451 <span class="identifier">x</span><span class="special">))</span> <span class="special">==</span> <span class="identifier">q</span></code> where
452 <span class="emphasis"><em>q</em></span> is complement of the probability.
455 <a class="link" href="../stat_tut/overview/complements.html#why_complements">Why complements?</a>
458 This function is also called the inverse survival function, and is the same
459 as calculating the <span class="emphasis"><em>upper critical value</em></span> of a distribution.
462 This function returns a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
463 if the probablity lies outside [0,1]. The function may return an <a class="link" href="../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>
464 if there is no finite value that has the specified probability.
467 The following graph show the inverse survival function for the normal distribution:
470 <span class="inlinemediaobject"><img src="../../../graphs/survival_inv.png"></span>
473 <a name="math_toolkit.dist_ref.nmp.h13"></a>
474 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.sd"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.sd">Standard
477 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
478 <span class="identifier">RealType</span> <span class="identifier">standard_deviation</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
481 Returns the standard deviation of distribution <span class="emphasis"><em>dist</em></span>.
484 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
485 if the distribution does not have a defined standard deviation.
488 <a name="math_toolkit.dist_ref.nmp.h14"></a>
489 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.support"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.support">support</a>
491 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
492 <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">RealType</span><span class="special">></span> <span class="identifier">support</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
495 Returns the supported range of random variable over the distribution <span class="emphasis"><em>dist</em></span>.
498 The distribution is said to be 'supported' over a range that is <a href="http://en.wikipedia.org/wiki/Probability_distribution" target="_top">"the
499 smallest closed set whose complement has probability zero"</a>.
500 Non-mathematicians might say it means the 'interesting' smallest range of
501 random variate x that has the cdf going from zero to unity. Outside are uninteresting
502 zones where the pdf is zero, and the cdf zero or unity.
505 <a name="math_toolkit.dist_ref.nmp.h15"></a>
506 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.variance"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.variance">Variance</a>
508 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
509 <span class="identifier">RealType</span> <span class="identifier">variance</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
512 Returns the variance of the distribution <span class="emphasis"><em>dist</em></span>.
515 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
516 if the distribution does not have a defined variance.
519 <a name="math_toolkit.dist_ref.nmp.h16"></a>
520 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.skewness"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.skewness">Skewness</a>
522 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
523 <span class="identifier">RealType</span> <span class="identifier">skewness</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
526 Returns the skewness of the distribution <span class="emphasis"><em>dist</em></span>.
529 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
530 if the distribution does not have a defined skewness.
533 <a name="math_toolkit.dist_ref.nmp.h17"></a>
534 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.kurtosis"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.kurtosis">Kurtosis</a>
536 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
537 <span class="identifier">RealType</span> <span class="identifier">kurtosis</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
540 Returns the 'proper' kurtosis (normalized fourth moment) of the distribution
541 <span class="emphasis"><em>dist</em></span>.
544 kertosis = β<sub>2</sub>= μ<sub>4</sub> / μ<sub>2</sub><sup>2</sup>
547 Where μ<sub>i</sub> is the i'th central moment of the distribution, and in particular
548 μ<sub>2</sub> is the variance of the distribution.
551 The kurtosis is a measure of the "peakedness" of a distribution.
554 Note that the literature definition of kurtosis is confusing. The definition
555 used here is that used by for example <a href="http://mathworld.wolfram.com/Kurtosis.html" target="_top">Wolfram
556 MathWorld</a> (that includes a table of formulae for kurtosis excess
557 for various distributions) but NOT the definition of <a href="http://en.wikipedia.org/wiki/Kurtosis" target="_top">kurtosis
558 used by Wikipedia</a> which treats "kurtosis" and "kurtosis
559 excess" as the same quantity.
561 <pre class="programlisting"><span class="identifier">kurtosis_excess</span> <span class="special">=</span> <span class="char">'proper'</span> <span class="identifier">kurtosis</span> <span class="special">-</span> <span class="number">3</span>
564 This subtraction of 3 is convenient so that the <span class="emphasis"><em>kurtosis excess</em></span>
565 of a normal distribution is zero.
568 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
569 if the distribution does not have a defined kurtosis.
572 'Proper' kurtosis can have a value from zero to + infinity.
575 <a name="math_toolkit.dist_ref.nmp.h18"></a>
576 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.kurtosis_excess"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">Kurtosis
579 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
580 <span class="identifier">RealType</span> <span class="identifier">kurtosis_excess</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>Distribution-Type</em></span><span class="special"><</span><span class="identifier">RealType</span><span class="special">,</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">>&</span> <span class="identifier">dist</span><span class="special">);</span>
583 Returns the kurtosis excess of the distribution <span class="emphasis"><em>dist</em></span>.
586 kurtosis excess = γ<sub>2</sub>= μ<sub>4</sub> / μ<sub>2</sub><sup>2</sup>- 3 = kurtosis - 3
589 Where μ<sub>i</sub> is the i'th central moment of the distribution, and in particular
590 μ<sub>2</sub> is the variance of the distribution.
593 The kurtosis excess is a measure of the "peakedness" of a distribution,
594 and is more widely used than the "kurtosis proper". It is defined
595 so that the kurtosis excess of a normal distribution is zero.
598 This function may return a <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
599 if the distribution does not have a defined kurtosis excess.
602 Kurtosis excess can have a value from -2 to + infinity.
604 <pre class="programlisting"><span class="identifier">kurtosis</span> <span class="special">=</span> <span class="identifier">kurtosis_excess</span> <span class="special">+</span><span class="number">3</span><span class="special">;</span>
607 The kurtosis excess of a normal distribution is zero.
610 <a name="math_toolkit.dist_ref.nmp.h19"></a>
611 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.cdfPQ"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdfPQ">P
615 The terms P and Q are sometimes used to refer to the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative
616 Distribution Function</a> and its <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.ccdf">complement</a>
617 respectively. Lowercase p and q are sometimes used to refer to the values
618 returned by these functions.
621 <a name="math_toolkit.dist_ref.nmp.h20"></a>
622 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.percent"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.percent">Percent
623 Point Function or Percentile</a>
626 The percent point function, also known as the percentile, is the same as
627 the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>.
630 <a name="math_toolkit.dist_ref.nmp.h21"></a>
631 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.cdf_inv"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.cdf_inv">Inverse
635 The inverse of the cumulative distribution function, is the same as the
636 <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>.
639 <a name="math_toolkit.dist_ref.nmp.h22"></a>
640 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.survival_inv"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.survival_inv">Inverse
641 Survival Function.</a>
644 The inverse of the survival function, is the same as computing the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile_c">quantile from the complement
645 of the probability</a>.
648 <a name="math_toolkit.dist_ref.nmp.h23"></a>
649 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.pmf"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pmf">Probability
653 The Probability Mass Function is the same as the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability
654 Density Function</a>.
657 The term Mass Function is usually applied to discrete distributions, while
658 the term <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density
659 Function</a> applies to continuous distributions.
662 <a name="math_toolkit.dist_ref.nmp.h24"></a>
663 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.lower_critical"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.lower_critical">Lower
667 The lower critical value calculates the value of the random variable given
668 the area under the left tail of the distribution. It is equivalent to calculating
669 the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>.
672 <a name="math_toolkit.dist_ref.nmp.h25"></a>
673 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.upper_critical"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.upper_critical">Upper
677 The upper critical value calculates the value of the random variable given
678 the area under the right tail of the distribution. It is equivalent to calculating
679 the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.quantile_c">quantile from the
680 complement of the probability</a>.
683 <a name="math_toolkit.dist_ref.nmp.h26"></a>
684 <span class="phrase"><a name="math_toolkit.dist_ref.nmp.survival"></a></span><a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.survival">Survival
688 Refer to the <a class="link" href="nmp.html#math_toolkit.dist_ref.nmp.ccdf">Complement of
689 the Cumulative Distribution Function</a>.
692 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
693 <td align="left"></td>
694 <td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
695 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
696 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
697 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
698 Daryle Walker and Xiaogang Zhang<p>
699 Distributed under the Boost Software License, Version 1.0. (See accompanying
700 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>)
705 <div class="spirit-nav">
706 <a accesskey="p" href="../dist_ref.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dist_ref.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="dists.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>