Skip to content

Commit 1bfc4f4

Browse files
authored
added 3 proofs
1 parent ed67956 commit 1bfc4f4

3 files changed

Lines changed: 257 additions & 0 deletions

File tree

P/beta-cdf.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2020-11-19 08:01:00
9+
10+
title: "Cumulative distribution function of the beta distribution"
11+
chapter: "Probability Distributions"
12+
section: "Univariate continuous distributions"
13+
topic: "Beta distribution"
14+
theorem: "Cumulative distribution function"
15+
16+
sources:
17+
- authors: "Wikipedia"
18+
year: 2020
19+
title: "Beta function"
20+
in: "Wikipedia, the free encyclopedia"
21+
pages: "retrieved on 2020-11-19"
22+
url: "https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function"
23+
24+
proof_id: "P195"
25+
shortcut: "beta-cdf"
26+
username: "JoramSoch"
27+
---
28+
29+
30+
**Theorem:** Let $X$ be a positive [random variable](/D/rvar) following a [beta distribution](/D/gam):
31+
32+
$$ \label{eq:beta}
33+
X \sim \mathrm{Bet}(\alpha, \beta) \; .
34+
$$
35+
36+
Then, the [cumulative distribution function](/D/cdf) of $X$ is
37+
38+
$$ \label{eq:beta-cdf}
39+
F_X(x) = \frac{B(x; \alpha, \beta)}{B(\alpha, \beta)}
40+
$$
41+
42+
where $B(a,b)$ is the beta function and $B(x;a,b)$ is the incomplete gamma function.
43+
44+
45+
**Proof:** The [probability density function of the beta distribution](/P/beta-pdf) is:
46+
47+
$$ \label{eq:beta-pdf}
48+
f_X(x) = \frac{1}{\mathrm{B}(\alpha, \beta)} \, x^{\alpha-1} \, (1-x)^{\beta-1} \; .
49+
$$
50+
51+
Thus, the [cumulative distribution function](/D/cdf) is:
52+
53+
$$ \label{eq:beta-cdf-app}
54+
\begin{split}
55+
F_X(x) &= \int_{0}^{x} \mathrm{Bet}(z; \alpha, \beta) \, \mathrm{d}z \\
56+
&= \int_{0}^{x} \frac{1}{\mathrm{B}(\alpha, \beta)} \, z^{\alpha-1} \, (1-z)^{\beta-1} \, \mathrm{d}z \\
57+
&= \frac{1}{B(x;a,b)} \int_{0}^{x} z^{\alpha-1} \, (1-z)^{\beta-1} \, \mathrm{d}z \; .
58+
\end{split}
59+
$$
60+
61+
With the definition of the incomplete beta function
62+
63+
$$ \label{eq:inc-beta-fct}
64+
B(x;a,b) = \int_{0}^{x} t^{a-1} \, (1-t)^{b-1} \, \mathrm{d}t \; ,
65+
$$
66+
67+
we arrive at the final result given by equation \eqref{eq:beta-cdf}:
68+
69+
$$ \label{eq:beta-cdf-qed}
70+
F_X(x) = \frac{B(x; \alpha, \beta)}{B(\alpha, \beta)} \; .
71+
$$

