Difference between revisions of "Documentation/How Tos/Calc: BETADIST function"
From Apache OpenOffice Wiki
< Documentation | How Tos
m (→Syntax:) |
m |
||
(14 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | __NOTOC__ | + | {{DISPLAYTITLE:BETADIST function}} |
+ | {{Documentation/CalcFunc StatisticalTOC | ||
+ | |ShowPrevNext=block | ||
+ | |PrevPage=Documentation/How_Tos/Calc:_B_function | ||
+ | |NextPage=Documentation/How_Tos/Calc:_BETAINV_function | ||
+ | }}__NOTOC__ | ||
== BETADIST == | == BETADIST == | ||
− | + | Calculates the cumulative distribution function or the probability density function of a beta distribution. | |
− | === Syntax | + | === Syntax === |
− | <tt>'''BETADIST( | + | <tt>'''BETADIST(x; α; β; a; b; cumulative)'''</tt> |
− | + | ||
− | + | 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>'''x'''</tt> is the number, at which you will evaluate the Beta distribution. | |
− | + | 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−a as ''scale''. | |
− | <tt>''' | + | |
− | + | ||
− | + | <tt>'''a'''</tt> and <tt>'''b'''</tt> are optional parameters which default (if omitted) to <tt>'''0'''</tt> and <tt>'''1'''</tt>. | |
− | + | ||
− | [[ | + | <tt>'''cumulative'''</tt> is an optional, logical 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: | ||
+ | # α > 0 , β > 0 , a < b | ||
+ | # If α < 1, then the density function has a pole at x = a. | ||
+ | # If β < 1, then 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 === | ||
+ | {| | ||
+ | |<tt>'''BETADIST(1;5;3;-2;4;FALSE())</tt> | ||
+ | : returns approximately 0.273 | ||
+ | |[[Image:BetaDistributionDensityLocationScale.png|Graphs of Beta distribution density functions using parameter a and b]] | ||
+ | |} | ||
+ | |||
+ | {| | ||
+ | |<tt>'''BETADIST(0.2;0.7;4;0;1;FALSE())</tt> | ||
+ | : returns approximately 1.644 | ||
+ | |[[Image:BetaDistributionDensityNormal.png|Graphs of Beta distribution density functions with borders 0 and 1]] | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| | ||
+ | |<tt>'''BETADIST(1;1;0.5;0;1;FALSE())</tt> | ||
+ | : returns ''Invalid argument'' because there is a pole | ||
+ | |||
+ | <tt>'''BETADIST(1.1;1;0.5;0;1;FALSE())</tt> | ||
+ | : returns 0 | ||
+ | |[[Image:BetaDistributionDensitySpecial.png|Graphs of Beta distribution density functions with alpha=1]] | ||
+ | |} | ||
+ | |||
+ | {| | ||
+ | |<tt>'''BETADIST(1;5;3;-2;4;TRUE())</tt> | ||
+ | : returns approximately 0.227 | ||
+ | call before version 3.1: <tt>'''BETADIST(1;5;3;-2;4)</tt> | ||
+ | |[[Image:BetaDistributionCumulativeLocationScale.png|Graphs of Beta distribution cumulative functions using parameter a and b]] | ||
+ | |} | ||
+ | |||
+ | {| | ||
+ | |<tt>'''BETADIST(0.2;0.7;4;0;1;TRUE())</tt> | ||
+ | : returns approximately 0.718 | ||
+ | call before version 3.1: <tt>'''BETADIST(0.2;0.7:4;0;1)</tt> | ||
+ | |||
+ | other valid call: <tt>'''BETADIST(0.2;0.7;4)</tt> | ||
+ | |[[Image:BetaDistributionCumulativeNormal.png|Graphs of Beta distribution cumulative functions with borders 0 and 1]] | ||
+ | |} | ||
+ | |||
+ | {| | ||
+ | |<tt>'''BETADIST(1.1;1;0.5;0;1;TRUE())</tt> | ||
+ | : returns 1 | ||
+ | before version 3.1: <tt>'''BETADIST(1.1;1;0.5;0;1)</tt> | ||
+ | : returns ''Invalid argument'' | ||
+ | |[[Image:BetaDistributionCumulativeSpecial.png|Graphs of Beta distribution cumulative functions with alpha=1]] | ||
+ | |} | ||
+ | |||
+ | {{SeeAlso|EN| | ||
+ | * [[Documentation/How_Tos/Calc: BETAINV function|BETAINV]] | ||
+ | |||
+ | * [[Documentation/How_Tos/Calc: Statistical functions|Statistical functions]] | ||
+ | |||
+ | * [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]] | ||
+ | * [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]] | ||
+ | }} | ||
+ | [[Category: Documentation/Reference/Calc/Statistical functions]] |