---
title: "Beta distribution"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Distributions-Beta}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

<!--
%\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Distributions-Beta}
\usepackage{amsmath,amssymb}
-->


<!--Beta distribution-->
========================================================

Probability density function:
-------------------------
$$f(x) = \frac{x^{\alpha-1}(1-x)^{\beta-1}} {\mathcal{B}(\alpha,\beta)}$$
with $\alpha$ and $\beta$ two shape parameters and $\mathcal B$ beta function.

<!--
```
Mathematica Code: 
(x^(alpha-1) (1-x)^(beta-1))/(beta(alpha, beta))
```
-->

Cumulative distribution function:
-------------------------
$$F(x) = \frac{\int_{0}^{x} y^{\alpha-1}(1-y)^{\beta-1}dy} {\mathcal{B}(\alpha,\beta)}
=\mathcal{B}(x; \alpha,\beta)$$
with $\mathcal B (x; \alpha,\beta)$ incomplete beta function.

<!--
```
Mathematica Code: 
Integrate[(x^(alpha-1) (1-x)^(beta-1))/(beta(alpha, beta)),{x,0,y}]
```
-->

Log-likelihood function:
-------------------------
$$L(\alpha,\beta;X)=\sum_i\left[ (\alpha-1)\ln(x)+(\beta-1)\ln(1-x)-\ln \mathcal{B}(\alpha,\beta) \right]$$

<!--
```
Mathematica Code: 
(alpha-1)log(x)+(beta-1)log(1-x)-log(beta(alpha,beta))
```
-->

Score function vector:
-------------------------
$$V(\mu,\sigma;X)
    =\left( \begin{array}{c}
    \frac{\partial L}{\partial \alpha}  \\
    \frac{\partial L}{\partial \beta}
    \end{array} \right)
    =\sum_i
    \left( \begin{array}{c}
    \psi^{(0)}(\alpha+\beta)-\psi^{(0)}(\alpha)+\ln(x) \\
    \psi^{(0)}(\alpha+\beta)-\psi^{(0)}(\beta)+\ln(x) 
    \end{array} \right)
    $$
with $\psi^{(0)}$ being log-gamma function.

<!--
```
Mathematica Code: 
D[(alpha-1)log(x)+(beta-1)log(1-x)-log(beta(alpha,beta)),alpha]
D[(alpha-1)log(x)+(beta-1)log(1-x)-log(beta(alpha,beta)),beta]
```
-->

Observed information matrix:
-------------------------
$$\mathcal J (\mu,\sigma;X)=
    \left( \begin{array}{cc}
    \psi^{(1)}(\alpha)-\psi^{(1)}(\alpha+\beta) & -\psi^{(1)}(\alpha+\beta) \\
    -\psi^{(1)}(\alpha+\beta) & \psi^{(1)}(\beta)-\psi^{(1)}(\alpha+\beta) \end{array} \right)
    $$
with $\psi^{(1)}$ being digamma function.

<!--
```
Mathematica Code: 
-D[D[(alpha-1)log(x)+(beta-1)log(1-x)-log(beta(alpha,beta)),alpha],alpha]
-D[D[(alpha-1)log(x)+(beta-1)log(1-x)-log(beta(alpha,beta)),alpha],beta]
-D[D[(alpha-1)log(x)+(beta-1)log(1-x)-log(beta(alpha,beta)),beta],beta]
```
-->


