Calculate variance and standard deviation for conditional and marginal probability distributions for discrete random variables only

Calculate variance and standard deviation for conditional and marginal probability distributions for discrete random variables only

Variance and Standard Deviation for Conditional Discrete Distributions

Recall that, in the previous readings, we defined the conditional distribution function of \(X\), given that \(\text{Y}=\text{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
$$

Similarly, the conditional distribution function of \(Y\), given that \(X=\text{x}\) is defined by:

$$
\text{h}(\text{y} \mid \text{x})=\frac{\text{f(x, y)}}{\text{f}_{\text X}(\text x)}, \quad \text { provided that } \text{f}_{\text X}(\text x)>0
$$
Now, if we have the above conditional distributions, we can go ahead to calculate conditional variance as well as the conditional standard deviation.

The conditional variance of \(X\), given that \(Y=y\), is defined by:

$$
\operatorname{Var}(\text X \mid \text Y=\text y)=\text E\left(\text X^{2} \mid \text Y=\text y\right)-[\text E(\text X \mid \text Y=\text y)]^{2}
$$
Where
$$
\text E\left(\text X^{2} \mid \text Y= \text y\right)=\sum_{\text x} \text x^{2} \cdot \text g(\text x \mid \text Y=\text y)
$$
and
$$
\text{E}(\text{X} \mid \text{Y}=\text{y})=\sum_{\text{x}} \text{x} \cdot \text{g}(\text{x} \mid \text{Y}=\text{y})
$$
Note that this is analogous to the variance of a single random variable.

We know that standard deviation is defined simply as the square root of variance.

This implies that the conditional standard deviation of \(\text{X}\), given that \(\text{Y}=\text{y}\) is defined by:
$$
\sigma_{\text{X} \mid \text{Y}=\text{y}}=\sqrt{\text{Var}(\text{X} \mid \text{Y}=\text{y})}
$$
Now, the conditional variance of \(\text{Y}\) given \(\text{X}=\text{x}\) is defined by:
$$
\text{Var}(\text{Y} \mid \text{X}=\text{x})=\text{E}\left(\text{Y}^{2} \mid \text{X}=\text{x}\right)-[\text{E}(\text{Y} \mid \text{X}=\text{x})]^{2}
$$
Where
$$
\text{E}\left(\text {Y}^{2} \mid \text{X}=\text{x}\right)=\sum_{\text{y}} \text{y}^{2} * \text h(\text{y}\mid \text {X}=\text {x})
$$
and
$$
\text{E}(\text{Y} \mid \text{X}=\text{x})=\sum_{\text{x}} \text{y} \cdot \text{h}(\text{y} \mid \text{X}=\text{x})
$$

Example 1: Conditional Variance for Discrete Random Variables

The number of days of hospitalization for two individuals, \(\text{P}\), and \(Q\), is jointly distributed as:

$$
\text{f(x, y)}=\frac{\text{x}+\text{y}}{21}, \text {x=1,2,3} \quad \text{y=1,2}
$$
Find \(\operatorname{Var}(\text{X} \mid \text{Y}=1)\)

Solution

Since we wish to find \(\operatorname{Var}(\text{X} \mid \text{Y}=1)\), we first need to determine the conditional distribution of \(\mathrm{X}\) given \(\mathrm{Y}=1\), namely,
$$
\text{g}(\text{x} \mid \text{y})=\frac{\text{f(x, y)}}{\text{f}_{\text{Y}}(\text{y})}
$$
Where,
$$
\begin{align}
\text{f}_{\text{Y}}(\text{y})=& \sum_{\text {all } x} \text{P}(\text{x}, \text{y})=\text{P}(\text{Y}=\text{y}), \quad \text{y in S}_{\text{y}} \\
\Rightarrow & \text{f}_{\text{Y}}(\text{y})=\frac{(1)+\text{y}}{21}+\frac{(2)+\text{y}}{21}+\frac{(3)+\text{y}}{21}=\frac{6+3 \text{y}}{21}\end{align}
$$
Therefore, we have,
$$
\text {g}(\text{x} \mid\text{y} )=\frac{\text{f}\text{(x, y)}}{\text{f}_{\text{Y}}(\text{y})}=\frac{\frac{\text{x}+\text{y}}{21}}{\frac{6+3 y}{21}}=\frac{\text{x}+\text{y}}{\text{3y}+6}
$$
We can now go ahead to find the conditional variance:

$$
\operatorname{Var}(\text{X} \mid \text{Y}=\text{y})=\sigma_{\text{X} \mid \text{Y}=\text{y}}^{2}=\text{E}\left(\text{X}^{2} \mid \text{Y}=\text{y}\right)-[\text{E}(\text{X} \mid \text{Y}=\text{y})]^{2}
$$
We need:

$$
\operatorname{Var}(\text{X} \mid \text{Y}=1)=\text{E}\left(\text{X}^{2} \mid \text{Y}=1\right)-[\text{E}(\text{X} \mid \text{Y}=1)]^{2}
$$
Now,
$$
\begin{align}
\text{E}(\text{X} \mid \text{Y}&=1)=\sum_{\text{x}=1}^{3} \text{x} \cdot \text{g}(\text{x} \mid \text{y}=1) \\
&=\sum_{\text{x}=1}^{3} \text{x} \frac{(\text{x}+(1))}{3(1)+6} \\
&=(1) \frac{(1+(1))}{3(1)+6}+2 \frac{(2+(1))}{3(1)+6}+3 \frac{(3+(1))}{3(1)+6} \\ &=1\left(\frac{2}{9}\right)+2\left(\frac{1}{3}\right)+3\left(\frac{4}{9}\right)=\frac{20}{9} \end{align}
$$
We also need,
$$
\begin{align}\text{E}\left(\text{X}^{2} \mid \text{Y}=\text{y}\right)&=\sum_{\text{x}=1}^{3} \text{x}^2*\text{g}(\text{x} \mid \text{y}=1) \\&=\sum_{\text{x}=1}^{3} \text{x}^{2} \frac{(\text{x}+(1))}{3(1)+6} \\&
=\left(1^{2}\right) \frac{(1+(1))}{3(1)+6}+2^{2} \frac{(2+(1))}{3(1)+6}+3^{2} \frac{(3+}{3(1)} \\&
=1\left(\frac{2}{9}\right)+4\left(\frac{1}{3}\right)+9\left(\frac{4}{9}\right)=\frac{50}{9} \\&
\Rightarrow \operatorname{Var}(\text{X} \mid \text{Y}=1)=\text{E}\left(\text{X}^{2} \mid \text{Y}=1\right)-[ \text{E}(\text{X} \mid \text{Y}=1)]^{2} \\&
=\frac{50}{9}-\left(\frac{20}{9}\right)^{2}=\frac{50}{81}
\end{align}$$

Example 2: Conditional Standard Deviation for Discrete Random Variables

Using the output from Example 1 above, find \(\text{SD}(\text{X} \mid \text{Y}=1)\)

Solution

From Example 1, we have
$$
\text{V}(\text{X} \mid \text{Y}=1)=\frac{50}{81}
$$
Thus,
$$
\text{SD}(\text{X} \mid \text{Y}=1)=\sqrt{\text{V}(\text{X} \mid \text{Y}=1)}=\sqrt{\frac{50}{81}}=0.7856
$$

Variance and Standard Deviation for Marginal Discrete Distributions

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 \text{S}_{\text{x}}
$$
and,
$$
\text{f}_{\text{Y}}(\text{y})=\sum_{\text{x}} \text{f(x, y)}=\text{P}(\text{Y}=\text{y}), \quad \text{y in S}_{\text{y}}
$$
Once we have the marginal distribution functions of \(X\) and \(Y\), we can now go ahead to find individual variances and standard deviations for \(X\) and \(Y\).

The variance for the random variable \(\text{X}\) is given by:

$$
\operatorname{Var}(\text{X})=\text{E}\left(\text{X}^{2}\right)-[\text{E}(\text{X})]^{2}
$$
Where
$$
\text{E}\left(\text{X}^{2}\right)=\sum_{\text{x}} \text{x}^{2} * \text{P}(\text{X}=\text{x})
$$
and
$$
\text{E}(\text{X})=\sum_{\text{X}} \text{x} * \text{P}(\text{X}=\text{x})
$$
Similarly, the variance of the random variable \(Y\) is given by:

$$
\operatorname{Var}(\text{Y})=\text{E}\left(\text{Y}^{2}\right)-[\text{E}(\text{Y})]^{2}
$$
Where
$$
\text{E}\left(\text{Y}^{2}\right)=\sum_{\text{x}} \text{y}^{2} * \text{P}(\text{Y}=\text{y})
$$
and
$$
\text{E(Y)}=\sum_{\text{x}} \text{y} * \text{P(Y=y)}
$$
The standard deviation for \(\text{X}\) and \(\text{Y}\) is the square root of their respective variances.
$$
\text{SD}(\text{X})=\sqrt{\text{E}\left(\text{X}^{2}\right)-[\text{E}(\text{X})]^{2}}
$$
and,
$$
\text{SD}(\text{Y})=\sqrt{\text{E}\left(\text{Y}^{2}\right)-[\text{E}(\text{Y})]^{2}}
$$

Example 1: Variance and Standard Deviation for Marginal Discrete Random Variables

Let \(\text{X}\) and \(\text{Y}\) be the number of days of sickness for two individuals, \(\text{A}\) and \(\text{B}\).
$$
\text{f(x, y)}=\frac{\text{x}+\text{y}}{21}, \text{x=1,2,3} \quad \text{y=1,2}
$$
Calculate the variance and the standard deviation of \(X\).

Solution

We know that,
$$
\operatorname{Var}(\text{X})=\text{E}\left(\text{X}^{2}\right)-[\text{E}(\text{X})]^{2}
$$
First, we find the marginal probability mass function of \(\text{X}\), which is given by:

$$
\begin{align}
\text{f}_{\text{X}}(\text{x}) &=\sum_{\text {all } \text{y}} \text{f}(\text{x}, \text{y}) \text{x in S}_{\text{x}} \\
&=\frac{\text{x}+(1)}{21}+\frac{\text{x}+(2)}{21}=\frac{2 \text{x}+3}{21}, \quad \text { for } \text{x}=1,2,3
\end{align}
$$
Then,
$$\begin{align}
\text{E(X)} &=\sum_{\text{x}=1}^{3}\text{x} \text{P}_{\text{X}}(\text{x})=\sum_{\text{x}=1}^{3} \text{x} \frac{2 x+3}{21} \\
&=(1) \frac{2(1)+3}{21}+(2) \frac{2(2)+3}{21}+(3) \frac{2(3)+3}{21}\\&=1\left(\frac{5}{21}\right)+2\left(\frac{7}{21}\right)+3\left(\frac{9}{21}\right)=\frac{46}{21}
\end{align}
$$
and
$$
\begin{align}
\text{E}\left(\text{X}^{2}\right) &=\sum_{\text {all }\text{x}} \text{x}^{2} \text{P}_{\text{X}}(\text{x}) \\
&=(1)^{2}\left(\frac{5}{21}\right)+(2)^{2}\left(\frac{7}{21}\right)+(3)^{2}\left(\frac{9}{21}\right)-\left(\frac{46}{21}\right)^{2}=\frac{38}{7}
\end{align}
$$
Thus,
$$
\operatorname{Var(X)}=\frac{38}{7}-\left(\frac{46}{21}\right)^{2}=\frac{278}{441} \approx 0.6304
$$
We know that the standard deviation of \(\text{X}\) is the square root of its variance.

Therefore,
$$
\sigma_{\text{X}}=\sqrt{\text{Var}(\text{X})}=\sqrt{0.6304}=0.7940
$$

Example 2: Variance and Standard Deviation for Marginal Discrete Random Variables

A laptop dealer specializes in two brands of laptops, HP and Lenovo. Let \({X}\) be the number of HP laptops sold in a day, and let \(Y\) be the number of Lenovo laptops sold in a day. The dealer has determined that the number of mobile phones sold in a day is jointly distributed as in the table below:
$$ \begin{array}{c|c|c|c} {\quad \text X }& {1} & {2} & {3} \\ {\Huge \diagdown } & & & \\ {\text Y \quad} & & & \\ \hline {0} & {\cfrac{1}{6}} & {\cfrac{1}{8}} & {\cfrac{1}{6}} \\ \hline {1} & {\cfrac{1}{3}} & {\cfrac{1}{12}} & {\cfrac{1}{8}} \\ \end{array} $$

Calculate the variance of \(\text{X}\)

Solution

We need to find the marginal distribution function of \(X\) first:

We know that,
$$
\text{f}_{\text{X}}(\text{x})=\sum_{\text{y}} \text{f(x, y)}=\text{P(X=x)}, \quad \text{x in S}_{\text{x}}
$$
Now,
$$
\
$$
$$
\begin{align}&\text{P(X=1)}=\frac{1}{6}+\frac{1}{3}=\frac{1}{2}\\ \\
&\text{P}(\text{X}=2)=\frac{1}{8}+\frac{1}{12}=\frac{5}{24} \\ \\
&\text{P}(\text{X}=3)=\frac{1}{6}+\frac{1}{8}=\frac{7}{24}
\end{align}
$$
Therefore,
$$
\text{E}(\text{X})=\sum_{\text{x}=1}^{3} x P_{\text{X}}(\text{x})=1 * \frac{1}{2}+2 * \frac{5}{24}+3 * \frac{7}{24}=\frac{43}{24}
$$
and,
$$
\text{E}\left(\text{X}^{2}\right)=\sum_{\text{x}=1}^{3} \text{x}^{2}(\text{x})=1^{2} * \frac{1}{2}+2^{2} * \frac{5}{24}+3^{2} * \frac{7}{24}=\frac{95}{24}
$$
Thus,
$$
\begin{aligned}
\operatorname{Var}(\text{X}) &=\text{E}\left(\text{X}^{2}\right)-[\text{E}(\text{X})]^{2} \\
&=\frac{95}{24}-\left(\frac{43}{95}\right)^{2}=3.992
\end{aligned}
$$
Note:

We can calculate the variance and the standard deviation of \(\text{Y}\) in a similar manner.

Exam tips:

Let \(\alpha\) and \(\beta\) be non-zero constants. Then, it can be proven that:
i) \(\operatorname{Var}(\alpha)=0\)
ii) \(\operatorname{Var}(\alpha \text{X})=\alpha^{2} * \operatorname{Var}(\text{X})\)
iii) \(\operatorname{Var}(\alpha \text{X}+\beta)=\alpha^{2} * \operatorname{Var}(\text{X})\)

Learning Outcome

Topic 3. d: Multivariate Random Variables – Calculate variance and standard deviation for conditional and marginal http://www.gulfportpharmacy.com/ probability distributions for discrete random variables only.

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.