Difference between revisions of "Documentation/How Tos/Calc: BETADIST function"

From Apache OpenOffice Wiki
Jump to: navigation, search
(See also:)
Line 2: Line 2:
  
 
== BETADIST ==
 
== BETADIST ==
Calculates the cumulative distribution function of a beta distribution.  
+
Calculates the cumulative distribution function or the probability density function of a beta distribution.  
  
=== Syntax: ===
+
=== Syntax ===
<tt>'''BETADIST(n; α; β; a; b)'''</tt>
+
<tt>'''BETADIST(x; α; β; a; b; cumulative)'''</tt>
: The beta distribution is a family of continuous probability distributions, defined for an interval <tt>'''a'''</tt> to <tt>'''b'''</tt>, where <tt>'''α'''</tt> and <tt>'''β'''</tt> are parameters controlling the shape of the distribution. <tt>'''n'''</tt> lies between <tt>'''a'''</tt> and <tt>'''b'''</tt>.
+
  
: <tt>'''BETADIST'''</tt> calculates the cumulative distribution function ''F''(<tt>'''x'''</tt>; <tt>'''α'''</tt>, <tt>'''β'''</tt>) = ''I''<tt>'''<sub>x</sub>'''</tt>(<tt>'''α'''</tt>, <tt>'''β'''</tt>) where <tt>'''x'''</tt> = (<tt>'''n'''</tt>-<tt>'''a'''</tt>)/(<tt>'''b'''</tt>-<tt>'''a'''</tt>) and ''I''<tt>'''<sub>x</sub>'''</tt>(<tt>'''α'''</tt>, <tt>'''β'''</tt>) is the regularised incomplete beta function.
+
The beta distribution is a family of continuous probability distributions, where <tt>'''α'''</tt> and <tt>'''β'''</tt> are parameters controlling the shape of the distribution.
  
: <tt>'''a'''</tt> and <tt>'''b'''</tt> are optional parameters which default (if omitted) to <tt>'''0'''</tt> and <tt>'''1'''</tt>.
+
The parameters <tt>'''a'''</tt> and <tt>'''b'''</tt> are lower and upper bounds of the distribution. You can interpret the value a as ''location'' and the value b&minus;a as ''scale''.  
  
=== Example: ===
+
<tt>'''a'''</tt> and <tt>'''b'''</tt> are optional parameters which default (if omitted) to <tt>'''0'''</tt> and <tt>'''1'''</tt>.
<tt>'''BETADIST(0.75; 3; 4)'''</tt>
+
: returns approximately 0.96.
+
  
=== See also: ===
+
<tt>'''cumulative'''</tt> is an optional parameter which defaults to TRUE() if omitted.
 +
 
 +
Before OOo version 3.1 the parameter ''cumulative'' doesn't exist and only the cumulative probability function is calculated.
 +
 
 +
Constraints:
 +
# &alpha; &gt; 0 , &beta; &gt; 0 , a &lt; b
 +
# If &alpha; &lt; 1, than the density function has a pole at x = a.
 +
# If &beta; &lt; 1, than the density function has a pole at x = b.
 +
 
 +
=== Semantic ===
 +
 
 +
For <tt>'''cumulative = FALSE()'''</tt> the function BETADIST calculates the probability density function (besides the constraints given above):
 +
:<math>f(x)=
 +
\begin{cases}
 +
0, & \textrm{if}\; x < a \or x > b \\
 +
\displaystyle \frac {\Gamma(\alpha + \beta)} {\Gamma(\alpha) \Gamma(\beta)} \cdot \left( \frac {x-a} {b-a} \right)^{\alpha-1}\cdot \left(1- \frac{x-a}{b-a} \right)^{\beta-1} \cdot \frac{1}{b-a}, &  \textrm{if}\; a \le x \le b
 +
\end{cases}
 +
</math>
 +
 
 +
