# Joint probability distribution

(Redirected from Joint probability)
${\displaystyle X}$
${\displaystyle Y}$
${\displaystyle p(X)}$
${\displaystyle p(Y)}$
Many sample observations (black) are shown from a joint probability distribution. The marginal densities are shown as well.

Given random variables ${\displaystyle X,Y,\ldots }$, that are defined on a probability space, the joint probability distribution for ${\displaystyle X,Y,\ldots }$ is a probability distribution that gives the probability that each of ${\displaystyle X,Y,\ldots }$ falls in any particular range or discrete set of values specified for that variable. In the case of only two random variables, this is called a bivariate distribution, but the concept generalizes to any number of random variables, giving a multivariate distribution.

The joint probability distribution can be expressed either in terms of a joint cumulative distribution function or in terms of a joint probability density function (in the case of continuous variables) or joint probability mass function (in the case of discrete variables). These in turn can be used to find two other types of distributions: the marginal distribution giving the probabilities for any one of the variables with no reference to any specific ranges of values for the other variables, and the conditional probability distribution giving the probabilities for any subset of the variables conditional on particular values of the remaining variables.

## Examples

### Draws from an urn

Suppose each of two urns contains twice as many red balls as blue balls, and no others, and suppose one ball is randomly selected from each urn, with the two draws independent of each other. Let ${\displaystyle A}$  and ${\displaystyle B}$  be discrete random variables associated with the outcomes of the draw from the first urn and second urn respectively. The probability of drawing a red ball from either of the urns is 2/3, and the probability of drawing a blue ball is 1/3. We can present the joint probability distribution as the following table:

A=Red A=Blue P(B)
B=Red (2/3)(2/3)=4/9 (1/3)(2/3)=2/9 4/9+2/9=2/3
B=Blue (2/3)(1/3)=2/9 (1/3)(1/3)=1/9 2/9+1/9=1/3
P(A) 4/9+2/9=2/3 2/9+1/9=1/3

Each of the four inner cells shows the probability of a particular combination of results from the two draws; these probabilities are the joint distribution. In any one cell the probability of a particular combination occurring is (since the draws are independent) the product of the probability of the specified result for A and the probability of the specified result for B. The probabilities in these four cells sum to 1, as it is always true for probability distributions.

Moreover, the final row and the final column give the marginal probability distribution for A and the marginal probability distribution for B respectively. For example, for A the first of these cells gives the sum of the probabilities for A being red, regardless of which possibility for B in the column above the cell occurs, as 2/3. Thus the marginal probability distribution for ${\displaystyle A}$  gives ${\displaystyle A}$ 's probabilities unconditional on ${\displaystyle B}$ , in a margin of the table.

### Coin flips

Consider the flip of two fair coins; let ${\displaystyle A}$  and ${\displaystyle B}$  be discrete random variables associated with the outcomes of the first and second coin flips respectively. Each coin flip is a Bernoulli trial and has a Bernoulli distribution. If a coin displays "heads" then the associated random variable takes the value 1, and it takes the value 0 otherwise. The probability of each of these outcomes is 1/2, so the marginal (unconditional) density functions are

${\displaystyle P(A)=1/2\quad {\text{for}}\quad A\in \{0,1\};}$
${\displaystyle P(B)=1/2\quad {\text{for}}\quad B\in \{0,1\}.}$

The joint probability density function of ${\displaystyle A}$  and ${\displaystyle B}$  defines probabilities for each pair of outcomes. All possible outcomes are

${\displaystyle (A=0,B=0),(A=0,B=1),(A=1,B=0),(A=1,B=1).}$

Since each outcome is equally likely the joint probability density function becomes

${\displaystyle P(A,B)=1/4\quad {\text{for}}\quad A,B\in \{0,1\}.}$

Since the coin flips are independent, the joint probability density function is the product of the marginals:

${\displaystyle P(A,B)=P(A)P(B)\quad {\text{for}}\quad A,B\in \{0,1\}.}$

### Roll of a die

Consider the roll of a fair die and let ${\displaystyle A=1}$  if the number is even (i.e. 2, 4, or 6) and ${\displaystyle A=0}$  otherwise. Furthermore, let ${\displaystyle B=1}$  if the number is prime (i.e. 2, 3, or 5) and ${\displaystyle B=0}$  otherwise.

1 2 3 4 5 6
A 0 1 0 1 0 1
B 0 1 1 0 1 0

Then, the joint distribution of ${\displaystyle A}$  and ${\displaystyle B}$ , expressed as a probability mass function, is

${\displaystyle \mathrm {P} (A=0,B=0)=P\{1\}={\frac {1}{6}},\quad \quad \mathrm {P} (A=1,B=0)=P\{4,6\}={\frac {2}{6}},}$
${\displaystyle \mathrm {P} (A=0,B=1)=P\{3,5\}={\frac {2}{6}},\quad \quad \mathrm {P} (A=1,B=1)=P\{2\}={\frac {1}{6}}.}$

