]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/doc/html/math_toolkit/dist_ref/dists/normal_dist.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / dist_ref / dists / normal_dist.html
CommitLineData
7c673cae
FG
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4<title>Normal (Gaussian) 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="nc_t_dist.html" title="Noncentral T Distribution">
10<link rel="next" href="pareto.html" title="Pareto 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="nc_t_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="pareto.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.normal_dist"></a><a class="link" href="normal_dist.html" title="Normal (Gaussian) Distribution">Normal (Gaussian)
28 Distribution</a>
29</h4></div></div></div>
30<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">normal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></pre>
31<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>
32
33<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>
34 <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>
35<span class="keyword">class</span> <span class="identifier">normal_distribution</span><span class="special">;</span>
36
37<span class="keyword">typedef</span> <span class="identifier">normal_distribution</span><span class="special">&lt;&gt;</span> <span class="identifier">normal</span><span class="special">;</span>
38
39<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>
40<span class="keyword">class</span> <span class="identifier">normal_distribution</span>
41<span class="special">{</span>
42<span class="keyword">public</span><span class="special">:</span>
43 <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span>
44 <span class="keyword">typedef</span> <span class="identifier">Policy</span> <span class="identifier">policy_type</span><span class="special">;</span>
45 <span class="comment">// Construct:</span>
46 <span class="identifier">normal_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">mean</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">sd</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
47 <span class="comment">// Accessors:</span>
48 <span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> <span class="comment">// location.</span>
49 <span class="identifier">RealType</span> <span class="identifier">standard_deviation</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> <span class="comment">// scale.</span>
50 <span class="comment">// Synonyms, provided to allow generic use of find_location and find_scale.</span>
51 <span class="identifier">RealType</span> <span class="identifier">location</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
52 <span class="identifier">RealType</span> <span class="identifier">scale</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
53<span class="special">};</span>
54
55<span class="special">}}</span> <span class="comment">// namespaces</span>
56</pre>
57<p>
58 The normal distribution is probably the most well known statistical distribution:
59 it is also known as the Gaussian Distribution. A normal distribution with
60 mean zero and standard deviation one is known as the <span class="emphasis"><em>Standard
61 Normal Distribution</em></span>.
62 </p>
63<p>
64 Given mean &#956; &#160;and standard deviation &#963; &#160;it has the PDF:
65 </p>
66<p>
67 &#160; <span class="inlinemediaobject"><img src="../../../../equations/normal_ref1.svg"></span>
68 </p>
69<p>
70 The variation the PDF with its parameters is illustrated in the following
71 graph:
72 </p>
73<p>
74 <span class="inlinemediaobject"><img src="../../../../graphs/normal_pdf.svg" align="middle"></span>
75 </p>
76<p>
77 The cumulative distribution function is given by
78 </p>
79<p>
80 &#160; <span class="inlinemediaobject"><img src="../../../../equations/normal_cdf.svg"></span>
81 </p>
82<p>
83 and illustrated by this graph
84 </p>
85<p>
86 <span class="inlinemediaobject"><img src="../../../../graphs/normal_cdf.svg" align="middle"></span>
87 </p>
88<h5>
89<a name="math_toolkit.dist_ref.dists.normal_dist.h0"></a>
90 <span class="phrase"><a name="math_toolkit.dist_ref.dists.normal_dist.member_functions"></a></span><a class="link" href="normal_dist.html#math_toolkit.dist_ref.dists.normal_dist.member_functions">Member
91 Functions</a>
92 </h5>
93<pre class="programlisting"><span class="identifier">normal_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">mean</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">sd</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
94</pre>
95<p>
96 Constructs a normal distribution with mean <span class="emphasis"><em>mean</em></span> and
97 standard deviation <span class="emphasis"><em>sd</em></span>.
98 </p>
99<p>
100 Requires sd &gt; 0, otherwise <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
101 is called.
102 </p>
103<pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
104<span class="identifier">RealType</span> <span class="identifier">location</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
105</pre>
106<p>
107 both return the <span class="emphasis"><em>mean</em></span> of this distribution.
108 </p>
109<pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">standard_deviation</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
110<span class="identifier">RealType</span> <span class="identifier">scale</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
111</pre>
112<p>
113 both return the <span class="emphasis"><em>standard deviation</em></span> of this distribution.
114 (Redundant location and scale function are provided to match other similar
115 distributions, allowing the functions find_location and find_scale to be
116 used generically).
117 </p>
118<h5>
119<a name="math_toolkit.dist_ref.dists.normal_dist.h1"></a>
120 <span class="phrase"><a name="math_toolkit.dist_ref.dists.normal_dist.non_member_accessors"></a></span><a class="link" href="normal_dist.html#math_toolkit.dist_ref.dists.normal_dist.non_member_accessors">Non-member
121 Accessors</a>
122 </h5>
123<p>
124 All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
125 functions</a> that are generic to all distributions are supported:
126 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
127 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
128 <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>,
129 <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>,
130 <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>,
131 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
132 <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>,
133 <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>.
134 </p>
135<p>
136 The domain of the random variable is [-[max_value], +[min_value]]. However,
137 the pdf of +&#8734; and -&#8734; = 0 is also supported, and cdf at -&#8734; = 0, cdf at +&#8734; = 1, and
138 complement cdf -&#8734; = 1 and +&#8734; = 0, if RealType permits.
139 </p>
140<h5>
141<a name="math_toolkit.dist_ref.dists.normal_dist.h2"></a>
142 <span class="phrase"><a name="math_toolkit.dist_ref.dists.normal_dist.accuracy"></a></span><a class="link" href="normal_dist.html#math_toolkit.dist_ref.dists.normal_dist.accuracy">Accuracy</a>
143 </h5>
144<p>
145 The normal distribution is implemented in terms of the <a class="link" href="../../sf_erf/error_function.html" title="Error Functions">error
146 function</a>, and as such should have very low error rates.
147 </p>
148<h5>
149<a name="math_toolkit.dist_ref.dists.normal_dist.h3"></a>
150 <span class="phrase"><a name="math_toolkit.dist_ref.dists.normal_dist.implementation"></a></span><a class="link" href="normal_dist.html#math_toolkit.dist_ref.dists.normal_dist.implementation">Implementation</a>
151 </h5>
152<p>
153 In the following table <span class="emphasis"><em>m</em></span> is the mean of the distribution,
154 and <span class="emphasis"><em>s</em></span> is its standard deviation.
155 </p>
156<div class="informaltable"><table class="table">
157<colgroup>
158<col>
159<col>
160</colgroup>
161<thead><tr>
162<th>
163 <p>
164 Function
165 </p>
166 </th>
167<th>
168 <p>
169 Implementation Notes
170 </p>
171 </th>
172</tr></thead>
173<tbody>
174<tr>
175<td>
176 <p>
177 pdf
178 </p>
179 </td>
180<td>
181 <p>
182 Using the relation: pdf = e<sup>-(x-m)<sup>2</sup>/(2s<sup>2</sup>)</sup> / (s * sqrt(2*pi))
183 </p>
184 </td>
185</tr>
186<tr>
187<td>
188 <p>
189 cdf
190 </p>
191 </td>
192<td>
193 <p>
194 Using the relation: p = 0.5 * <a class="link" href="../../sf_erf/error_function.html" title="Error Functions">erfc</a>(-(x-m)/(s*sqrt(2)))
195 </p>
196 </td>
197</tr>
198<tr>
199<td>
200 <p>
201 cdf complement
202 </p>
203 </td>
204<td>
205 <p>
206 Using the relation: q = 0.5 * <a class="link" href="../../sf_erf/error_function.html" title="Error Functions">erfc</a>((x-m)/(s*sqrt(2)))
207 </p>
208 </td>
209</tr>
210<tr>
211<td>
212 <p>
213 quantile
214 </p>
215 </td>
216<td>
217 <p>
218 Using the relation: x = m - s * sqrt(2) * <a class="link" href="../../sf_erf/error_inv.html" title="Error Function Inverses">erfc_inv</a>(2*p)
219 </p>
220 </td>
221</tr>
222<tr>
223<td>
224 <p>
225 quantile from the complement
226 </p>
227 </td>
228<td>
229 <p>
230 Using the relation: x = m + s * sqrt(2) * <a class="link" href="../../sf_erf/error_inv.html" title="Error Function Inverses">erfc_inv</a>(2*p)
231 </p>
232 </td>
233</tr>
234<tr>
235<td>
236 <p>
237 mean and standard deviation
238 </p>
239 </td>
240<td>
241 <p>
242 The same as <code class="computeroutput"><span class="identifier">dist</span><span class="special">.</span><span class="identifier">mean</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">dist</span><span class="special">.</span><span class="identifier">standard_deviation</span><span class="special">()</span></code>
243 </p>
244 </td>
245</tr>
246<tr>
247<td>
248 <p>
249 mode
250 </p>
251 </td>
252<td>
253 <p>
254 The same as the mean.
255 </p>
256 </td>
257</tr>
258<tr>
259<td>
260 <p>
261 median
262 </p>
263 </td>
264<td>
265 <p>
266 The same as the mean.
267 </p>
268 </td>
269</tr>
270<tr>
271<td>
272 <p>
273 skewness
274 </p>
275 </td>
276<td>
277 <p>
278 0
279 </p>
280 </td>
281</tr>
282<tr>
283<td>
284 <p>
285 kurtosis
286 </p>
287 </td>
288<td>
289 <p>
290 3
291 </p>
292 </td>
293</tr>
294<tr>
295<td>
296 <p>
297 kurtosis excess
298 </p>
299 </td>
300<td>
301 <p>
302 0
303 </p>
304 </td>
305</tr>
306</tbody>
307</table></div>
308</div>
309<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
310<td align="left"></td>
311<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
312 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
313 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
314 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
315 Distributed under the Boost Software License, Version 1.0. (See accompanying
316 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>)
317 </p>
318</div></td>
319</tr></table>
320<hr>
321<div class="spirit-nav">
322<a accesskey="p" href="nc_t_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="pareto.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
323</div>
324</body>
325</html>