]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/doc/html/math_toolkit/dist_ref/dists/lognormal_dist.html
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / dist_ref / dists / lognormal_dist.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Log Normal 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="logistic_dist.html" title="Logistic Distribution">
10 <link rel="next" href="negative_binomial_dist.html" title="Negative Binomial 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="logistic_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="negative_binomial_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.lognormal_dist"></a><a class="link" href="lognormal_dist.html" title="Log Normal Distribution">Log Normal
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">lognormal</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">lognormal_distribution</span><span class="special">;</span>
36
37 <span class="keyword">typedef</span> <span class="identifier">lognormal_distribution</span><span class="special">&lt;&gt;</span> <span class="identifier">lognormal</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">lognormal_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">lognormal_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">location</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">scale</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">location</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
49 <span class="identifier">RealType</span> <span class="identifier">scale</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 lognormal distribution is the distribution that arises when the logarithm
56 of the random variable is normally distributed. A lognormal distribution
57 results when the variable is the product of a large number of independent,
58 identically-distributed variables.
59 </p>
60 <p>
61 For location and scale parameters <span class="emphasis"><em>m</em></span> and <span class="emphasis"><em>s</em></span>
62 it is defined by the probability density function:
63 </p>
64 <p>
65 <span class="inlinemediaobject"><img src="../../../../equations/lognormal_ref.svg"></span>
66 </p>
67 <p>
68 The location and scale parameters are equivalent to the mean and standard
69 deviation of the logarithm of the random variable.
70 </p>
71 <p>
72 The following graph illustrates the effect of the location parameter on
73 the PDF, note that the range of the random variable remains [0,+&#8734;] irrespective
74 of the value of the location parameter:
75 </p>
76 <p>
77 <span class="inlinemediaobject"><img src="../../../../graphs/lognormal_pdf1.svg" align="middle"></span>
78 </p>
79 <p>
80 The next graph illustrates the effect of the scale parameter on the PDF:
81 </p>
82 <p>
83 <span class="inlinemediaobject"><img src="../../../../graphs/lognormal_pdf2.svg" align="middle"></span>
84 </p>
85 <h5>
86 <a name="math_toolkit.dist_ref.dists.lognormal_dist.h0"></a>
87 <span class="phrase"><a name="math_toolkit.dist_ref.dists.lognormal_dist.member_functions"></a></span><a class="link" href="lognormal_dist.html#math_toolkit.dist_ref.dists.lognormal_dist.member_functions">Member
88 Functions</a>
89 </h5>
90 <pre class="programlisting"><span class="identifier">lognormal_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">location</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">scale</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
91 </pre>
92 <p>
93 Constructs a lognormal distribution with location <span class="emphasis"><em>location</em></span>
94 and scale <span class="emphasis"><em>scale</em></span>.
95 </p>
96 <p>
97 The location parameter is the same as the mean of the logarithm of the
98 random variate.
99 </p>
100 <p>
101 The scale parameter is the same as the standard deviation of the logarithm
102 of the random variate.
103 </p>
104 <p>
105 Requires that the scale parameter is greater than zero, otherwise calls
106 <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>.
107 </p>
108 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">location</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
109 </pre>
110 <p>
111 Returns the <span class="emphasis"><em>location</em></span> parameter of this distribution.
112 </p>
113 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">scale</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
114 </pre>
115 <p>
116 Returns the <span class="emphasis"><em>scale</em></span> parameter of this distribution.
117 </p>
118 <h5>
119 <a name="math_toolkit.dist_ref.dists.lognormal_dist.h1"></a>
120 <span class="phrase"><a name="math_toolkit.dist_ref.dists.lognormal_dist.non_member_accessors"></a></span><a class="link" href="lognormal_dist.html#math_toolkit.dist_ref.dists.lognormal_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 [0,+&#8734;].
137 </p>
138 <h5>
139 <a name="math_toolkit.dist_ref.dists.lognormal_dist.h2"></a>
140 <span class="phrase"><a name="math_toolkit.dist_ref.dists.lognormal_dist.accuracy"></a></span><a class="link" href="lognormal_dist.html#math_toolkit.dist_ref.dists.lognormal_dist.accuracy">Accuracy</a>
141 </h5>
142 <p>
143 The lognormal distribution is implemented in terms of the standard library
144 log and exp functions, plus the <a class="link" href="../../sf_erf/error_function.html" title="Error Functions">error
145 function</a>, and as such should have very low error rates.
146 </p>
147 <h5>
148 <a name="math_toolkit.dist_ref.dists.lognormal_dist.h3"></a>
149 <span class="phrase"><a name="math_toolkit.dist_ref.dists.lognormal_dist.implementation"></a></span><a class="link" href="lognormal_dist.html#math_toolkit.dist_ref.dists.lognormal_dist.implementation">Implementation</a>
150 </h5>
151 <p>
152 In the following table <span class="emphasis"><em>m</em></span> is the location parameter
153 of the distribution, <span class="emphasis"><em>s</em></span> is its scale parameter, <span class="emphasis"><em>x</em></span>
154 is the random variate, <span class="emphasis"><em>p</em></span> is the probability and <span class="emphasis"><em>q
155 = 1-p</em></span>.
156 </p>
157 <div class="informaltable"><table class="table">
158 <colgroup>
159 <col>
160 <col>
161 </colgroup>
162 <thead><tr>
163 <th>
164 <p>
165 Function
166 </p>
167 </th>
168 <th>
169 <p>
170 Implementation Notes
171 </p>
172 </th>
173 </tr></thead>
174 <tbody>
175 <tr>
176 <td>
177 <p>
178 pdf
179 </p>
180 </td>
181 <td>
182 <p>
183 Using the relation: pdf = e<sup>-(ln(x) - m)<sup>2 </sup> / 2s<sup>2 </sup> </sup> / (x * s * sqrt(2pi))
184 </p>
185 </td>
186 </tr>
187 <tr>
188 <td>
189 <p>
190 cdf
191 </p>
192 </td>
193 <td>
194 <p>
195 Using the relation: p = cdf(normal_distribtion&lt;RealType&gt;(m,
196 s), log(x))
197 </p>
198 </td>
199 </tr>
200 <tr>
201 <td>
202 <p>
203 cdf complement
204 </p>
205 </td>
206 <td>
207 <p>
208 Using the relation: q = cdf(complement(normal_distribtion&lt;RealType&gt;(m,
209 s), log(x)))
210 </p>
211 </td>
212 </tr>
213 <tr>
214 <td>
215 <p>
216 quantile
217 </p>
218 </td>
219 <td>
220 <p>
221 Using the relation: x = exp(quantile(normal_distribtion&lt;RealType&gt;(m,
222 s), p))
223 </p>
224 </td>
225 </tr>
226 <tr>
227 <td>
228 <p>
229 quantile from the complement
230 </p>
231 </td>
232 <td>
233 <p>
234 Using the relation: x = exp(quantile(complement(normal_distribtion&lt;RealType&gt;(m,
235 s), q)))
236 </p>
237 </td>
238 </tr>
239 <tr>
240 <td>
241 <p>
242 mean
243 </p>
244 </td>
245 <td>
246 <p>
247 e<sup>m + s<sup>2 </sup> / 2 </sup>
248 </p>
249 </td>
250 </tr>
251 <tr>
252 <td>
253 <p>
254 variance
255 </p>
256 </td>
257 <td>
258 <p>
259 (e<sup>s<sup>2</sup> </sup> - 1) * e<sup>2m + s<sup>2 </sup> </sup>
260 </p>
261 </td>
262 </tr>
263 <tr>
264 <td>
265 <p>
266 mode
267 </p>
268 </td>
269 <td>
270 <p>
271 e<sup>m - s<sup>2 </sup> </sup>
272 </p>
273 </td>
274 </tr>
275 <tr>
276 <td>
277 <p>
278 skewness
279 </p>
280 </td>
281 <td>
282 <p>
283 sqrt(e<sup>s<sup>2</sup> </sup> - 1) * (2 + e<sup>s<sup>2</sup> </sup>)
284 </p>
285 </td>
286 </tr>
287 <tr>
288 <td>
289 <p>
290 kurtosis
291 </p>
292 </td>
293 <td>
294 <p>
295 e<sup>4s<sup>2</sup> </sup> + 2e<sup>3s<sup>2</sup> </sup> + 3e<sup>2s<sup>2</sup> </sup> - 3
296 </p>
297 </td>
298 </tr>
299 <tr>
300 <td>
301 <p>
302 kurtosis excess
303 </p>
304 </td>
305 <td>
306 <p>
307 e<sup>4s<sup>2</sup> </sup> + 2e<sup>3s<sup>2</sup> </sup> + 3e<sup>2s<sup>2</sup> </sup> - 6
308 </p>
309 </td>
310 </tr>
311 </tbody>
312 </table></div>
313 </div>
314 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
315 <td align="left"></td>
316 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
317 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
318 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
319 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
320 Distributed under the Boost Software License, Version 1.0. (See accompanying
321 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>)
322 </p>
323 </div></td>
324 </tr></table>
325 <hr>
326 <div class="spirit-nav">
327 <a accesskey="p" href="logistic_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="negative_binomial_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
328 </div>
329 </body>
330 </html>