P/gam-qf.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2020-11-19 07:31:00
9+
10+
title: "Quantile function of the gamma distribution"
11+
chapter: "Probability Distributions"
12+
section: "Univariate continuous distributions"
13+
topic: "Gamma distribution"
14+
theorem: "Quantile function"
15+
16+
sources:
17+
- authors: "Wikipedia"
18+
year: 2020
19+
title: "Incomplete gamma function"
20+
in: "Wikipedia, the free encyclopedia"
21+
pages: "retrieved on 2020-11-19"
22+
url: "https://en.wikipedia.org/wiki/Incomplete_gamma_function#Definition"
23+
24+
proof_id: "P194"
25+
shortcut: "gam-qf"
26+
username: "JoramSoch"
27+
---
28+
29+
30+
**Theorem:** Let $X$ be a [random variable](/D/rvar) following a [gamma distribution](/D/gam):
31+
32+
$$ \label{eq:gam}
33+
X \sim \mathrm{Gam}(a,b) \; .
34+
$$
35+
36+
Then, the [quantile function](/D/qf) of $X$ is
37+
38+
$$ \label{eq:gam-qf}
39+
Q_X(p) = \left\{
40+
\begin{array}{rl}
41+
-\infty \; , & \text{if} \; p = 0 \\
42+
\gamma^{-1}(a, \Gamma(a) \cdot p)/b \; , & \text{if} \; p > 0
43+
\end{array}
44+
\right.
45+
$$
46+
47+
where $\gamma^{-1}(s, y)$ is the inverse of the lower incomplete gamma function $\gamma(s, x)$
48+
49+
50+
**Proof:** The [cumulative distribution function of the gamma distribution](/P/gam-cdf) is:
51+
52+
$$ \label{eq:gam-cdf}
53+
F_X(x) = \left\{
54+
\begin{array}{rl}
55+
0 \; , & \text{if} \; x < 0 \\
56+
\frac{\gamma(a,bx)}{\Gamma(a)} \; , & \text{if} \; x \geq 0 \; .
57+
\end{array}
58+
\right.
59+
$$
60+
61+
The quantile function $Q_X(p)$ [is defined as](/D/qf) the smallest $x$, such that $F_X(x) = p$:
62+
63+
$$ \label{eq:qf}
64+
Q_X(p) = \min \left\lbrace x \in \mathbb{R} \, \vert \, F_X(x) = p \right\rbrace \; .
65+
$$
66+
67+
Thus, we have $Q_X(p) = -\infty$, if $p = 0$. When $p > 0$, [it holds that](/P/qf-cdf)
68+
69+
$$ \label{eq:gam-qf-s1}
70+
Q_X(p) = F_X^{-1}(x) \; .
71+
$$
72+
73+
This can be derived by rearranging equation \eqref{eq:gam-cdf}:
74+
75+
$$ \label{eq:gam-qf-s2}
76+
\begin{split}
77+
p &= \frac{\gamma(a,bx)}{\Gamma(a)} \\
78+
\Gamma(a) \cdot p &= \gamma(a,bx) \\
79+
\gamma^{-1}(a, \Gamma(a) \cdot p) &= bx \\
80+
x &= \frac{\gamma^{-1}(a, \Gamma(a) \cdot p)}{b} \; .
81+
\end{split}
82+
$$

P/norm-kl.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2020-11-19 07:08:00
9+
10+
title: "Kullback-Leibler divergence for the normal distribution"
11+
chapter: "Probability Distributions"
12+
section: "Univariate continuous distributions"
13+
topic: "Normal distribution"
14+
theorem: "Kullback-Leibler divergence"
15+
16+
sources:
17+
18+
proof_id: "P193"
19+
shortcut: "norm-kl"
20+
username: "JoramSoch"
21+
---
22+
23+
24+
**Theorem:** Let $X$ be a [random variable](/D/rvar). Assume two [normal distributions](/D/norm) $P$ and $Q$ specifying the probability distribution of $X$ as
25+
26+
$$ \label{eq:norms}
27+
\begin{split}
28+
P: \; X &\sim \mathrm{Gam}(\mu_1, \sigma_1^2) \\
29+
Q: \; X &\sim \mathrm{Gam}(\mu_2, \sigma_2^2) \; . \\
30+
\end{split}
31+
$$
32+
33+
Then, the [Kullback-Leibler divergence](/D/kl) of $P$ from $Q$ is given by
34+
35+
$$ \label{eq:norm-KL}
36+
\mathrm{KL}[P\,||\,Q] = \frac{1}{2} \left[ \frac{(\mu_2 - \mu_1)^2}{\sigma_2^2} + \frac{\sigma_1^2}{\sigma_2^2} - \ln \frac{\sigma_1^2}{\sigma_2^2} - 1 \right] \; .
37+
$$
38+
39+
40+
**Proof:** The [KL divergence for a continuous random variable](/D/kl) is given by
41+
42+
$$ \label{eq:KL-cont}
43+
\mathrm{KL}[P\,||\,Q] = \int_{\mathcal{X}} p(x) \, \ln \frac{p(x)}{q(x)} \, \mathrm{d}x
44+
$$
45+
46+
which, applied to the [normal distributions](/D/norm) in \eqref{eq:norms}, yields
47+
48+
$$ \label{eq:norm-KL-s1}
49+
\begin{split}
50+
\mathrm{KL}[P\,||\,Q] &= \int_{-\infty}^{+\infty} \mathcal{N}(x; \mu_1, \sigma_1^2) \, \ln \frac{\mathcal{N}(x; \mu_1, \sigma_1^2)}{\mathcal{N}(x; \mu_2, \sigma_2^2)} \, \mathrm{d}x \\
51+
&= \left\langle \ln \frac{\mathcal{N}(x; \mu_1, \sigma_1^2)}{\mathcal{N}(x; \mu_2, \sigma_2^2)} \right\rangle_{p(x)} \; .
52+
\end{split}
53+
$$
54+
55+
Using the [probability density function of the normal distribution](/P/norm-pdf), this becomes:
56+
57+
$$ \label{eq:norm-KL-s2}
58+
\begin{split}
59+
\mathrm{KL}[P\,||\,Q] &= \left\langle \ln \frac{ \frac{1}{\sqrt{2 \pi} \sigma_1} \cdot \exp \left[ -\frac{1}{2} \left( \frac{x-\mu_1}{\sigma_1} \right)^2 \right] }{ \frac{1}{\sqrt{2 \pi} \sigma_2} \cdot \exp \left[ -\frac{1}{2} \left( \frac{x-\mu_2}{\sigma_2} \right)^2 \right] } \right\rangle_{p(x)} \\
60+
&= \left\langle \ln \left( \sqrt \frac{\sigma_2^2}{\sigma_1^2} \cdot \exp\left[ -\frac{1}{2} \left( \frac{x-\mu_1}{\sigma_1} \right)^2 + \frac{1}{2} \left( \frac{x-\mu_2}{\sigma_2} \right)^2 \right] \right) \right\rangle_{p(x)} \\
61+
&= \left\langle \frac{1}{2} \ln \frac{\sigma_2^2}{\sigma_1^2} -\frac{1}{2} \left( \frac{x-\mu_1}{\sigma_1} \right)^2 + \frac{1}{2} \left( \frac{x-\mu_2}{\sigma_2} \right)^2 \right\rangle_{p(x)} \\
62+
&= \frac{1}{2} \left\langle - \left( \frac{x-\mu_1}{\sigma_1} \right)^2 + \left( \frac{x-\mu_2}{\sigma_2} \right)^2 - \ln \frac{\sigma_1^2}{\sigma_2^2} \right\rangle_{p(x)} \\
63+
&= \frac{1}{2} \left\langle - \frac{(x-\mu_1)^2}{\sigma_1^2} + \frac{x^2 - 2 \mu_2 x + \mu_2^2}{\sigma_2^2} - \ln \frac{\sigma_1^2}{\sigma_2^2} \right\rangle_{p(x)} \; .
64+
\end{split}
65+
$$
66+
67+
Because trace function and [expected value](/D/mean) are both linear operators, the expectation can be moved inside the trace:
68+
69+
$$ \label{eq:norm-KL-s3}
70+
\begin{split}
71+
\mathrm{KL}[P\,||\,Q] &= \frac{1}{2} \left[ - \frac{\left\langle (x-\mu_1)^2 \right\rangle}{\sigma_1^2} + \frac{\left\langle x^2 - 2 \mu_2 x + \mu_2^2 \right\rangle}{\sigma_2^2} - \left\langle \ln \frac{\sigma_1^2}{\sigma_2^2} \right\rangle \right] \\
72+
&= \frac{1}{2} \left[ - \frac{\left\langle (x-\mu_1)^2 \right\rangle}{\sigma_1^2} + \frac{\left\langle x^2 \right\rangle - \left\langle 2 \mu_2 x \right\rangle + \left\langle \mu_2^2 \right\rangle}{\sigma_2^2} - \ln \frac{\sigma_1^2}{\sigma_2^2} \right] \; .
73+
\end{split}
74+
$$
75+
76+
The first expectation corresponds to the [variance](/D/var)
77+
78+
$$ \label{eq:var}
79+
\left\langle (X-\mu)^2 \right\rangle = \mathrm{E}[(X-\mathrm{E}(X))^2] = \mathrm{Var}(X)
80+
$$
81+
82+
and the [variance of a normally distributed random variable](/P/norm-var) is
83+
84+
$$ \label{eq:norm-var}
85+
X \sim \mathcal{N}(\mu, \sigma^2) \quad \Rightarrow \quad \mathrm{Var}(X) = \sigma^2 \; .
86+
$$
87+
88+
Additionally applying the [raw moments of the normal distribution](/P/norm-mgf)
89+
90+
$$ \label{eq:norm-mom-raw}
91+
X \sim \mathcal{N}(\mu, \sigma^2) \quad \Rightarrow \quad \left\langle x \right\rangle = \mu \quad \text{and} \quad \left\langle x^2 \right\rangle = \mu^2 + \sigma^2 \; ,
92+
$$
93+
94+
the Kullback-Leibler divergence in \eqref{eq:norm-KL-s3} becomes
95+
96+
$$ \label{eq:norm-KL-s4}
97+
\begin{split}
98+
\mathrm{KL}[P\,||\,Q] &= \frac{1}{2} \left[ - \frac{\sigma_1^2}{\sigma_1^2} + \frac{\mu_1^2 + \sigma_1^2 - 2 \mu_2 \mu_1 + \mu_2^2}{\sigma_2^2} - \ln \frac{\sigma_1^2}{\sigma_2^2} \right] \\
99+
&= \frac{1}{2} \left[ \frac{\mu_1^2 - 2 \mu_1 \mu_2 + \mu_2^2}{\sigma_2^2} + \frac{\sigma_1^2}{\sigma_2^2} - \ln \frac{\sigma_1^2}{\sigma_2^2} - 1 \right] \\
100+
&= \frac{1}{2} \left[ \frac{(\mu_1 - \mu_2)^2}{\sigma_2^2} + \frac{\sigma_1^2}{\sigma_2^2} - \ln \frac{\sigma_1^2}{\sigma_2^2} - 1 \right]
101+
\end{split}
102+
$$
103+
104+
which is equivalent to \eqref{eq:norm-KL}.

0 commit comments

Comments
 (0)