These probabilities necessarily sum to 1, since the probability of some combination of ${\displaystyle A}$  and ${\displaystyle B}$  occurring is 1.

### Bivariate normal distribution

Bivariate normal joint density

The multivariate normal distribution, which is a continuous distribution, is the most commonly encountered distribution in statistics. When there are specifically two random variables, this is the bivariate normal distribution, shown in the graph, with the possible values of the two variables plotted in two of the dimensions and the value of the density function for any pair of such values plotted in the third dimension. The probability that the two variables together fall in any region of their two dimensions is given by the volume under the density function above that region.

## Joint cumulative distribution function

For a pair of random variables ${\displaystyle X,Y}$ , the joint cumulative distribution function (CDF) ${\displaystyle F_{XY}}$  is given by[1]:p. 89

${\displaystyle F_{X,Y}(x,y)=\operatorname {P} (X\leq x,Y\leq y)}$

(Eq.1)

where the right-hand side represents the probability that the random variable ${\displaystyle X}$  takes on a value less than or equal to ${\displaystyle x}$  and that ${\displaystyle Y}$  takes on a value less than or equal to ${\displaystyle y}$ .

For ${\displaystyle N}$  random variables ${\displaystyle X_{1},\ldots ,X_{N}}$ , the joint CDF ${\displaystyle F_{X_{1},\ldots ,X_{N}}}$  is given by

${\displaystyle F_{X_{1},\ldots ,X_{N}}(x_{1},\ldots ,x_{N})=\operatorname {P} (X_{1}\leq x_{1},\ldots ,X_{N}\leq x_{n})}$

(Eq.2)

Interpreting the ${\displaystyle N}$  random variables as a random vector ${\displaystyle \mathbf {X} =(X_{1},\ldots ,X_{N})^{T}}$  yields a shorter notation:

${\displaystyle F_{\mathbf {X} }(\mathbf {x} )=\operatorname {P} (X_{1}\leq x_{1},\ldots ,X_{N}\leq x_{n})}$

## Joint density function or mass function

### Discrete case

The joint probability mass function of two discrete random variables ${\displaystyle X,Y}$  is:

${\displaystyle p_{X,Y}(x,y)=\mathrm {P} (X=x\ \mathrm {and} \ Y=y)}$

(Eq.3)

or written in term of conditional distributions

${\displaystyle p_{X,Y}(x,y)=\mathrm {P} (Y=y\mid X=x)\cdot \mathrm {P} (X=x)=\mathrm {P} (X=x\mid Y=y)\cdot \mathrm {P} (Y=y)}$

where ${\displaystyle \mathrm {P} (Y=y\mid X=x)}$  is the probability of ${\displaystyle Y=y}$  given that ${\displaystyle X=x}$ .

The generalization of the preceding two-variable case is the joint probability distribution of ${\displaystyle n\,}$  discrete random variables ${\displaystyle X_{1},X_{2},\dots ,X_{n}}$  which is:

${\displaystyle p_{X_{1},\ldots ,X_{n}}(x_{1},\ldots ,x_{n})=\mathrm {P} (X_{1}=x_{1}{\text{ and }}\dots {\text{ and }}X_{n}=x_{n})}$

(Eq.4)

or equivalently

{\displaystyle {\begin{aligned}p_{X_{1},\ldots ,X_{n}}(x_{1},\ldots ,x_{n})&=\mathrm {P} (X_{1}=x_{1})\cdot \mathrm {P} (X_{2}=x_{2}\mid X_{1}=x_{1})\\&\cdot \mathrm {P} (X_{3}=x_{3}\mid X_{1}=x_{1},X_{2}=x_{2})\\&\dots \\&\cdot P(X_{n}=x_{n}\mid X_{1}=x_{1},X_{2}=x_{2},\dots ,X_{n-1}=x_{n-1}).\end{aligned}}} .

This identity is known as the chain rule of probability.

Since these are probabilities, we have in the two-variable case

${\displaystyle \sum _{i}\sum _{j}\mathrm {P} (X=x_{i}\ \mathrm {and} \ Y=y_{j})=1,\,}$

which generalizes for ${\displaystyle n\,}$  discrete random variables ${\displaystyle X_{1},X_{2},\dots ,X_{n}}$  to

${\displaystyle \sum _{i}\sum _{j}\dots \sum _{k}\mathrm {P} (X_{1}=x_{1i},X_{2}=x_{2j},\dots ,X_{n}=x_{nk})=1.\;}$

### Continuous case

The joint probability density function ${\displaystyle f_{X,Y}(x,y)}$  for two continuous random variables is defined as the derivative of the joint cumulative distribution function (see Eq.1):

${\displaystyle f_{X,Y}(x,y)={\frac {\partial ^{2}F_{X,Y}(x,y)}{\partial x\partial y}}}$

(Eq.5)

