1 [section:lognormal_dist Log Normal Distribution]
3 ``#include <boost/math/distributions/lognormal.hpp>``
5 namespace boost{ namespace math{
7 template <class RealType = double,
8 class ``__Policy`` = ``__policy_class`` >
9 class lognormal_distribution;
11 typedef lognormal_distribution<> lognormal;
13 template <class RealType, class ``__Policy``>
14 class lognormal_distribution
17 typedef RealType value_type;
18 typedef Policy policy_type;
20 lognormal_distribution(RealType location = 0, RealType scale = 1);
22 RealType location()const;
23 RealType scale()const;
28 The lognormal distribution is the distribution that arises
29 when the logarithm of the random variable is normally distributed.
30 A lognormal distribution results when the variable is the product
31 of a large number of independent, identically-distributed variables.
33 For location and scale parameters /m/ and /s/ it is defined by the
34 probability density function:
36 [equation lognormal_ref]
38 The location and scale parameters are equivalent to the mean and
39 standard deviation of the logarithm of the random variable.
41 The following graph illustrates the effect of the location
42 parameter on the PDF, note that the range of the random
43 variable remains \[0,+[infin]\] irrespective of the value of the
46 [graph lognormal_pdf1]
48 The next graph illustrates the effect of the scale parameter on the PDF:
50 [graph lognormal_pdf2]
54 lognormal_distribution(RealType location = 0, RealType scale = 1);
56 Constructs a lognormal distribution with location /location/ and
59 The location parameter is the same as the mean of the logarithm of the
62 The scale parameter is the same as the standard deviation of the
63 logarithm of the random variate.
65 Requires that the scale parameter is greater than zero, otherwise calls
68 RealType location()const;
70 Returns the /location/ parameter of this distribution.
72 RealType scale()const;
74 Returns the /scale/ parameter of this distribution.
76 [h4 Non-member Accessors]
78 All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
79 distributions are supported: __usual_accessors.
81 The domain of the random variable is \[0,+[infin]\].
85 The lognormal distribution is implemented in terms of the
86 standard library log and exp functions, plus the
87 [link math_toolkit.sf_erf.error_function error function],
88 and as such should have very low error rates.
92 In the following table /m/ is the location parameter of the distribution,
93 /s/ is its scale parameter, /x/ is the random variate, /p/ is the probability
97 [[Function][Implementation Notes]]
98 [[pdf][Using the relation: pdf = e[super -(ln(x) - m)[super 2 ] \/ 2s[super 2 ] ] \/ (x * s * sqrt(2pi)) ]]
99 [[cdf][Using the relation: p = cdf(normal_distribtion<RealType>(m, s), log(x)) ]]
100 [[cdf complement][Using the relation: q = cdf(complement(normal_distribtion<RealType>(m, s), log(x))) ]]
101 [[quantile][Using the relation: x = exp(quantile(normal_distribtion<RealType>(m, s), p))]]
102 [[quantile from the complement][Using the relation: x = exp(quantile(complement(normal_distribtion<RealType>(m, s), q)))]]
103 [[mean][e[super m + s[super 2 ] / 2 ] ]]
104 [[variance][(e[super s[super 2] ] - 1) * e[super 2m + s[super 2 ] ] ]]
105 [[mode][e[super m - s[super 2 ] ] ]]
106 [[skewness][sqrt(e[super s[super 2] ] - 1) * (2 + e[super s[super 2] ]) ]]
107 [[kurtosis][e[super 4s[super 2] ] + 2e[super 3s[super 2] ] + 3e[super 2s[super 2] ] - 3]]
108 [[kurtosis excess][e[super 4s[super 2] ] + 2e[super 3s[super 2] ] + 3e[super 2s[super 2] ] - 6 ]]
111 [endsect][/section:normal_dist Normal]
114 Copyright 2006 John Maddock and Paul A. Bristow.
115 Distributed under the Boost Software License, Version 1.0.
116 (See accompanying file LICENSE_1_0.txt or copy at
117 http://www.boost.org/LICENSE_1_0.txt).