Calculate moments for joint, conditional, and marginal discrete random variables

Calculate moments for joint, conditional, and marginal discrete random variables

The \(n\)-th moment about the origin of a random variable is the expected value of its \(n\)-th power.

In this reading, however, we will mostly look at moments about the mean, also called central moments. The \(n\)-th central moment of a random variable \(X\) is the expected value of the \(n\)-th power of the deviation of \(X\) from its mean.

The first and the second central moments are the mean and variance, respectively.

Moments for Joint Discrete Random Variables

Let \(\text{X}\) and \(\text{Y}\) be two discrete random variables with joint probability function, \(\text{f}(\text{x}, \text{y})\) defined on the space \(\text{S}\). If there exists a function, \(\text{g}(\text{x}, \text{y})\) of these two random variables, then the expected value(mean) of \(g(x, y)\) is given by:

$$
E[g(x, y)]=\sum_{(x, y) \in S} g(x, y) f(x, y)
$$
The second moment(variance) of \(\text{g}(\text{x}, \text{y})\) is defined as:

$$
\text{Var}(\text{X}, \text{Y})=\text{E}\left(\text{g}\left(\text{x}^{2}, \text{y}^{2}\right)\right)-\text{E}[\text{g}(\text{x}, \text{y})]^{2}
$$

Example 1: Moments for Joint Discrete Random Variables

An actuary determines that the annual number of claims from two policyholders, \(\text{A}\) and \(\text{B}\), is jointly distributed as:

$$
f(x, y)=\frac{x^{2}+3 y}{96} \quad x=1,2,3,4 \quad y=1,2
$$
Let \(X\) be the number of annual claims from policyholder \(\text{A}\) and \(Y\) be the number of annual claims from policyholder \(B\).

Find \(\text{E}(\text{XY})\)

Solution

The possible values for this distribution are:
$$
(1,1),(1,2),(2,1),(2,2),(3,1),(3,2),(4,1),(4,2)
$$
Now,
$$
\begin{align}
\text{E}[\text{XY}] &=\sum_{(\text{x}, \text{y}) \in \text{S}} \text{g}(\text{x}, \text{y}) \text{f}(\text{x}, \text{y})=\sum_{(\text{x}, \text{y}) \in \text{S}}(\text{xy}) \frac{\text{x}^{2}+3 \text{y}}{96} \\
&=(1) \frac{1+3}{96}+(2) \frac{1+6}{96}+(2) \frac{4+3}{96}+(4) \frac{4+6}{96}\\&+(3) \frac{9+3}{96}+(6) \frac{9+6}{96} +(4) \frac{16+3}{96}+(8) \frac{16+6}{96}\\ &=\frac{4}{96}+\frac{14}{96}+\frac{14}{96}+\frac{40}{96}+\frac{36}{96}+\frac{90}{96}+\frac{76}{96}+\frac{176}{96} \\
&=\frac{75}{16}=4 \frac{11}{16}
\end{align}
$$

Moments for Conditional Discrete Random Variables

In the previous reading, we defined the conditional distributions for two discrete random variables, \(X\) and \(Y\), with a joint pmf \(f(x, y)\) and marginal functions \(f_{x}(x)\) and \(f_{y}(y)\) as:

$$
\text{g}(\text{x} \mid \text{y})=\frac{\text{f}(\text{x}, \text{y})}{\text{f}_{\text{Y}}(\text{y})} \quad \text { provided that } \text{f}_{\text{Y}}(\text{y})>0
$$
and,
$$
\text{h}(\text{y} \mid \text{x})=\frac{\text{f}(\text{x}, \text{y})}{\text{f}_{\text{X}}(\text{x})} \quad \text { provided that } \text{f}_{\text{X}}(\text{x})>0
$$
We may wish to find the mean and variance of the above conditional distributions.

The conditional mean of \(\text{X}\), given that \(\text{Y}=\text{y}\) is given by:

$$
\mu_{\text{x} \mid \text{y}}=\text{E}[\text{X} \mid \text{Y}]=\sum_{\text{x}} \text{x} * \text{g}(\text{x} \mid \text{y})
$$
And the conditional variance of \(X\), given that \(Y=y\) is given by:

$$
\sigma_{\text{X} \mid \text{Y}}=\text{E}(\text{X}-\text{E}[\text{X} \mid \text{Y}])^{2}=\sum_{\text{X}}(\text{X}-\text{E}[\text{X} \mid \text{y}])^{2} * \text{g}(\text{x} \mid \text{y})
$$
This is simplified to:

$$
\sigma_{\text{X} \mid \text{Y}}=\text{E}\left[\text{X}^{2} \mid \text{y}\right]-(\text{E}[\text{X} \mid \text{y}])^{2}
$$
Similarly, the conditional mean of \(Y\), given that \(X=x\) is given by:

