72e469da0a
[CI SKIP]
78 lines
5.6 KiB
HTML
78 lines
5.6 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Random Variates and Distribution Parameters</title>
|
|
<link rel="stylesheet" href="../../math.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
|
<link rel="home" href="../../index.html" title="Math Toolkit 2.11.0">
|
|
<link rel="up" href="../stat_tut.html" title="Statistical Distributions Tutorial">
|
|
<link rel="prev" href="weg/c_sharp.html" title="Using the Distributions from Within C#">
|
|
<link rel="next" href="dist_params.html" title="Discrete Probability Distributions">
|
|
</head>
|
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
<table cellpadding="2" width="100%"><tr>
|
|
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
|
<td align="center"><a href="../../../../../../index.html">Home</a></td>
|
|
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
|
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="weg/c_sharp.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../stat_tut.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="dist_params.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h3 class="title">
|
|
<a name="math_toolkit.stat_tut.variates"></a><a class="link" href="variates.html" title="Random Variates and Distribution Parameters">Random Variates and Distribution
|
|
Parameters</a>
|
|
</h3></div></div></div>
|
|
<p>
|
|
<a href="http://en.wikipedia.org/wiki/Random_variate" target="_top">Random variates</a>
|
|
and <a href="http://en.wikipedia.org/wiki/Parameter" target="_top">distribution parameters</a>
|
|
are conventionally distinguished (for example in Wikipedia and Wolfram MathWorld
|
|
by placing a semi-colon after the <a href="http://en.wikipedia.org/wiki/Random_variate" target="_top">random
|
|
variate</a> (whose value you 'choose'), to separate the variate from
|
|
the parameter(s) that defines the shape of the distribution.
|
|
</p>
|
|
<p>
|
|
For example, the binomial distribution has two parameters: n (the number
|
|
of trials) and p (the probability of success on one trial). It also has the
|
|
<a href="http://en.wikipedia.org/wiki/Random_variate" target="_top">random variate</a>
|
|
<span class="emphasis"><em>k</em></span>: the number of successes observed. This means the
|
|
probability density/mass function (pdf) is written as <span class="emphasis"><em>f(k; n, p)</em></span>.
|
|
</p>
|
|
<p>
|
|
Translating this into code the <code class="computeroutput"><span class="identifier">binomial_distribution</span></code>
|
|
constructor therefore has two parameters:
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">binomial_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">p</span><span class="special">);</span>
|
|
</pre>
|
|
<p>
|
|
While the function <code class="computeroutput"><span class="identifier">pdf</span></code> has
|
|
one argument specifying the distribution type (which includes its parameters,
|
|
if any), and a second argument for the <a href="http://en.wikipedia.org/wiki/Random_variate" target="_top">random
|
|
variate</a>. So taking our binomial distribution example, we would write:
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">pdf</span><span class="special">(</span><span class="identifier">binomial_distribution</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">>(</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">p</span><span class="special">),</span> <span class="identifier">k</span><span class="special">);</span>
|
|
</pre>
|
|
</div>
|
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
|
<td align="left"></td>
|
|
<td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
|
|
Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
|
|
Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
|
|
Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
|
|
Daryle Walker and Xiaogang Zhang<p>
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
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>)
|
|
</p>
|
|
</div></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="weg/c_sharp.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../stat_tut.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="dist_params.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|