This is equal to:

${\displaystyle f_{X,Y}(x,y)=f_{Y\mid X}(y\mid x)f_{X}(x)=f_{X\mid Y}(x\mid y)f_{Y}(y)}$

where ${\displaystyle f_{Y\mid X}(y\mid x)}$  and ${\displaystyle f_{X\mid Y}(x\mid y)}$  are the conditional distributions of ${\displaystyle Y}$  given ${\displaystyle X=x}$  and of ${\displaystyle X}$  given ${\displaystyle Y=y}$  respectively, and ${\displaystyle f_{X}(x)}$  and ${\displaystyle f_{Y}(y)}$  are the marginal distributions for ${\displaystyle X}$  and ${\displaystyle Y}$  respectively.

The definition extends naturally to more than two random variables:

${\displaystyle f_{X_{1},\ldots ,X_{n}}(x_{1},\ldots ,x_{n})={\frac {\partial ^{n}F_{X_{1},\ldots ,X_{n}}(x_{1},\ldots ,x_{n})}{\partial x_{1}\ldots \partial x_{n}}}}$

(Eq.6)

Again, since these are probability distributions, one has

${\displaystyle \int _{x}\int _{y}f_{X,Y}(x,y)\;dy\;dx=1}$

respectively

${\displaystyle \int _{x_{1}}\ldots \int _{x_{n}}f_{X_{1},\ldots ,X_{n}}(x_{1},\ldots ,x_{n})\;dx_{1}\ldots \;dx_{n}=1}$

### Mixed case

The "mixed joint density" may be defined where one or more random variables are continuous and the other random variables are discrete. With one variable of each type we have

{\displaystyle {\begin{aligned}f_{X,Y}(x,y)=f_{X\mid Y}(x\mid y)\mathrm {P} (Y=y)=\mathrm {P} (Y=y\mid X=x)f_{X}(x).\end{aligned}}}

One example of a situation in which one may wish to find the cumulative distribution of one random variable which is continuous and another random variable which is discrete arises when one wishes to use a logistic regression in predicting the probability of a binary outcome Y conditional on the value of a continuously distributed outcome ${\displaystyle X}$ . One must use the "mixed" joint density when finding the cumulative distribution of this binary outcome because the input variables ${\displaystyle (X,Y)}$  were initially defined in such a way that one could not collectively assign it either a probability density function or a probability mass function. Formally, ${\displaystyle f_{X,Y}(x,y)}$  is the probability density function of ${\displaystyle (X,Y)}$  with respect to the product measure on the respective supports of ${\displaystyle X}$  and ${\displaystyle Y}$ . Either of these two decompositions can then be used to recover the joint cumulative distribution function:

{\displaystyle {\begin{aligned}F_{X,Y}(x,y)&=\sum \limits _{t\leq y}\int _{s=-\infty }^{x}f_{X,Y}(s,t)\;ds.\end{aligned}}}

The definition generalizes to a mixture of arbitrary numbers of discrete and continuous random variables.

### Joint distribution for independent variables

In general two random variables ${\displaystyle X}$  and ${\displaystyle Y}$  are independent if and only if the joint cumulative distribution function satisfies

${\displaystyle F_{X,Y}(x,y)=F_{X}(x)\cdot F_{Y}(y)}$

Two discrete random variables ${\displaystyle X}$  and ${\displaystyle Y}$  are independent if and only if the joint probability mass function satisfies

${\displaystyle P(X=x\ {\mbox{and}}\ Y=y)=P(X=x)\cdot P(Y=y)}$

for all ${\displaystyle x}$  and ${\displaystyle y}$ .

While the number of independent random events grows, the related joint probability value decreases rapidly to zero, according to a negative exponential law.

Similarly, two absolutely continuous random variables are independent if and only if

${\displaystyle f_{X,Y}(x,y)=f_{X}(x)\cdot f_{Y}(y)}$

for all ${\displaystyle x}$  and ${\displaystyle y}$ . This means that acquiring any information about the value of one or more of the random variables leads to a conditional distribution of any other variable that is identical to its unconditional (marginal) distribution; thus no variable provides any information about any other variable.

### Joint distribution for conditionally dependent variables

If a subset ${\displaystyle A}$  of the variables ${\displaystyle X_{1},\cdots ,X_{n}}$  is conditionally dependent given another subset ${\displaystyle B}$  of these variables, then the probability mass function of the joint distribution is ${\displaystyle \mathrm {P} (X_{1},\ldots ,X_{n})}$ . ${\displaystyle \mathrm {P} (X_{1},\ldots ,X_{n})}$  is equal to ${\displaystyle P(B)\cdot P(A\mid B)}$ . Therefore, it can be efficiently represented by the lower-dimensional probability distributions ${\displaystyle P(B)}$  and ${\displaystyle P(A\mid B)}$ . Such conditional independence relations can be represented with a Bayesian network or copula functions.