{
"cells": [
{
"cell_type": "markdown",
"id": "b770e9e6-f5ea-47d5-8f90-b3720ace33e5",
"metadata": {},
"source": [
"# Multivariate distributions\n",
"\n",
"Joint distributions and the independence of general random variables are defined. Joint continuous distributions are defined, and analogues of the results for multivariate discrete random variables are given for the continuous case."
]
},
{
"cell_type": "markdown",
"id": "6397f39c-1297-4de1-affc-5610ba060eba",
"metadata": {},
"source": [
"## Joint distributions\n",
"\n",
"We are often interested in the values taken by two random variables $X$ and $Y,$ defined on the same probability space $(\\Omega, \\mathcal{F}, \\mathbb{P}).$\n",
"The joint distribution function describes the probability of the outcome that $X$ and $Y$ assume some values simultaneously.\n",
"\n",
":::{prf:definition} Joint distribution function\n",
"\n",
"Given random variables $X, Y$ on $(\\Omega, \\mathcal{F}, \\mathbb{P})$, their joint distribution function is the mapping $F_{X, Y} : \\mathbb{R}^2 \\to [0, 1]$ given by\n",
" \n",
"$$\\begin{align}\n",
"F_{X, Y}(x, y) = \\mathbb{P}(X \\leq x, Y \\leq y).\n",
"\\end{align}$$\n",
"\n",
":::\n",
"\n",
"This definition can be extended to joint distributions of any number of variables, by adding more variables to the set being measured. The joint distribution function satisfies:\n",
" \n",
"$$\\begin{align}\n",
"\\lim_{x, y \\to -\\infty}F_{X, Y}(x, y) = 0&,\\\\\n",
"\\lim_{x, y \\to \\infty}F_{X, Y}(x, y) = 1&,\\\\\n",
"x_1 \\leq x_2 \\text { and } y_1 \\leq y_2 \\implies F_{X, Y}(x_1, y_1) \\leq\n",
"F_{X, Y}(x_2, y_2)&.\n",
"\\end{align}$$\n",
" \n",
"The joint distribution function $F_{X, Y}$ is related to its marginal distributions $F_X(x), F_{Y}(y)$ by:\n",
" \n",
"$$\\begin{align}\n",
"\\lim_{y \\to \\infty} F_{X, Y}(x, y) = F_X(x),\n",
"\\lim_{x \\to \\infty} F_{X, Y}(x, y) = F_Y(y).\n",
"\\end{align}$$\n",
" \n",
"We are often interested in how two random variables are related. In the special case where they are unrelated, we call them independent.\n",
" \n",
":::{prf:definition} Independence of variables\n",
"\n",
"We say that two random variables $X$ and $Y$ are independent if for all $x, y \\in \\mathbb{R}$, the events $\\{X \\leq x\\}$ and $\\{Y \\leq y\\}$ are independent.\n",
":::\n",
"\n",
"Note that previously we had defined independence between events, as well as between discrete random variables. This definition extends independence to all random variables (discrete, continuous or other)."
]
},
{
"cell_type": "markdown",
"id": "a3075add-5e70-4e16-81dc-9e3bb687b700",
"metadata": {},
"source": [
"## Independence and sums\n",
"\n",
"The manipulation of a joint distribution may simplify considerably if the variables are independent. As with discrete random variables, two variables are independent if and only if the joint distribution of continuous random variables factorises.\n",
"\n",
":::{prf:theorem} Independence $\\iff$ pdf factorises\n",
"\n",
"Two jointly continuous random variables $X$ and $Y$ are independent if and only if their joint density function may be expressed in the form\n",
" \n",
"$$\\begin{align}\n",
"f_{X, Y}(x, y) = g(x)h(y), \\text{ for } x, y \\in \\mathbb{R}.\n",
"\\end{align}$$\n",
"\n",
":::\n",
"\n",
"Again, much like with discrete random variables, the sum of two independent continuous random variables has pmf equal to the convolution of the pmfs of the summands.\n",
"\n",
":::{prf:theorem} Convolution formula\n",
"\n",
"If the random variables $X$ and $Y$ are independent and continuous, with pdfs $f_X$ and $f_Y$, then the density function of their sum $Z = X + Y$ is\n",
" \n",
"$$\\begin{align}\n",
"f_Z(z) = \\int^\\infty_{-\\infty} f_X(x)f_Y(z - x) dx, \\text{ for } z \\in\n",
"\\mathbb{R}.\n",
"\\end{align}$$\n",
" \n",
":::"
]
},