Description Usage Arguments Details Value References See Also Examples
Underflow-robust implementation of the natural logarithm of the multivariate Beta function.
1 | lmbeta(x)
|
x |
A numeric vector of non-negative values. |
Consider the numeric vector \mjeqnx = (x_1, ..., x_k)x = (x_1, ..., x_k) with \mjeqnx_i > 0 \, \forall i \in \lbrace 1, ..., k \rbracex_i > 0 for all i in {1, ..., k }. The multivariate Beta function is defined as:
\mjdeqn\operatornameB(x) = \prod_i=1^k \Gamma (x_i) \Big/ \Gamma \left(\sum_i=1^k x_i \right)B(x) = product_i=1^k Gamma(x_i) / Gamma(sum_i=1^k x_i)
where \mjeqn\GammaGamma is the Gamma function. Taking the natural logarithm of both sides in the latter equation we obtain:
\mjdeqn\operatornamelog \operatornameB(x) = \sum_i=1^k\operatornamelog \, \Gamma(x_i) - \operatornamelog \, \Gamma \left(\sum_i = 1^kx_i\right)log B(x) = sum_i=1^klogGamma(x_i) - logGamma(sum_i = 1^k x_i)
With this formula we can take advantage of the underflow-robust lgamma
function. Note that \mjeqn\operatornameB(x)B(x) is only defined in \mjeqn\ReR if all elements of x
are greater than zero and is infinite if any element of x
is equal to zero \insertCitebecker1972polya.
If all elements of x
are greater than zero then lmbeta
returns a numeric vector of length
1. If any element of x
is equal to zero then lmbeta
returns inf
.
lmbeta
for an underflow-robust implementation of the natural logarithm of the Beta function.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.