Continuous random variables
A random variable $X$ is continuous if its distribution function $F_X$ is a continuous function $\R \to [0,1]$.
A function $f$ on $\R$ is a probability density function if $f$ is non-negative, sufficiently regular (Borel measurable), and $$ \int_\R f(x)\, dx = 1. $$
Given a probability density function $f$, there is a unique probability measure $\mu$ on $\R$ (defined on the Borel $\sigma$-algebra $\mathcal B$ which is the smallest $\sigma$-algebra containing all intervals in $\R$) such that $$ \mu\big((-\infty, x]\big) = \int_{-\infty}^x f(y) \, dy,\qquad \mu(B)=\int_B f(x)\,dx = \int_\R 1_B(x)\,f(x)\,dx.$$
A random variable $X$ is absolutely continuous if there exists a probability density function $f_X$ such that its distribution function $F_X(x)$ satisfies $$ \begin{align*} F_X (x) = \int_{-\infty}^{x} f_X(y)\, dy, \quad x\in\R. \end{align*} $$ Equivalently, the distribution $\mu_X$ satisfies $$ \begin{align*} \mu_X(B) = \int_{B} f_X(x) \, dx. \end{align*} $$
We will simply say that $X$ has a density function $f_X$.
-
For a random variable $X$, it is continuous iff $\prob(X=x) = 0$ for all $x\in\R$. Proof
-
If $X$ has density function $f_X$, then $X$ is a continuous random variable, since $\prob(X=x) = \int_{\set{x}} f_X(y) \, dy = 0$.
The converse is not true: a random variable with the Cantor function as its distribution function.
-
If $F_X$ is piecewise continuously differentiable, or $f_X$ is continuous at $x$, then $$ \begin{align*} F'_X(x) = f_X(x), \qquad \int_{-\infty}^{x} f_X(y) \, dy = F_x(x). \end{align*} $$ (Derivation)
Let $X$ be a continuous random variable with piecewise continuous density function $f_X$, and $X$ takes values in $I$.
For some continuously differentiable function $\phi: I\to\R$ with $\phi'(x)\neq 0$ for any $x$, set $y=\phi(x)$ and define a new random variable $Y=\phi(X)$.
Then $Y$ has density function given by $$ \begin{align*} f_Y(y) = f_X(x) \left|\dfd xy\right|. \end{align*} $$
Let $X$ be a random variable with desnity function $f_X$ and let $g$ be a non-negative Borel function on $\R$.
Then $$ \begin{align*} \expect(g(X)) = \int_{\R} g(x) f_X(x)\, dx. \end{align*} $$ This remains valid without assuming $g$ is non-negative provided that $\expect|g(x)|<\infty$.
Let $X$ be a random variable on $\R$. The moment generating function of $X$ is the function $M_X: \R\to[0,\infty]$ given by $$ \begin{align*} M_X(\lambda) = \expect(e^{\lambda X}). \end{align*} $$
For a random variable on $\R^n$, the moment generating function $M_{\v X}: \R^n \to [0,\infty]$ given by $$ \begin{align*} M_{\v X}(\v \lambda) = \expect(e^{\v \lambda^T \v X}), \quad \v \lambda\in\R^n. \end{align*} $$ ($\v \lambda^T \v X$ is the dot product)
If $X$ takes values in $\Z^+$, then the probability generating function is related by $M_X(\lambda) = G_X(e^{\lambda})$.
For independent random variables $X,Y$, $$ \begin{align*} M_{X+Y}(\lambda) = \expect(e^{\lambda X} e^{\lambda Y}) = \expect(e^{\lambda X}) \expect(e^{\lambda Y}) = M_X(\lambda) M_Y(\lambda). \end{align*} $$
Let $X,Y$ be random variables having the same moment generating function $M$.
For $X,Y$ in $\R$, if $M(\lambda) < \infty$ for some $\lambda>0$, then $X,Y$ have the same distribution $F_X = F_Y$.
For $\v X,\v Y$ in $\R^n$, if $M(\v \lambda) < \infty$ on some open set of $\v \lambda$, then $\v X,\v Y$ have the same distribution.
A sequence of random variables $(X_n)$ converges in distribution to a random variable $X$ if $$ \begin{align*} F_{X_n}(x) \to F_X(x) \end{align*} $$ for all $x\in\R$ where $F_X$ is continuous at $x$.
Let $X,(X_n)$ be random variables. Suppose that as $n\to\R$, $M_{X_n} (\lambda) \to M_X(\lambda)$ for all $\lambda\in\R$ and $M_X(\lambda) < \infty$ for some $\lambda\neq 0$.
Then $X_n \to X$ in distribution.
Distribution $X\sim$ |
Parameters |
Values $x\in$ |
PDF $f(x)$ |
Mean $\expect(X)$ |
Variance $\var(X)$ |
MGF $M_X(t)$ |
|---|---|---|---|---|---|---|
Uniform $U[a,b]$ |
$[a,b]$ |
$[a,b]$ |
$\frac{1}{b-a}$ |
$\frac{1}{2}(a+b)$ |
$\frac{1}{12}(b-a)^2$ |
$\begin{cases} \frac{e^{bx}-e^{ax}}{t(b-a)}, &t\neq 0 \\ 1, &t=0\end{cases}$ |
Exponential $E(\lambda)$ |
$\lambda\in(0,\infty)$ |
$[0,\infty)$ |
$\lambda e^{-\lambda x}$ |
$\frac{1}{\lambda}$ |
$\frac{1}{\lambda^2}$ |
$\begin{cases} \frac{\lambda}{\lambda-t},& t<\lambda \\ \infty, &t\geq \lambda \end{cases}$ |
Gamma $\Gamma(\alpha,\lambda)$ |
$\alpha\in(0,\infty)$ |
$[0,\infty]$ |
$\frac{\lambda^{\alpha}}{\Gamma(\alpha)}x^{\alpha-1}e^{-\lambda x}$ |
$\frac{\alpha}{\lambda}$ |
$\frac{\alpha}{\lambda^2}$ |
$\begin{cases} \left(\frac{\lambda}{\lambda-t}\right)^\alpha,& t<\lambda \\ \infty, &t\geq \lambda \end{cases}$ |
Normal $N(\mu,\sigma^2)$ |
$\mu\in\R$ |
$\R$ |
$\frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)$ |
$\mu$ |
$\sigma^2$ |
$\exp(\mu t + \frac{1}{2}\sigma^2 t^2)$ |
Cauchy |
$\R$ |
$\frac{1}{\pi(1+x^2)}$ |
$\expect\textbar X\textbar = \infty$ |
$\infty$ |
$\begin{cases} \infty, &t\neq 0 \\ 1, &t=0 \end{cases}$ |
$U[a,b]$, the uniform distribution on $[a,b]$, has probability density function $$ f(x) = \frac{1}{b-a}1_{[a,b]}(x). $$
Analogue to equally likely outcomes.
-
Mean $= (a+b)/2$. (Derivation)
-
Moment generating function (Derivation) $$ \begin{align*} M_X(t) = \begin{cases} \dfrac{e^{bx} - e^{ax}}{t(b-a)}, &t\neq 0 \\ 1, &t=0. \end{cases} \end{align*} $$
$E(\lambda)$, the exponential distribution of parameter $\lambda\in(0,\infty)$, has probability density function $$ f(x) = \lambda {\color{yellow}e^{-\lambda x}},\qquad x\in[0,\infty).$$
-
Mean $= 1/\lambda$. (Derivation)
-
Exponential distribution is the limit of geometric distributions. (How?)
-
Exponential distribution is unique non-trivial distribution satisfying the memoryless property $$ \begin{align*} \prob(T > s+t | T>s) = \prob(T>t). \end{align*} $$ (Proof)
-
Moment generating function (Derivation) $$ \begin{align*} M_X(t) = \begin{cases} \dfrac{\lambda}{\lambda-t}, &t<\lambda, \\ \infty, &t\geq \lambda. \end{cases} \end{align*} $$
$\Gamma(\alpha,\lambda)$, the gamma distribution of parameter $\alpha,\lambda\in(0,\infty)$, has probability density function $$ f(x) = \frac{\lambda^\alpha}{\Gamma(\alpha)} {\color{yellow}x^{\alpha-1} e^{-\lambda x}},\qquad x\in[0,\infty) $$ where $\Gamma(\alpha) = \int_0^\infty x^{\alpha-1} e^{-x}\,dx$.
$\Gamma(1, \lambda)$ is identical to $E(\lambda)$.
-
Moment generating function (Derivation) $$ \begin{align*} M_X(t) = \begin{cases} \left(\dfrac{\lambda}{\lambda-t}\right)^\alpha, & t<\lambda, \\ \infty, & t\geq \lambda. \end{cases} \end{align*} $$
$N(\mu,\sigma^2)$, the normal distribution of mean $\mu$ and variance $\sigma^2$, has probability density function $$ f(x) = \frac{1}{\sigma\sqrt{2\pi}} \color{yellow}e^{-\frac{(x-\mu)^2}{2\sigma^2}}. $$
-
If $X\sim N(0,1)$, then $\sigma X + \mu \sim N(\mu, \sigma^2)$.
-
Mean $= \mu$, variance $= \sigma^2$. (Derivation)
-
Moment generating function (Derivation)
-
For $X\sim N(0,1)$, $$ \begin{align*} M_X(t) = e^{t^2/2}. \end{align*} $$
-
For $X\sim N(\mu, \sigma^2)$, $$ \begin{align*} M_X(t) = e^{\mu t + (\sigma t)^2/2}. \end{align*} $$
-
The Cauchy distribution has probability density function $$ \begin{align*} f(x) = \frac{1}{\pi(1+x^2)} \end{align*} $$
-
Mean $= \infty$.
-
Moment generating function $M_X(0) = 1$ and $\infty$ elsewhere.
We say a random variable $\v X = (X_1, \ldots, X_n)$ in $\R^n$ has probability density function $f_{\v X}$ if for all $x_1, \ldots, x_n\in\R$, $$ \begin{align*} F_{\v X}(x_1, \ldots, x_n) \equiv \prob(X_1\leq x_1, \ldots, X_n\leq x_n) = \int_{-\infty}^{x_1} \ldots \int_{-\infty}^{x_n} f_{\v X}(\v x) \, dx \end{align*} $$ Equivalently for all Borel set $B$, $$ \begin{align*} \prob(\v X\in B) = \int_{B} f_{\v X}(\v x) \, dx. \end{align*} $$ Also equivalently for all non-negative Borel function $g$, $$ \begin{align*} \expect(g(\v X)) = \int_{\R^n} g(\v x) f_{\v X}(\v x) \, dx. \end{align*} $$
Suppose $\v X=(X_1, X_2, \ldots, X_n)$ is a random variable in $\R^n$ having density function $f_{\v X}$. Then each $X_i$ has a density function $f_{X_i}$ called marginal density function given by $$ \begin{align*} f_{X_i}(x_i) = \int_{\R^{n-1}} f_X(x_1, x_2, \ldots, x_n) \, \prod_{j\neq i} dx_j. \end{align*} $$
Let $\v X=(X_1, \ldots, X_n)$ be a random variable in $\R^n$, and $f_1, \ldots, f_n$ be density functions.
$X_1, \ldots X_n$ are independent and have marginal density functions $f_1, \ldots, f_n$ iff $X$ has density function $f_X$ given by $$ \begin{align*} f_{\v X}(x) = \prod_{i=1}^{n} f_i(x_i). \end{align*} $$
Let $X,Y$ be independent random variables in $\R$ with density functions $f_X, f_Y$.
Then $Z=X+Y$ has a density function given by the convolution $$ \begin{align*} f_Z(z) = f_X * f_Y(z) \equiv \int_{\R} f_X(z-y) f_Y(y) \, dy. \end{align*} $$
Let $\v X$ be a random variable in $\R^n$ taking values and having a density function $f_{\v X}$ in an open set $D$. Let $\v\phi$ maps $D$ bijectively to $\v\phi(D) \subseteq \R^n$ and suppose $\v\phi$ has a continuous derivative (Jacobian matrix $\v\phi'$) with $\v\phi'(x) \neq 0$.
Set $\v y=\v \phi(x)$ and define a new random variable $\v Y=\v \phi(X)$. Then $\v Y$ has a density function in $\v \phi(D)$ given by $$ \begin{align*} f_{\v Y}(\v y) = f_{\v X}(\v x)\,|J| \end{align*} $$ where $J$ is the Jacobian $$ \begin{align*} J = \det\left(\pdfd{x_i}{y_j}\right) = \left(\det\left(\pdfd{y_i}{x_j}\right)\right)\inv. \end{align*} $$
A random variable $X$ in $\R$ is Gaussian if $X=\sigma Z+\mu$ for some $\mu\in\R, \sigma\in[0,\infty)$ and $Z\sim N(0,1)$, i.e. the probability distribution function is $$ \begin{align*} f_Z(z) = \frac{1}{\sqrt{2\pi}} e^{-z^2/2}. \end{align*} $$ Then we write $X\sim N(\mu, \sigma^2)$.
For $n\geq 2$, a random variable $\v X$ in $\R^n$ is Gaussian if $\v u^T \v X \equiv \sum_{i=1}^{n} u_i X_i$ is Gaussian for all $\v u\in\R^n$.
For a Guassian random variable $\v X$ in $\R^n$, for any $m\times n$ matrix $\matr a$ and vector $\v b\in\R^m$, the random variable $\v Y = \matr a\v X + \v b$ is also Gaussian. (Proof)
For a Gaussian random variable $\v X$ in $\R^n$, suppose it has mean $\v \mu = \expect(\v X)$ and variance $\matr V = \op{var}(\v X) = \left(\op{cov}(X_i, X_j)\right)_{i,j=1}^n$.
For all $\v u\in\R^n$, the random variable $\v u^T \v X \sim N(\v u^T \v \mu, \v u^T V \v u)$. (Derivation) Note that $\v u^T \matr V \v u \geq 0$ so $\matr V$ is non-negative definite.
Therefore the generating function is $$ \begin{align*} M_{\v X}(\v\lambda) = \expect(e^{\v\lambda^T \v X}) = e^{\v \lambda^T \v \mu + \frac{1}{2}\v \lambda^T \matr V\v \lambda}. \end{align*} $$ Hence the distribution of $\v X$ is uniquely determined by $\v \mu$ and $\matr V$. So we write $\v X\sim N(\v \mu, \matr V)$.
To construct $\v Z\sim N(0, I_n)$ where $I_n$ is the $n\times n$ identity matrix, take $Z_1, \ldots, Z_n$ independent $N(0,1)$ random variables and set $\v Z = (Z_1, \ldots, Z_n)$. (Proof)
Generally to construct $\v X\sim N(\v \mu, \matr V)$, we define $\v X=\matr \sigma \v Z + \v \mu$ where $\matr \sigma = \sqrt{\matr V}$. $\v X$ is then Gaussian, $\expect(\v X) = \v \mu$, and $$\op{var}(\v X) = \expect((\matr \sigma \v Z)(\matr \sigma \v Z)^T) = \matr \sigma\op{var}(\v Z)\matr \sigma^T = \matr \sigma I_n \matr \sigma^T = \matr V.$$ Hence $\v X \sim N(\v\mu,\matr V)$.
(What is $\sqrt{\matr V}$: since $\matr V$ is symmetric, $\matr V$ is diagonalisable by an orthogonal matrix $\matr U$. Also since $\matr V$ is non-negative definite, $\matr V$ has eigenvalues $\lambda_1, \ldots, \lambda_n \geq 0$. $$ \begin{align*} \matr V &= \matr U\matr \Lambda \matr U^T, & \quad \matr \Lambda &= \op{diag}(\lambda_1, \ldots, \lambda_n). \\ \text{Set } \matr \sigma &= \matr U\sqrt{\matr \Lambda} \matr U^T, &\sqrt{\matr \Lambda} &= \op{diag}(\sqrt{\lambda_1}, \ldots, \sqrt{\lambda_n}) \end{align*} $$ so we have $\matr \sigma\matr \sigma^T = \matr V$.)
For positive definite variance $\matr V$ (equivalently $\matr V$ is invertible), the density function of $\v X\sim N(\v \mu, \matr V)$ is $$ \begin{align*} f_\v X(\v x) = \frac{\exp\left(-\frac{1}{2} (\v x-\v \mu)^T \matr V\inv (\v x-\v \mu)\right)}{\sqrt{(2\pi)^n \det \matr V}}. \end{align*} $$ (Derivation)
If $\matr V$ is not invertible, then $\matr U$ can be choosen so that $\matr U\v X \sim N(\matr U\v\mu, \matr U\matr V\matr U^T)$ with $$ \begin{align*} \matr U\matr V\matr U^T = \op{diag}(\lambda_1, \lambda_2, \ldots, \lambda_k, 0, \ldots, 0) \equiv \pmat{\matr V_0 & \matr 0 \\ \matr 0 & \matr 0}. \end{align*} $$ where $\matr V_0$ is positive definite. Then we can construct $$ \begin{align*} \v X = \v \mu + \matr U^T \pmat{\v Y\\\v 0}, \quad \v Y = \sqrt{\matr V_0}\pmat{z_1 \\ z_2 \\ \vdots \\ z_k} \end{align*} $$ and $\v Y$ has density $$ \begin{align*} f_\v Y(\v y) = \frac{\exp\left(-\frac{1}{2} \v y^T \matr V_0\inv \v y\right)}{\sqrt{(2\pi)^n\det \matr V_0}} \end{align*} $$
Let $\v X$ be a non-degenerate normal random variable in $\R^2$, i.e. $\matr V=\var(\v X)$ is invertible. $\v X$ is uniquely determined by each $(\mu_1, \mu_2, \sigma_1^2, \sigma_2^2, \rho) \in \R^2\times (0,\infty)^2 \times (-1, 1)$, where $\mu_i = \expect(X_i), \sigma_i^2 = \expect(X_i), \rho = \op{corr}(X_1,X_2)$. (Proof)
If $\op{corr}(X_1, X_2)=0$, then $X_1, X_2$ are independent. (Proof) For a general $\rho$, we can write $$ \begin{align*} X_2 = aX_1 + Y \end{align*} $$ where $Y$ is normal and independent of $X_1$, and $a = \rho\sigma_2/\sigma_1$. (Derivation)
We have access to a sequence of independent $U[0,1]$ random variables $U_1, U_2, \ldots, U_n$, and we want to simulate independent random variables $(X_1, X_2, \ldots, X_n)$ having a given distribution.
Suppose our desired density function is $f$ in an open interval $I$. Then the distribution function $F(x) = \int_{-\infty}^{x} f(y) dy$ is an increasing map from $I$ to $(0,1)$. Let the quantile function be $$ \begin{align*} G(u) = \inf\sb{x\in\R}{u\leq F(x)}. \end{align*} $$ (When $f$ is positive everywhere, $G=F\inv$.) Note that for all $x\in\R, u\in(0,1)$, $$ \begin{align*} G(u) \leq x \iff u \leq F(x). \end{align*} $$ Then when we have $U\sim U[0,1]$ and let $X=G(U)$, we have $$ \begin{align*} \prob(X\leq x) = \prob(G(U)\leq x) = \prob(U\leq F(x)) = F(x) \end{align*} $$ so $X$ has a distribution function $F_X$.
To simulate $X\sim N(0,1)$, we take $U,V\sim U[0,1]$ and set $$ \begin{align*} \Theta = 2\pi U, \quad R = \sqrt{-2\log V} \implies V = e^{-R^2/2}, \quad \Theta\sim U[0,2\pi]. \end{align*} $$ Then $X=R\cos\Theta$ and $Y=R\sin\Theta$ are independent $N(0,1)$ random variables. (Derivation)
To simulate $\v U\sim U([0,1]^d)$, we take $\v U = (\bar U_1, \bar U_2, \ldots, \bar U_d)$ where $\bar U_i \sim U[0,1]$ are independent.
For some $A\subseteq [0,1]^d$, to simulate a random variable $\v X$ in $[0,1]^d$ having density $$ \begin{align*} f(\v x) = \frac{1_A(\v x)}{|A|}, \end{align*} $$ take $\v U_1,\v U_2,\ldots$ independent $U([0,1]^d)$ random variables and $\v X$ to be the first of those which land in $A$, i.e. reject the others: $$ \begin{align*} \v X = \v U_N, \quad N=\min\sb{n\geq 1}{\v U_n \in A}. \end{align*} $$ (Derivation)
In general to simulate $\v X$ having a bounded density $f$ in $[0,1]^d$, let $f(\v x)\leq \lambda$ for all $\v x$. We'll apply the same technique as above to $[0,1]^{d+1}$:
Take $\v U_1, \v U_2, \ldots \sim U([0,1]^d)$ and $V_1,V_2,\ldots\sim U[0,1]$ all independent random variables, and $\v X$ to be the the first $\v U_n$ such that $V_n\leq f(\v U_n)/\lambda$: $$ \begin{align*} \v X = \v U_n, \quad N = \min\sb{n\geq 1}{V_n \leq f(\v U_n)/\lambda}. \end{align*} $$ (Derivation)
https://www.geogebra.org/calculator/gtjdw2kc
See the general formulation.