
{
"cell_type": "markdown",
"id": "cbd1d961-b2de-4d07-8d5a-3807382e4b34",
"metadata": {},
"source": [
"## Changes of variables\n",
"\n",
"Given random variables $X, Y$, we are often interested in the distribution of $T(X, Y)$. If the random variables are continuous, and the function $T$ is a bijection, then the pmf of $T$ is given by the result below.\n",
"\n",
":::{prf:theorem} Jacobian formula\n",
"\n",
"Let $X$ and $Y$ be jointly continuous with pdf $f_{X, Y}$ and $B(x, y) = (u(x, y), v(x, y))$ is a bijection from $D = \\{(x, y) : f_{X, Y}(x, y) > 0\\}$ to $S \\subseteq \\mathbb{R}^2$. Then the pair $(U, V) = (u(X, Y), v(X, Y))$ is jointly continuous with joint pdf\n",
" \n",
"$$\\begin{align}\n",
"f_{U, V}(u, v) = \\begin{cases}\n",
"f_{X, Y}\\left(x(u, v), y(u, v)\\right) |J(u, v)|, & \\text{ if } (u, v) \\in S,\\\\\n",
"0 & \\text{ otherwise,}\n",
"\\end{cases}\n",
"\\end{align}$$\n",
" \n",
"where $J(u, v)$ is the Jacobian of $B$\n",
"\n",
"$$\\begin{align}\n",
"J(u, v) = \\begin{vmatrix}\n",
"\\frac{\\partial x}{\\partial u}& \\frac{\\partial x}{\\partial v} \\\\\n",
"\\frac{\\partial y}{\\partial u}& \\frac{\\partial y}{\\partial v}\n",
"\\end{vmatrix}.\n",
"\\end{align}$$\n",
" \n",
":::\n",
"\n",
"This result extends the single-variable analogue for $Y = g(X(\\omega)),$ where $g$ is an invertible mapping:\n",
"\n",
"$$f_Y(y) = f_X(g^{-1}(y)) \\frac{d}{dy} g^{-1}(y).$$\n",
"\n",
"It can be extended to more random variables by adding further variables to the Jacobian."
]
},
{
"cell_type": "markdown",
"id": "83de9f2a-aa5a-4fd1-9508-3261931cb9bd",
"metadata": {},
"source": [
"## Conditional density functions\n",
"\n",
"We are often interested in the distribution of one variable $Y$, conditioned on another event $\\{X = x\\}$, defined analogously to its discrete counterpart.\n",
"\n",
":::{prf:definition} Conditional density function\n",
"\n",
"The conditional density function of $Y$ given $X = x$ is written $f_{Y | X}(\\cdot | x)$ and defined by\n",
" \n",
"$$\\begin{align}\n",
"f_{Y | X}(y | x) = \\frac{f_{X, Y} (x, y)}{f_X(x)}\n",
"\\end{align}$$\n",
" \n",
"for $y \\in \\mathbb{R}$ and $f_X(x) > 0$.\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "92970aef-d2c5-4680-8c8f-66d6a868da5d",
"metadata": {},
"source": [
"## Expectations\n",
"\n",
"The law of the subconscious statistician for discrete random variables has the following counterpart for continuous random variables.\n",
"\n",
":::{prf:theorem} Law of the subconscious statistician\n",
"\n",
"For any jointly continuous random variables $X, Y$ with pmf $f_{X, Y}$ and well-behaved $g$, we have\n",
" \n",
"$$\\begin{align}\n",
"\\mathbb{E}\\left(g(X, Y)\\right) = \\int^\\infty_{-\\infty}\\int^{\\infty}_{-\\infty\n",
"} g(x, y) f_{X, Y}(x, y) dx dy,\n",
"\\end{align}$$\n",
" \n",
"whenever this integral converges absolutely.\n",
":::\n",
"\n",
"The above result is useful because we need not worry about evaluating the distribution of $Z = g(X, Y)$, and can instead evaluate the integral directly.\n",
" \n",
"We also have the following result relating the independence of random variables to the factorisation of expectations of products of functions of the variables. This is again analogous to the similar result for discrete distributions.\n",
"\n",
"\n",
":::{prf:theorem} Independence $\\iff$ expectations of products of functions factorise\n",
"\n",
"Jointly continuous random variables $X$ and $Y$ are independent if and only if\n",
" \n",
"$$\\begin{align}\n",
"\\mathbb{E}(g(X)h(Y)) = \\mathbb{E}(g(X))\\mathbb{E}(h(Y))\n",
"\\end{align}$$\n",
" \n",
"for all functions $g, h : \\mathbb{R} \\to \\mathbb{R}$ for which these expectations exist.\n",
":::\n",
"\n",
"\n",
"The conditional expectation of continuous random variables is defined analogously to that for discrete distributions, as shown below.\n",
"\n",
":::{prf:definition} Continuous conditional expectation\n",
"\n",
"If $X, Y$ are jointly continuous random variables with joint density function $f_{X, Y}$, the conditional expectation of $Y$ given $X = x$ is defined as\n",
" \n",
"$$\\begin{align}\n",
"\\mathbb{E}(Y | X = x) = \\int^\\infty_{-\\infty} y f_{Y | X}(y | x) dy = \\int\n",
"^{\\infty}_{-\\infty} y \\frac{f_{X, Y}(x, y)}{f_X(x)} dy,\n",
"\\end{align}$$\n",
"\n",
"valid for any $x$ for which $f_X(x) > 0$.\n",
":::\n",
"\n",
"We also have the following result about conditional expectations, an analogue of the equivalent result for discrete functions.\n",
"\n",
":::{prf:theorem} Law of iterated expectations\n",
"\n",
"If $X, Y$ are jointly continuous random variables, then\n",
" \n",
"$$\\begin{align}\n",
"\\mathbb{E}(Y) = \\int^{\\infty}_{-\\infty} \\mathbb{E}(Y | X = x)f_X(x)dx,\n",
"\\end{align}$$\n",
" \n",
"where the integral is over all $x$ for which $f_X(x) > 0$.\n",
":::"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0c2e8eb3-ca57-491c-8d8f-a3b335bf38d1",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "rw",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 5
}