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.79.1">
7 <link rel="home" href="../../../index.html" title="Math Toolkit 2.11.0">
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 20. 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
66 <div class="blockquote"><blockquote class="blockquote"><p>
67 <span class="inlinemediaobject"><img src="../../../../graphs/logistic_pdf.svg" align="middle"></span>
69 </p></blockquote></div>
71 <a name="math_toolkit.dist_ref.dists.logistic_dist.h0"></a>
72 <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
75 <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>
78 Constructs a logistic distribution with location <span class="emphasis"><em>u</em></span>
79 and scale <span class="emphasis"><em>s</em></span>.
82 Requires <code class="computeroutput"><span class="identifier">scale</span> <span class="special">></span>
83 <span class="number">0</span></code>, otherwise a <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
86 <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>
89 Returns the location of this distribution.
91 <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>
94 Returns the scale of this distribution.
97 <a name="math_toolkit.dist_ref.dists.logistic_dist.h1"></a>
98 <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
102 All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
103 functions</a> that are generic to all distributions are supported:
104 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
105 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
106 <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>,
107 <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>,
108 <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>,
109 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
110 <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>,
111 <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>.
114 The domain of the random variable is [-[max_value], +[min_value]]. However,
115 the pdf and cdf support inputs of +∞ and -∞
116 as special cases if RealType permits.
119 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
120 function returns the result of +<a class="link" href="../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>
121 and -<a class="link" href="../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>,
122 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>
123 and +<a class="link" href="../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>
127 <a name="math_toolkit.dist_ref.dists.logistic_dist.h2"></a>
128 <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>
131 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>
132 functions, so its accuracy is related to the accurate implementations of
133 those functions on a given platform. When calculating the quantile with
134 a non-zero <span class="emphasis"><em>position</em></span> parameter catastrophic cancellation
135 errors can occur: in such cases, only a low <span class="emphasis"><em>absolute error</em></span>
139 <a name="math_toolkit.dist_ref.dists.logistic_dist.h3"></a>
140 <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>
142 <div class="informaltable"><table class="table">
168 Using the relation: pdf = e<sup>-(x-u)/s</sup> / (s*(1+e<sup>-(x-u)/s</sup>)<sup>2</sup>)
180 Using the relation: p = 1/(1+e<sup>-(x-u)/s</sup>)
192 Using the relation: q = 1/(1+e<sup>(x-u)/s</sup>)
204 Using the relation: x = u - s*log(1/p-1)
211 quantile from the complement
216 Using the relation: x = u + s*log(p/1-p)
240 The same as the mean.
276 (π*s)<sup>2</sup> / 3
283 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
284 <td align="left"></td>
285 <td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
286 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
287 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
288 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
289 Daryle Walker and Xiaogang Zhang<p>
290 Distributed under the Boost Software License, Version 1.0. (See accompanying
291 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>)
296 <div class="spirit-nav">
297 <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>