$$
\mu_{\text{Y} \mid \text{X}}=\text{E}[\text{Y} \mid \text{x}]=\sum_{\text{y}} \text{y} * \text{h}(\text{y} \mid \text{x})
$$
And the conditional variance of \(Y\), given that \(X=x\) is given by:

$$
\sigma_{\text{Y} \mid \text{x}}=\text{E}(\text{Y}-\text{E}[\text{Y} \mid \text{x}])^{2}=\sum_{\text{y}}(\text{Y}-\text{E}[\text{Y} \mid \text{x}])^{2} * \text{h}(\text{y} \mid \text{x})
$$
This is simplified to:

$$
\sigma_{\text{Y} \mid \text{x}}=\text{E}\left[\text{Y}^{2} \mid \text{x}\right]-(\text{E}[\text{Y} \mid \text{X}])^{2}
$$

Example: Moments for Conditional Discrete Random Variables

Let \(X\) be the number of annual tornadoes in country \(M\) and let \(Y\) be the number of annual tornadoes in country \(N\). \(X\) and \(Y\) have the following probability mass function:

$$
\text{f}(\text{x, y})=\frac{x^{2}+3 y}{96} \quad \text{x}=1,2,3,4, \quad \text{y}=1,2
$$
Calculate

  1. \(\text{E}(\text{X} \mid \text{Y}=1)\)
  2. \(\text{E}(\text{Y} \mid \text{X}=3)\)
  3. \(\text{V}(\text{X} \mid \text{Y}=1)\)

Solution

From the joint function, we can get the following marginal distribution functions:
$$
f_{X}(x)=\frac{2 x^{2}+9}{96}, x=1,2,3,4
$$
and,
$$
\text{f}_{\text{Y}}(\text{y})=\frac{12 \text y+30}{96},\text{y}=1,2
$$
We can also find conditional probability mass functions:
$$\begin{align}
&\text{g}(\text{x}\mid \text{y})=\frac{x^{2}+3 y}{12y+30};\quad \text{and}\\\\ &h(y \mid x)=\frac{x^{2}+3 y}{2 x^{2}+9} \end{align}
$$
So,
a)
$$
\begin{align}
\text{E}(\text{X} \mid \text{Y}=1) &=\text{E}(\text{g}(\text{x} \mid \text{y}=1))=\sum_{\text{x}=1}^{4} \text{x} * \text{g}(\text{x} \mid \text{y}=1)=\sum_{\text{x}=1}^{4} \text{x} * \frac{\text{x}^{2}+3(1)}{12(1)+30} \\
&=(1) \frac{1^{2}+3(1)}{12(1)+30}+(2) \frac{2^{2}+3(1)}{12(1)+30}+(3) \frac{3^{2}+3(1)}{12(1)+30}+(4) \frac{4^{2}+3(1)}{12(1)+30} \\
&=(1) \frac{4}{42}+(2) \frac{7}{42}+\text { (3) } \frac{12}{42}+(4) \frac{19}{42}=\frac{65}{21}=3.10
\end{align}
$$
b)
$$
\begin{align}
\text{E}(\text{Y} \mid \text{X}=3) &=\text{E}(\text{h}(\text{y} \mid \text{x}=3))=\sum_{\text{y}=1}^{2} \text{y} * \text{h}(\text{y} \mid \text{x}=3)=\sum_{\text{y}=1}^{2} \text{y} * \frac{3^{2}+3 \text{y}}{2(3)^{2}+9} \\
&=(1) \frac{3^{2}+3(1)}{2(3)^{2}+9}+(2) \frac{3^{2}+3(2)}{2(3)^{2}+9} \\
&=\frac{12}{27}+(2) \frac{15}{27}=\frac{14}{9}=1.56
\end{align}
$$
c) Using the output from (a), we have:

$$
\begin{align} \text{V}\left(\text{X} \mid \text{Y}=1\right)&=\text{E}\left[\text{X}-\text{E}(\text{X} \mid \text{Y}=1))^{2} \mid \text{Y}=1\right]\\
&=\sum_{\text{x}=1}^{4}(\text{x}-\text{E}(\text{X} \mid \text{Y}=1))^{2} \text{g}(\text{x} \mid \text{y}=1) \\
&=\sum_{\text{x}=1}^{4}\left(\text{x}-\frac{65}{21}\right)^{2} \frac{\text{x}^{2}+3(1)}{12(1)+30} \\
&=\left(1-\frac{65}{21}\right)^{2} \frac{4}{42}+\left(2-\frac{65}{21}\right)^{2} \frac{7}{42}+\left(3-\frac{65}{21}\right)^{2} \frac{12}{42}+\left(4-\frac{65}{21}\right)^{2} \frac{19}{42} \\
&=\left(\frac{1936}{441}\right) \frac{4}{42}+\left(\frac{529}{441}\right) \frac{7}{42}+\left(\frac{4}{441}\right) \frac{12}{42}+\left(\frac{361}{441}\right) \frac{19}{42}=0.9909
\end{align}
$$

