BETALN Function (LibreOffice Calc)
The BETALN function returns the natural logarithm of the beta function. It is used for numerical stability in statistical modeling, Bayesian inference, and probability calculations involving large or extreme parameters.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✖ |
| Libreoffice | ✔ |
| Numbers | ✖ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the BETALN Function Does ▾
- Computes ln(Beta(α, β))
- Provides stable results for large α and β
- Avoids overflow/underflow common in direct beta calculations
- Used in Bayesian modeling, log‑likelihoods, and statistical inference
Syntax ▾
BETALN(alpha; beta)
Arguments
-
alpha:
Shape parameter α (must be > 0). -
beta:
Shape parameter β (must be > 0).
Basic Examples ▾
Log beta function
=BETALN(2; 5)
Using cell references
=BETALN(A1; B1)
Compare with BETA using exponentiation
=EXP(BETALN(α; β))
Advanced Examples ▾
Bayesian log‑posterior calculations
=k*LN(p) + (n-k)*LN(1-p) - BETALN(k+1; n-k+1)
Log‑likelihood for binomial‑beta model
=LN(COMBIN(n; k)) + BETALN(k+α; n-k+β) - BETALN(α; β)
Stable computation of beta PDF
=EXP((α-1)*LN(x) + (β-1)*LN(1-x) - BETALN(α; β))
Stable computation of beta-binomial PMF
=EXP(LN(COMBIN(n; k)) + BETALN(k+α; n-k+β) - BETALN(α; β))
Use with GAMMALN identity
=GAMMALN(α) + GAMMALN(β) - GAMMALN(α+β)
Edge Cases and Behavior Details ▾
BETALN returns a real number (logarithmic value)
Accepts:
- α > 0
- β > 0
Behavior details
- Always returns a finite real number
- More stable than computing LN(BETA())
- Ideal for large α, β, or extreme distributions
- Based on the gamma‑function identity:
ln(Beta(α, β)) = ln(Γ(α)) + ln(Γ(β)) − ln(Γ(α+β))
Invalid input → Err:502
BETALN of an error → error propagates
Common Errors and Fixes ▾
Err:502 — Invalid argument
Cause:
- α ≤ 0 or β ≤ 0
- Non-numeric input
Fix:
- Validate α and β
- Convert text with VALUE
Overflow in related calculations
Cause:
- Using BETA instead of BETALN for large parameters
Fix:
- Use BETALN for log‑space calculations
Best Practices ▾
- Use BETALN for stable statistical calculations
- Prefer log‑space formulas for large α/β
- Use BETA only for small, well‑behaved parameters
- Combine with GAMMALN for advanced modeling
- Use EXP() only when necessary to convert back to standard scale
BETALN is the backbone of stable Bayesian and statistical modeling — essential whenever α and β grow large or precision matters.
Related Patterns and Alternatives ▾
- Use BETA for the beta PDF
- Use BETADIST for the cumulative distribution
- Use BETAINV for quantiles
- Use GAMMALN for stable gamma‑function calculations
- Use FACTLN for log‑factorials
By mastering BETALN, you can build robust, numerically stable statistical and Bayesian models in LibreOffice Calc.