3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Logistic 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=
"laplace_dist.html" title=
"Laplace Distribution">
10 <link rel=
"next" href=
"lognormal_dist.html" title=
"Log Normal Distribution">
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=
"laplace_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=
"lognormal_dist.html"><img src=
"../../../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h4 class=
"title">
27 <a name=
"math_toolkit.dist_ref.dists.logistic_dist"></a><a class=
"link" href=
"logistic_dist.html" title=
"Logistic Distribution">Logistic
29 </h4></div></div></div>
30 <pre class=
"programlisting"><span class=
"preprocessor">#include
</span> <span class=
"special"><</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">logistic
</span><span class=
"special">.
</span><span class=
"identifier">hpp
</span><span class=
"special">></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>
33 <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">double
</span><span class=
"special">,
</span>
34 <span class=
"keyword">class
</span> <a class=
"link" href=
"../../../policy.html" title=
"Chapter 15. 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
<></a> <span class=
"special">></span>
35 <span class=
"keyword">class
</span> <span class=
"identifier">logistic_distribution
</span><span class=
"special">;
</span>
37 <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> <span class=
"identifier">Policy
</span><span class=
"special">></span>
38 <span class=
"keyword">class
</span> <span class=
"identifier">logistic_distribution
</span>
39 <span class=
"special">{
</span>
40 <span class=
"keyword">public
</span><span class=
"special">:
</span>
41 <span class=
"keyword">typedef
</span> <span class=
"identifier">RealType
</span> <span class=
"identifier">value_type
</span><span class=
"special">;
</span>
42 <span class=
"keyword">typedef
</span> <span class=
"identifier">Policy
</span> <span class=
"identifier">policy_type
</span><span class=
"special">;
</span>
43 <span class=
"comment">// Construct:
</span>
44 <span class=
"identifier">logistic_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>
45 <span class=
"comment">// Accessors:
</span>
46 <span class=
"identifier">RealType
</span> <span class=
"identifier">location
</span><span class=
"special">()
</span><span class=
"keyword">const
</span><span class=
"special">;
</span> <span class=
"comment">// location.
</span>
47 <span class=
"identifier">RealType
</span> <span class=
"identifier">scale
</span><span class=
"special">()
</span><span class=
"keyword">const
</span><span class=
"special">;
</span> <span class=
"comment">// scale.
</span>
49 <span class=
"special">};
</span>
51 <span class=
"keyword">typedef
</span> <span class=
"identifier">logistic_distribution
</span><span class=
"special"><></span> <span class=
"identifier">logistic
</span><span class=
"special">;
</span>
53 <span class=
"special">}}
</span> <span class=
"comment">// namespaces
</span>
56 The logistic distribution is a continous probability distribution. It has
57 two parameters - location and scale. The cumulative distribution function
58 of the logistic distribution appears in logistic regression and feedforward
59 neural networks. Among other applications, United State Chess Federation
60 and FIDE use it to calculate chess ratings.
63 The following graph shows how the distribution changes as the parameters
67 <span class=
"inlinemediaobject"><img src=
"../../../../graphs/logistic_pdf.svg" align=
"middle"></span>
70 <a name=
"math_toolkit.dist_ref.dists.logistic_dist.h0"></a>
71 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.logistic_dist.member_functions"></a></span><a class=
"link" href=
"logistic_dist.html#math_toolkit.dist_ref.dists.logistic_dist.member_functions">Member
74 <pre class=
"programlisting"><span class=
"identifier">logistic_distribution
</span><span class=
"special">(
</span><span class=
"identifier">RealType
</span> <span class=
"identifier">u
</span> <span class=
"special">=
</span> <span class=
"number">0</span><span class=
"special">,
</span> <span class=
"identifier">RealType
</span> <span class=
"identifier">s
</span> <span class=
"special">=
</span> <span class=
"number">1</span><span class=
"special">);
</span>
77 Constructs a logistic distribution with location
<span class=
"emphasis"><em>u
</em></span>
78 and scale
<span class=
"emphasis"><em>s
</em></span>.
81 Requires
<code class=
"computeroutput"><span class=
"identifier">scale
</span> <span class=
"special">></span>
82 <span class=
"number">0</span></code>, otherwise a
<a class=
"link" href=
"../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error
</a>
85 <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>
88 Returns the location of this distribution.
90 <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>
93 Returns the scale of this distribution.
96 <a name=
"math_toolkit.dist_ref.dists.logistic_dist.h1"></a>
97 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.logistic_dist.non_member_accessors"></a></span><a class=
"link" href=
"logistic_dist.html#math_toolkit.dist_ref.dists.logistic_dist.non_member_accessors">Non-member
101 All the
<a class=
"link" href=
"../nmp.html" title=
"Non-Member Properties">usual non-member accessor
102 functions
</a> that are generic to all distributions are supported:
103 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function
</a>,
104 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function
</a>,
105 <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>,
106 <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>,
107 <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>,
108 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation
</a>,
109 <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>,
110 <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>.
113 The domain of the random variable is [-[max_value], +[min_value]]. However,
114 the pdf and cdf support inputs of +
∞ and -
∞
115 as special cases if RealType permits.
118 At
<code class=
"computeroutput"><span class=
"identifier">p
</span><span class=
"special">=
</span><span class=
"number">1</span></code> and
<code class=
"computeroutput"><span class=
"identifier">p
</span><span class=
"special">=
</span><span class=
"number">0</span></code>, the quantile
119 function returns the result of +
<a class=
"link" href=
"../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error
</a>
120 and -
<a class=
"link" href=
"../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error
</a>,
121 while the complement quantile function returns the result of -
<a class=
"link" href=
"../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error
</a>
122 and +
<a class=
"link" href=
"../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error
</a>
126 <a name=
"math_toolkit.dist_ref.dists.logistic_dist.h2"></a>
127 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.logistic_dist.accuracy"></a></span><a class=
"link" href=
"logistic_dist.html#math_toolkit.dist_ref.dists.logistic_dist.accuracy">Accuracy
</a>
130 The logistic distribution is implemented in terms of the
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">exp
</span></code> and the
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">log
</span></code>
131 functions, so its accuracy is related to the accurate implementations of
132 those functions on a given platform. When calculating the quantile with
133 a non-zero
<span class=
"emphasis"><em>position
</em></span> parameter catastrophic cancellation
134 errors can occur: in such cases, only a low
<span class=
"emphasis"><em>absolute error
</em></span>
138 <a name=
"math_toolkit.dist_ref.dists.logistic_dist.h3"></a>
139 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.logistic_dist.implementation"></a></span><a class=
"link" href=
"logistic_dist.html#math_toolkit.dist_ref.dists.logistic_dist.implementation">Implementation
</a>
141 <div class=
"informaltable"><table class=
"table">
167 Using the relation: pdf = e
<sup>-(x-u)/s
</sup> / (s*(
1+e
<sup>-(x-u)/s
</sup>)
<sup>2</sup>)
179 Using the relation: p =
1/(
1+e
<sup>-(x-u)/s
</sup>)
191 Using the relation: q =
1/(
1+e
<sup>(x-u)/s
</sup>)
203 Using the relation: x = u - s*log(
1/p-
1)
210 quantile from the complement
215 Using the relation: x = u + s*log(p/
1-p)
239 The same as the mean.
275 (
π*s)
<sup>2</sup> /
3
282 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
283 <td align=
"left"></td>
284 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2006-
2010,
2012-
2014 Nikhar Agrawal,
285 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
286 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R
åde, Gautam Sewani,
287 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang
<p>
288 Distributed under the Boost Software License, Version
1.0. (See accompanying
289 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>)
294 <div class=
"spirit-nav">
295 <a accesskey=
"p" href=
"laplace_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=
"lognormal_dist.html"><img src=
"../../../../../../../doc/src/images/next.png" alt=
"Next"></a>