Moments for Marginal Discrete Random Variables

Recall that if \(\text{X}\) and \(\text{Y}\) are discrete random variables with joint probability mass function \(\text{f}(\text{x}, \text{y})\) defined on the space \(S\), then the marginal distribution functions of \(X\) and \(Y\) are given by:

$$
\text{f}_{\text{x}}(\text{x})=\sum_{\text{y}} \text f(\text x, \text y)=\text P(\text X=\text x), \quad \text{x in S}_{\text x}
$$
and,
$$
\text{f}_{\text{y}}(\text{y})=\sum_{\text{x}} \text{f}(\text{x}, \text{y})=\text{P}(\text{Y}=\text{y}), \quad \text{y} \in \text{S}_{\text{y}}
$$
Once we have the marginal distribution functions of \(X\) and \(Y\), we can now go ahead to find the moments for \(\text{X}\) and \(\text{Y}\) separately.

Example: Moments for Marginal Discrete Random Variables

Let \(\text{X}\) and \(\text{Y}\) be the number of days of hospitalization for two patients, \(P\), and \(Q\), respectively.
$$
\text f(\text x, \text y)=\frac{\text x^{2}+3 \text y}{96} \quad \text x=1,2,3,4; \quad \text y=1,2
$$
Calculate:

a) the expected number of days of hospitalization for patient \(\text P\).

b) the expected number of days of hospitalization for patient \(\text Q\).

Solution

a) To calculate the expected number of days of hospitalization for patient \(\text{P}\), we need to find the marginal distribution function of \(\text{X}\) first:
We know that,
$$
\text f_{\text x}(\text x)=\sum_{\text y} \text{f(x, y)}=\text P(\text X=\text x), \quad \text{x in S}_{\text {x}}
$$
$$
\begin{gather}
=\frac{\text{x}^{2}+3(1)}{96}+\frac{\text{x}^{2}+3(2)}{96}=\frac{\text{x}^{2}+\text{x}^{2}+3+6}{96} \\
\therefore \text{f}_{\text{X}}(\text{x})=\frac{2 \text{x}^{2}+9}{96}
\end{gather}
$$
Therefore,
$$
\begin{align}
\text{E}(\text{X}) &=\sum_{\text{x}=1}^{\text{n}} \text{xf}_ \text{x}(\text{x})=\sum_{\text{x}=1}^{4} \text{xf} _{\text{x}}(\text{x})=\sum_{\text{x}=1}^{4} \text{x} \frac{2 \text{x}^{2}+9}{96} \\
&=(1) \frac{2(1)^{2}+9}{96}+(2) \frac{2(2)^{2}+9}{96}+(3) \frac{2(3)^{2}+9}{96}+(4) \frac{2(4)^{2}+9}{96} \\
&=(1) \frac{11}{96}+(2) \frac{17}{96}+\text { (3) } \frac{27}{96}+(4) \frac{41}{96}=\frac{145}{48}=3.02
\end{align}
$$
b) Similarly, to calculate the expected number of days of hospitalization for patient \(Q\), we need to find the marginal probability function of \(Y\) first:

$$
\begin{align}
\text{f}_{\text{y}}(\text{y}) &=\sum_{\text{x}} \text{f}(\text{x}, \text{y})=\text{P}(\text{Y}=\text{y}), \quad \text{y} \in \text{S}_{\text{y}} \\
&=\frac{1+3 \text{y}}{96}+\frac{4+3 \text{y}}{96}+\frac{9+3 \text{y}}{96}+\frac{16+3 \text{y}}{96} \\
&=\frac{12 \text{y}+30}{96}, \text { for } \text{y}=1,2
\end{align}
$$
Therefore,
$$
\begin{align}
\text{E}(\text{Y}) &=\sum_{\text{y}=1}^{\text{n}} \text{yf}(\text{y})=\sum_{\text{y}=1}^{2} \text{yf}(\text{y})=\sum_{\text{y}=1}^{2} \text{y} \frac{12 \text{y}+30}{96} \\
&=(1) \frac{12(1)+30}{96}+(2) \frac{12(2)+30}{96} \\
&=(1) \frac{42}{96}+(2) \frac{54}{96}=\frac{25}{16}
\end{align}
$$
We can also proceed to find the variance for the corresponding variables:

For \(X\), we know that:

