| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> |
| <title>Beta Distribution</title> |
| <link rel="stylesheet" href="../../../../../../../../../doc/src/boostbook.css" type="text/css"> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.74.0"> |
| <link rel="home" href="../../../../index.html" title="Math Toolkit"> |
| <link rel="up" href="../dists.html" title="Distributions"> |
| <link rel="prev" href="bernoulli_dist.html" title="Bernoulli Distribution"> |
| <link rel="next" href="binomial_dist.html" title="Binomial Distribution"> |
| </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="bernoulli_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="binomial_dist.html"><img src="../../../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| <div class="section" lang="en"> |
| <div class="titlepage"><div><div><h5 class="title"> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist"></a><a class="link" href="beta_dist.html" title="Beta Distribution"> Beta |
| Distribution</a> |
| </h5></div></div></div> |
| <p> |
| |
| </p> |
| <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">beta</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></pre> |
| <p> |
| </p> |
| <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> |
| |
| <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> |
| <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Policies">Policy</a> <span class="special">=</span> <a class="link" href="../../../policy/pol_ref/pol_ref_ref.html" title="Policy Class Reference">policies::policy<></a> <span class="special">></span> |
| <span class="keyword">class</span> <span class="identifier">beta_distribution</span><span class="special">;</span> |
| |
| <span class="comment">// typedef beta_distribution<double> beta; |
| </span><span class="comment">// Note that this is deliberately NOT provided, |
| </span><span class="comment">// to avoid a clash with the function name beta. |
| </span> |
| <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> <a class="link" href="../../../policy.html" title="Policies">Policy</a><span class="special">></span> |
| <span class="keyword">class</span> <span class="identifier">beta_distribution</span> |
| <span class="special">{</span> |
| <span class="keyword">public</span><span class="special">:</span> |
| <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span> |
| <span class="keyword">typedef</span> <span class="identifier">Policy</span> <span class="identifier">policy_type</span><span class="special">;</span> |
| <span class="comment">// Constructor from two shape parameters, alpha & beta: |
| </span> <span class="identifier">beta_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">b</span><span class="special">);</span> |
| |
| <span class="comment">// Parameter accessors: |
| </span> <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> |
| <span class="identifier">RealType</span> <span class="identifier">beta</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> |
| |
| <span class="comment">// Parameter estimators of alpha or beta from mean and variance. |
| </span> <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_alpha</span><span class="special">(</span> |
| <span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">,</span> <span class="comment">// Expected value of mean. |
| </span> <span class="identifier">RealType</span> <span class="identifier">variance</span><span class="special">);</span> <span class="comment">// Expected value of variance. |
| </span> |
| <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_beta</span><span class="special">(</span> |
| <span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">,</span> <span class="comment">// Expected value of mean. |
| </span> <span class="identifier">RealType</span> <span class="identifier">variance</span><span class="special">);</span> <span class="comment">// Expected value of variance. |
| </span> |
| <span class="comment">// Parameter estimators from from |
| </span> <span class="comment">// either alpha or beta, and x and probability. |
| </span> |
| <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_alpha</span><span class="special">(</span> |
| <span class="identifier">RealType</span> <span class="identifier">beta</span><span class="special">,</span> <span class="comment">// from beta. |
| </span> <span class="identifier">RealType</span> <span class="identifier">x</span><span class="special">,</span> <span class="comment">// x. |
| </span> <span class="identifier">RealType</span> <span class="identifier">probability</span><span class="special">);</span> <span class="comment">// cdf |
| </span> |
| <span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_beta</span><span class="special">(</span> |
| <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="comment">// alpha. |
| </span> <span class="identifier">RealType</span> <span class="identifier">x</span><span class="special">,</span> <span class="comment">// probability x. |
| </span> <span class="identifier">RealType</span> <span class="identifier">probability</span><span class="special">);</span> <span class="comment">// probability cdf. |
| </span><span class="special">};</span> |
| |
| <span class="special">}}</span> <span class="comment">// namespaces |
| </span></pre> |
| <p> |
| The class type <code class="computeroutput"><span class="identifier">beta_distribution</span></code> |
| represents a <a href="http://en.wikipedia.org/wiki/Beta_distribution" target="_top">beta |
| </a> <a href="http://en.wikipedia.org/wiki/Probability_distribution" target="_top">probability |
| distribution function</a>. |
| </p> |
| <p> |
| The <a href="http://mathworld.wolfram.com/BetaDistribution.htm" target="_top">beta |
| distribution </a> is used as a <a href="http://en.wikipedia.org/wiki/Prior_distribution" target="_top">prior |
| distribution</a> for binomial proportions in <a href="http://mathworld.wolfram.com/BayesianAnalysis.html" target="_top">Bayesian |
| analysis</a>. |
| </p> |
| <p> |
| See also: <a href="http://documents.wolfram.com/calculationcenter/v2/Functions/ListsMatrices/Statistics/BetaDistribution.html" target="_top">beta |
| distribution</a> and <a href="http://en.wikipedia.org/wiki/Bayesian_statistics" target="_top">Bayesian |
| statistics</a>. |
| </p> |
| <p> |
| How the beta distribution is used for <a href="http://home.uchicago.edu/~grynav/bayes/ABSLec5.ppt" target="_top">Bayesian |
| analysis of one parameter models</a> is discussed by Jeff Grynaviski. |
| </p> |
| <p> |
| The <a href="http://en.wikipedia.org/wiki/Probability_density_function" target="_top">probability |
| density function PDF</a> for the <a href="http://en.wikipedia.org/wiki/Beta_distribution" target="_top">beta |
| distribution</a> defined on the interval [0,1] is given by: |
| </p> |
| <p> |
| f(x;α,β) = x<sup>α - 1</sup> (1 - x)<sup>β -1</sup> / B(α, β) |
| </p> |
| <p> |
| where B(α, β) is the <a href="http://en.wikipedia.org/wiki/Beta_function" target="_top">beta |
| function</a>, implemented in this library as <a class="link" href="../../../special/sf_beta/beta_function.html" title="Beta">beta</a>. |
| Division by the beta function ensures that the pdf is normalized to the |
| range zero to unity. |
| </p> |
| <p> |
| The following graph illustrates examples of the pdf for various values |
| of the shape parameters. Note the α = β = 2 (blue line) is dome-shaped, and |
| might be approximated by a symmetrical triangular distribution. |
| </p> |
| <p> |
| <span class="inlinemediaobject"><img src="../../../../../graphs/beta_pdf.png" align="middle"></span> |
| </p> |
| <p> |
| If α = β = 1, then it is a __space <a href="http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29" target="_top">uniform |
| distribution</a>, equal to unity in the entire interval x = 0 to |
| 1. If α __space and β __space are < 1, then the pdf is U-shaped. If α != |
| β, then the shape is asymmetric and could be approximated by a triangle |
| whose apex is away from the centre (where x = half). |
| </p> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.member_functions"></a><h5> |
| <a name="id1008471"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.member_functions">Member |
| Functions</a> |
| </h5> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.constructor"></a><h6> |
| <a name="id1008486"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.constructor">Constructor</a> |
| </h6> |
| <pre class="programlisting"><span class="identifier">beta_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">beta</span><span class="special">);</span> |
| </pre> |
| <p> |
| Constructs a beta distribution with shape parameters <span class="emphasis"><em>alpha</em></span> |
| and <span class="emphasis"><em>beta</em></span>. |
| </p> |
| <p> |
| Requires alpha,beta > 0,otherwise <a class="link" href="../../../main_overview/error_handling.html#domain_error">domain_error</a> |
| is called. Note that technically the beta distribution is defined for |
| alpha,beta >= 0, but it's not clear whether any program can actually |
| make use of that latitude or how many of the non-member functions can |
| be usefully defined in that case. Therefore for now, we regard it as |
| an error if alpha or beta is zero. |
| </p> |
| <p> |
| For example: |
| </p> |
| <pre class="programlisting"><span class="identifier">beta_distribution</span><span class="special"><></span> <span class="identifier">mybeta</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">5</span><span class="special">);</span> |
| </pre> |
| <p> |
| Constructs a the beta distribution with alpha=2 and beta=5 (shown in |
| yellow in the graph above). |
| </p> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.parameter_accessors"></a><h6> |
| <a name="id1008601"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.parameter_accessors">Parameter |
| Accessors</a> |
| </h6> |
| <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> |
| </pre> |
| <p> |
| Returns the parameter <span class="emphasis"><em>alpha</em></span> from which this distribution |
| was constructed. |
| </p> |
| <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">beta</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> |
| </pre> |
| <p> |
| Returns the parameter <span class="emphasis"><em>beta</em></span> from which this distribution |
| was constructed. |
| </p> |
| <p> |
| So for example: |
| </p> |
| <pre class="programlisting"><span class="identifier">beta_distribution</span><span class="special"><></span> <span class="identifier">mybeta</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">5</span><span class="special">);</span> |
| <span class="identifier">assert</span><span class="special">(</span><span class="identifier">mybeta</span><span class="special">.</span><span class="identifier">alpha</span><span class="special">()</span> <span class="special">==</span> <span class="number">2.</span><span class="special">);</span> <span class="comment">// mybeta.alpha() returns 2 |
| </span><span class="identifier">assert</span><span class="special">(</span><span class="identifier">mybeta</span><span class="special">.</span><span class="identifier">beta</span><span class="special">()</span> <span class="special">==</span> <span class="number">5.</span><span class="special">);</span> <span class="comment">// mybeta.beta() returns 5 |
| </span></pre> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.parameter_estimators"></a><h5> |
| <a name="id1008803"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.parameter_estimators">Parameter |
| Estimators</a> |
| </h5> |
| <p> |
| Two pairs of parameter estimators are provided. |
| </p> |
| <p> |
| One estimates either α __space or β __space from presumed-known mean and |
| variance. |
| </p> |
| <p> |
| The other pair estimates either α __space or β __space from the cdf and x. |
| </p> |
| <p> |
| It is also possible to estimate α __space and β __space from 'known' mode |
| & quantile. For example, calculators are provided by the <a href="http://www.ausvet.com.au/pprev/content.php?page=PPscript" target="_top">Pooled |
| Prevalence Calculator</a> and <a href="http://www.epi.ucdavis.edu/diagnostictests/betabuster.html" target="_top">Beta |
| Buster</a> but this is not yet implemented here. |
| </p> |
| <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_alpha</span><span class="special">(</span> |
| <span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">,</span> <span class="comment">// Expected value of mean. |
| </span> <span class="identifier">RealType</span> <span class="identifier">variance</span><span class="special">);</span> <span class="comment">// Expected value of variance. |
| </span></pre> |
| <p> |
| Returns the unique value of α ​ that corresponds to a beta distribution with |
| mean <span class="emphasis"><em>mean</em></span> and variance <span class="emphasis"><em>variance</em></span>. |
| </p> |
| <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_beta</span><span class="special">(</span> |
| <span class="identifier">RealType</span> <span class="identifier">mean</span><span class="special">,</span> <span class="comment">// Expected value of mean. |
| </span> <span class="identifier">RealType</span> <span class="identifier">variance</span><span class="special">);</span> <span class="comment">// Expected value of variance. |
| </span></pre> |
| <p> |
| Returns the unique value of β ​ that corresponds to a beta distribution with |
| mean <span class="emphasis"><em>mean</em></span> and variance <span class="emphasis"><em>variance</em></span>. |
| </p> |
| <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_alpha</span><span class="special">(</span> |
| <span class="identifier">RealType</span> <span class="identifier">beta</span><span class="special">,</span> <span class="comment">// from beta. |
| </span> <span class="identifier">RealType</span> <span class="identifier">x</span><span class="special">,</span> <span class="comment">// x. |
| </span> <span class="identifier">RealType</span> <span class="identifier">probability</span><span class="special">);</span> <span class="comment">// probability cdf |
| </span></pre> |
| <p> |
| Returns the value of α ​ that gives: <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">beta_distribution</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">>(</span><span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">beta</span><span class="special">),</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">probability</span></code>. |
| </p> |
| <pre class="programlisting"><span class="keyword">static</span> <span class="identifier">RealType</span> <span class="identifier">find_beta</span><span class="special">(</span> |
| <span class="identifier">RealType</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="comment">// alpha. |
| </span> <span class="identifier">RealType</span> <span class="identifier">x</span><span class="special">,</span> <span class="comment">// probability x. |
| </span> <span class="identifier">RealType</span> <span class="identifier">probability</span><span class="special">);</span> <span class="comment">// probability cdf. |
| </span></pre> |
| <p> |
| Returns the value of β ​ that gives: <code class="computeroutput"><span class="identifier">cdf</span><span class="special">(</span><span class="identifier">beta_distribution</span><span class="special"><</span><span class="identifier">RealType</span><span class="special">>(</span><span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">beta</span><span class="special">),</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">probability</span></code>. |
| </p> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.non_member_accessor_functions"></a><h5> |
| <a name="id1010042"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.non_member_accessor_functions">Non-member |
| Accessor Functions</a> |
| </h5> |
| <p> |
| All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member |
| accessor functions</a> that are generic to all distributions are supported: |
| <a class="link" href="../nmp.html#math.dist.cdf">Cumulative Distribution Function</a>, |
| <a class="link" href="../nmp.html#math.dist.pdf">Probability Density Function</a>, <a class="link" href="../nmp.html#math.dist.quantile">Quantile</a>, <a class="link" href="../nmp.html#math.dist.hazard">Hazard |
| Function</a>, <a class="link" href="../nmp.html#math.dist.chf">Cumulative Hazard Function</a>, |
| <a class="link" href="../nmp.html#math.dist.mean">mean</a>, <a class="link" href="../nmp.html#math.dist.median">median</a>, |
| <a class="link" href="../nmp.html#math.dist.mode">mode</a>, <a class="link" href="../nmp.html#math.dist.variance">variance</a>, |
| <a class="link" href="../nmp.html#math.dist.sd">standard deviation</a>, <a class="link" href="../nmp.html#math.dist.skewness">skewness</a>, |
| <a class="link" href="../nmp.html#math.dist.kurtosis">kurtosis</a>, <a class="link" href="../nmp.html#math.dist.kurtosis_excess">kurtosis_excess</a>, |
| <a class="link" href="../nmp.html#math.dist.range">range</a> and <a class="link" href="../nmp.html#math.dist.support">support</a>. |
| </p> |
| <p> |
| The formulae for calculating these are shown in the table below, and |
| at <a href="http://mathworld.wolfram.com/BetaDistribution.html" target="_top">Wolfram |
| Mathworld</a>. |
| </p> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.applications"></a><h5> |
| <a name="id1010144"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.applications">Applications</a> |
| </h5> |
| <p> |
| The beta distribution can be used to model events constrained to take |
| place within an interval defined by a minimum and maximum value: so it |
| is used in project management systems. |
| </p> |
| <p> |
| It is also widely used in <a href="http://en.wikipedia.org/wiki/Bayesian_inference" target="_top">Bayesian |
| statistical inference</a>. |
| </p> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.related_distributions"></a><h5> |
| <a name="id1010170"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.related_distributions">Related |
| distributions</a> |
| </h5> |
| <p> |
| The beta distribution with both α __space and β = 1 follows a <a href="http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29" target="_top">uniform |
| distribution</a>. |
| </p> |
| <p> |
| The <a href="http://en.wikipedia.org/wiki/Triangular_distribution" target="_top">triangular</a> |
| is used when less precise information is available. |
| </p> |
| <p> |
| The <a href="http://en.wikipedia.org/wiki/Binomial_distribution" target="_top">binomial |
| distribution</a> is closely related when α __space and β __space are |
| integers. |
| </p> |
| <p> |
| With integer values of α __space and β __space the distribution B(i, j) is |
| that of the j-th highest of a sample of i + j + 1 independent random |
| variables uniformly distributed between 0 and 1. The cumulative probability |
| from 0 to x is thus the probability that the j-th highest value is less |
| than x. Or it is the probability that that at least i of the random variables |
| are less than x, a probability given by summing over the <a class="link" href="binomial_dist.html" title="Binomial Distribution">Binomial |
| Distribution</a> with its p parameter set to x. |
| </p> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.accuracy"></a><h5> |
| <a name="id1010216"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.accuracy">Accuracy</a> |
| </h5> |
| <p> |
| This distribution is implemented using the <a class="link" href="../../../special/sf_beta/beta_function.html" title="Beta">beta |
| functions</a> <a class="link" href="../../../special/sf_beta/beta_function.html" title="Beta">beta</a> |
| and <a class="link" href="../../../special/sf_beta/ibeta_function.html" title="Incomplete Beta Functions">incomplete |
| beta functions</a> <a class="link" href="../../../special/sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibeta</a> |
| and <a class="link" href="../../../special/sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibetac</a>; |
| please refer to these functions for information on accuracy. |
| </p> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.implementation"></a><h5> |
| <a name="id1010261"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.implementation">Implementation</a> |
| </h5> |
| <p> |
| In the following table <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span> |
| are the parameters α ​ and β, <span class="emphasis"><em>x</em></span> is the random variable, |
| <span class="emphasis"><em>p</em></span> is the probability and <span class="emphasis"><em>q = 1-p</em></span>. |
| </p> |
| <div class="informaltable"><table class="table"> |
| <colgroup> |
| <col> |
| <col> |
| </colgroup> |
| <thead><tr> |
| <th> |
| <p> |
| Function |
| </p> |
| </th> |
| <th> |
| <p> |
| Implementation Notes |
| </p> |
| </th> |
| </tr></thead> |
| <tbody> |
| <tr> |
| <td> |
| <p> |
| pdf |
| </p> |
| </td> |
| <td> |
| <p> |
| f(x;α,β) = x<sup>α - 1</sup> (1 - x)<sup>β -1</sup> / B(α, β) |
| </p> |
| <p> |
| Implemented using <a class="link" href="../../../special/sf_beta/beta_derivative.html" title="Derivative of the Incomplete Beta Function">ibeta_derivative</a>(a, |
| b, x). |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| cdf |
| </p> |
| </td> |
| <td> |
| <p> |
| Using the incomplete beta function <a class="link" href="../../../special/sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibeta</a>(a, |
| b, x) |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| cdf complement |
| </p> |
| </td> |
| <td> |
| <p> |
| <a class="link" href="../../../special/sf_beta/ibeta_function.html" title="Incomplete Beta Functions">ibetac</a>(a, |
| b, x) |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| quantile |
| </p> |
| </td> |
| <td> |
| <p> |
| Using the inverse incomplete beta function <a class="link" href="../../../special/sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibeta_inv</a>(a, |
| b, p) |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| quantile from the complement |
| </p> |
| </td> |
| <td> |
| <p> |
| <a class="link" href="../../../special/sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibetac_inv</a>(a, |
| b, q) |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| mean |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="identifier">a</span><span class="special">/(</span><span class="identifier">a</span><span class="special">+</span><span class="identifier">b</span><span class="special">)</span></code> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| variance |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="identifier">a</span> <span class="special">*</span> |
| <span class="identifier">b</span> <span class="special">/</span> |
| <span class="special">(</span><span class="identifier">a</span><span class="special">+</span><span class="identifier">b</span><span class="special">)^</span><span class="number">2</span> |
| <span class="special">*</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">+</span> |
| <span class="identifier">b</span> <span class="special">+</span> |
| <span class="number">1</span><span class="special">)</span></code> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| mode |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="special">(</span><span class="identifier">a</span><span class="special">-</span><span class="number">1</span><span class="special">)</span> <span class="special">/</span> |
| <span class="special">(</span><span class="identifier">a</span> |
| <span class="special">+</span> <span class="identifier">b</span> |
| <span class="special">-</span> <span class="number">2</span><span class="special">)</span></code> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| skewness |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="number">2</span> <span class="special">(</span><span class="identifier">b</span><span class="special">-</span><span class="identifier">a</span><span class="special">)</span> |
| <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">a</span><span class="special">+</span><span class="identifier">b</span><span class="special">+</span><span class="number">1</span><span class="special">)/(</span><span class="identifier">a</span><span class="special">+</span><span class="identifier">b</span><span class="special">+</span><span class="number">2</span><span class="special">)</span> |
| <span class="special">*</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">a</span> |
| <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span></code> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| kurtosis excess |
| </p> |
| </td> |
| <td> |
| <p> |
| <span class="inlinemediaobject"><img src="../../../../../equations/beta_dist_kurtosis.png"></span> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| kurtosis |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="identifier">kurtosis</span> <span class="special">+</span> |
| <span class="number">3</span></code> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| parameter estimation |
| </p> |
| </td> |
| <td> |
| <p> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| alpha |
| </p> |
| <p> |
| from mean and variance |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="identifier">mean</span> <span class="special">*</span> |
| <span class="special">((</span> <span class="special">(</span><span class="identifier">mean</span> <span class="special">*</span> |
| <span class="special">(</span><span class="number">1</span> |
| <span class="special">-</span> <span class="identifier">mean</span><span class="special">))</span> <span class="special">/</span> |
| <span class="identifier">variance</span><span class="special">)-</span> |
| <span class="number">1</span><span class="special">)</span></code> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| beta |
| </p> |
| <p> |
| from mean and variance |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="special">(</span><span class="number">1</span> |
| <span class="special">-</span> <span class="identifier">mean</span><span class="special">)</span> <span class="special">*</span> |
| <span class="special">(((</span><span class="identifier">mean</span> |
| <span class="special">*</span> <span class="special">(</span><span class="number">1</span> <span class="special">-</span> |
| <span class="identifier">mean</span><span class="special">))</span> |
| <span class="special">/</span><span class="identifier">variance</span><span class="special">)-</span><span class="number">1</span><span class="special">)</span></code> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| The member functions <code class="computeroutput"><span class="identifier">find_alpha</span></code> |
| and <code class="computeroutput"><span class="identifier">find_beta</span></code> |
| </p> |
| <p> |
| from cdf and probability x |
| </p> |
| <p> |
| and <span class="bold"><strong>either</strong></span> <code class="computeroutput"><span class="identifier">alpha</span></code> |
| or <code class="computeroutput"><span class="identifier">beta</span></code> |
| </p> |
| </td> |
| <td> |
| <p> |
| Implemented in terms of the inverse incomplete beta functions |
| </p> |
| <p> |
| <a class="link" href="../../../special/sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibeta_inva</a>, |
| and <a class="link" href="../../../special/sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">ibeta_invb</a> |
| respectively. |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="identifier">find_alpha</span></code> |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="identifier">ibeta_inva</span><span class="special">(</span><span class="identifier">beta</span><span class="special">,</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">probability</span><span class="special">)</span></code> |
| </p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="identifier">find_beta</span></code> |
| </p> |
| </td> |
| <td> |
| <p> |
| <code class="computeroutput"><span class="identifier">ibeta_invb</span><span class="special">(</span><span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">probability</span><span class="special">)</span></code> |
| </p> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <a name="math_toolkit.dist.dist_ref.dists.beta_dist.references"></a><h5> |
| <a name="id1011288"></a> |
| <a class="link" href="beta_dist.html#math_toolkit.dist.dist_ref.dists.beta_dist.references">References</a> |
| </h5> |
| <p> |
| <a href="http://en.wikipedia.org/wiki/Beta_distribution" target="_top">Wikipedia |
| Beta distribution</a> |
| </p> |
| <p> |
| <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda366h.htm" target="_top">NIST |
| Exploratory Data Analysis</a> |
| </p> |
| <p> |
| <a href="http://mathworld.wolfram.com/BetaDistribution.html" target="_top">Wolfram |
| MathWorld</a> |
| </p> |
| </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 , 2007, 2008, 2009, 2010 John Maddock, Paul A. Bristow, |
| Hubert Holin, Xiaogang Zhang, Bruno Lalande, Johan Råde, Gautam Sewani and |
| Thijs van den Berg<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="bernoulli_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="binomial_dist.html"><img src="../../../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| </body> |
| </html> |