For <tt>'''cumulative = TRUE()'''</tt> the function BETADIST calculates the cumulative distribution function:
 +
:<math>F(x)=
 +
\begin{cases}
 +
0, & \textrm{if}\; x<a \\
 +
1, & \textrm{if}\; x>b \\
 +
\displaystyle \int_a^x \frac {\Gamma(\alpha + \beta)} {\Gamma(\alpha) \Gamma(\beta)} \cdot \left( \frac {x-a} {b-a} \right)^{\alpha-1}\cdot \left(1- \frac{x-a}{b-a} \right)^{\beta-1} \mathrm{dt}, &  \textrm{if}\; a \le x \le b
 +
\end{cases}
 +
</math>
 +
 
 +
Notice, that
 +
:<math>\displaystyle F(x)=I_z(\alpha,\beta)</math>
 +
where
 +
:<math>\displaystyle z = \frac {x-a}{b-a}</math>
 +
and <math>\scriptstyle I_z</math> is the regularized incomplete Beta function.
 +
 
 +
=== Example ===
 +
[[Image:BetaDistributionDensityLocationScale.png|Graphs of Beta distribution density functions using parameter a and b]]
 +
 
 +
<tt>'''BETADIST(1;5;3;-2;4;FALSE())</tt>
 +
: returns approximately 0.273
 +
 
 +
[[Image:BetaDistributionDensityNormal.png|Graphs of Beta distribution density functions with borders 0 and 1]]
 +
 
 +
<tt>'''BETADIST(0.2;0.7;4;0;1;FALSE())</tt>
 +
: returns approximately 1.644
 +
 
 +
[[Image:BetaDistributionDensitySpecial.png|Graphs of Beta distribution density functions with alpha=1]]
 +
 
 +
<tt>'''BETADIST(1;1;0.5;0;1;FALSE())</tt>
 +
: returns ''illegal argument'' because there is a pole
 +
 
 +
<tt>'''BETADIST(1.1;1;0.5;0;1;FALSE())</tt>
 +
: returns 0
 +
 
 +
=== See also ===
 
[[Documentation/How_Tos/Calc: BETAINV function|'''BETAINV''']]
 
[[Documentation/How_Tos/Calc: BETAINV function|'''BETAINV''']]
  

Revision as of 18:47, 6 December 2008


BETADIST

Calculates the cumulative distribution function or the probability density function of a beta distribution.

Syntax

BETADIST(x; α; β; a; b; cumulative)

The beta distribution is a family of continuous probability distributions, where α and β are parameters controlling the shape of the distribution.

The parameters a and b are lower and upper bounds of the distribution. You can interpret the value a as location and the value b−a as scale.

a and b are optional parameters which default (if omitted) to 0 and 1.

cumulative is an optional parameter which defaults to TRUE() if omitted.

Before OOo version 3.1 the parameter cumulative doesn't exist and only the cumulative probability function is calculated.

Constraints:

  1. α > 0 , β > 0 , a < b
  2. If α < 1, than the density function has a pole at x = a.
  3. If β < 1, than the density function has a pole at x = b.

Semantic

For cumulative = FALSE() the function BETADIST calculates the probability density function (besides the constraints given above):

For cumulative = TRUE() the function BETADIST calculates the cumulative distribution function:

Notice, that

where

and is the regularized incomplete Beta function.

Example

Graphs of Beta distribution density functions using parameter a and b

BETADIST(1;5;3;-2;4;FALSE())

returns approximately 0.273

Graphs of Beta distribution density functions with borders 0 and 1

BETADIST(0.2;0.7;4;0;1;FALSE())

returns approximately 1.644

Graphs of Beta distribution density functions with alpha=1

BETADIST(1;1;0.5;0;1;FALSE())

returns illegal argument because there is a pole

BETADIST(1.1;1;0.5;0;1;FALSE())

returns 0

See also

BETAINV

Statistical functions

Functions listed alphabetically, Functions listed by category

Personal tools