$$
\text{V(X)}=\text E\left(\text X^{2}\right)-\left[\text{E(X)}\right]^{2}
$$
Therefore, we need to find \(\text{E}\left(\text{X}^{2}\right)\) and \(\text{E}(\text{X})\). Continuing with the example above,

$$
\begin{align}
\text{Var}(\text{X}) &=\sum_{\text{x}=1}^{4} \text{x}^{2} \mathrm{f}_{\text{x}}(\text{x})-[\text{E}(\text{X})]^{2} \\
&=\sum_{\text{x}=1}^{4} \text{x}^{2} \frac{2 \text{x}^{2}+9}{96}-\left(\frac{145}{48}\right)^{2}\\& =(1)^{2} \frac{11}{96}+(2)^{2} \frac{17}{96}+(3)^{2} \frac{27}{96}+(4)^{2} \frac{41}{96}-\left(\frac{145}{48}\right)^{2}=\frac{163}{16}-\left(\frac{145}{48}\right)^{2}=1.062
\end{align}
$$
Similarly, for \(\text{Y}\) :
$$
\begin{align}
\text{Var}(\text{Y}) &=\sum_{\text{y}=1}^{2} \text{y}^{2} \text{f}_{\text{y}}(\text{y})-[\text{E}(\text{Y})]^{2} \\
&=\sum_{\text{y}=1}^{2} \text{y}^{2} \frac{12 \text{y}+30}{96}-\left(\frac{25}{16}\right)^{2} \\
&=(1)^{2} \frac{42}{96}+(2)^{2} \frac{54}{96}-\frac{625}{256}=\frac{43}{16}-\frac{625}{256}=\frac{63}{256}
\end{align}
$$

Concept Reminders

We compute and define conditional expectations, variance, etc., as usual, but with conditional distributions in place of https://www.viagrageneric.org ordinary distribution:

In general,

$$
\begin{gather}
\text{E}(\text{X} \mid \text{Y}=\text{y})=\sum_{\text{x}} \text{x} * \text{g}(\text{x} \mid \text{y}) \\
\text{E}\left(\text{X}^{2} \mid \text{Y}=\text{y}\right)=\sum_{\text{x}} \text{x}^{2} * \text{g}(\text{x} \mid \text{y}) \\
\text{Var}(\text{X} \mid \text{Y}=\text{y})=\text{E}\left(\text{X}^{2} \mid \text{Y}\right)-[\text{E}(\text{X} \mid \text{Y})]^{2}
\end{gather}
$$
The conditional pmf of \(X\) given that \(Y=y\) is given by:
$$
\text{g}(\text{x} \mid \text{y})=\frac{\text{f(x, y)}}{\text f_{\text Y}(\text y)}
$$
The conditional pmf of \(\text{Y}\) given that \(\text{X}=\text{x}\) is given by:

$$
\text{h}(\text{y} \mid \text{x})=\frac{\text{f(x, y)}}{\text f_{\text X}(\text x)}
$$

Learning Outcome

Topic 3. c: Multivariate Random Variables- Calculate moments for joint, conditional, and marginal discrete random variables

Shop CFA® Exam Prep

Offered by AnalystPrep

Featured Shop FRM® Exam Prep Learn with Us

    Subscribe to our newsletter and keep up with the latest and greatest tips for success
    Shop Actuarial Exams Prep Shop Graduate Admission Exam Prep


    Daniel Glyn
    Daniel Glyn
    2021-03-24
    I have finished my FRM1 thanks to AnalystPrep. And now using AnalystPrep for my FRM2 preparation. Professor Forjan is brilliant. He gives such good explanations and analogies. And more than anything makes learning fun. A big thank you to Analystprep and Professor Forjan. 5 stars all the way!
    michael walshe
    michael walshe
    2021-03-18
    Professor James' videos are excellent for understanding the underlying theories behind financial engineering / financial analysis. The AnalystPrep videos were better than any of the others that I searched through on YouTube for providing a clear explanation of some concepts, such as Portfolio theory, CAPM, and Arbitrage Pricing theory. Watching these cleared up many of the unclarities I had in my head. Highly recommended.
    Nyka Smith
    Nyka Smith
    2021-02-18
    Every concept is very well explained by Nilay Arun. kudos to you man!
    Badr Moubile
    Badr Moubile
    2021-02-13
    Very helpfull!
    Agustin Olcese
    Agustin Olcese
    2021-01-27
    Excellent explantions, very clear!
    Jaak Jay
    Jaak Jay
    2021-01-14
    Awesome content, kudos to Prof.James Frojan
    sindhushree reddy
    sindhushree reddy
    2021-01-07
    Crisp and short ppt of Frm chapters and great explanation with examples.