// Numbas version: finer_feedback_settings {"name": "PB2 - Covariance & Independence", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "PB2 - Covariance & Independence", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "", "advice": "
a) If two random variables are independent then we can assume that their covariance is 0.
\nThe formula for covariance is:
\n\\begin{align}
Cov(X,Y) &= E[XY] - E[X]E[Y].
\\end{align}
By definition, if two random variables are independent then:
\n\\begin{align}
E[XY] &= E[X]E[Y].
\\end{align}
Hence, if we substute this back into our formula for covariance, we find
\n\\begin{align}
Cov(X,Y) &= E[XY] - E[X]E[Y] \\\\
&= E[X]E[Y] - E[X]E[Y] \\\\
&= 0.
\\end{align}
b) To calculate the covariance we can use the formula from part a), i.e.,
\n\\begin{align}
Cov(X,Y) &= E[XY] - E[X]E[Y].
\\end{align}
Hence, we must calculate $E[X]$, $E[Y]$, and $E[XY]$.
\nFirst let us caculate $E[X]$,
\n\\begin{align}
E[X] &= \\sum_{i=1}^3x_i\\cdot P(X=x_i) \\\\
&= (-1)\\cdot\\frac{1}{3} + 0\\cdot\\frac{1}{3} +1\\cdot\\frac{1}{3} \\\\
&= -\\frac{1}{3} + 0 + \\frac{1}{3} \\\\
&= 0.
\\end{align}
Since $y=X^2$, the random variable $Y$ can take the value $0$ ($Y=0^2$) or $1$ ($Y=1^2=(-1)^2$) with the probabilities $\\frac{1}{3}$ and $\\frac{2}{3}$, respectively.
\nHence,
\n\\begin{align}
E[Y] &= \\sum_{i=1}^2y_i\\cdot P(Y=y_i) \\\\
&= 0\\cdot\\frac{1}{3} + 1\\cdot\\frac{2}{3} \\\\
&= \\frac{2}{3}.
\\end{align}
Finally, we need to caluclate $E[XY]$,
\n\\begin{align}
E[XY] &= \\sum_{i=1}^3x_i\\cdot y_i\\cdot P(X=x_i,Y=y_i) \\\\
&= (-1)\\cdot (-1)^2 \\cdot \\frac{1}{3} + 0 \\cdot 0^2 \\cdot\\frac{1}{3} +1\\cdot 1^2 \\cdot \\frac{1}{3} \\\\
&= -\\frac{1}{3} + 0 + \\frac{1}{3} \\\\
&= 0.
\\end{align}
Thus,
\n\\begin{align}
Cov(X,Y) &= E[XY] - E[X]E[Y] \\\\
&= 0 - 0\\cdot \\frac{2}{3} \\\\
&= 0.
\\end{align}
c) No we cannot assume that $X$ and $Y$ are independent. Despite $Cov(X,Y)=0$ you can clearly see that $X$ and $Y$ are not independent variables since they are linearly related by $Y=X^2$.
Although two random variables being independent does mean that their covariance will be $0$, this doesn't mean that the opposite cannot be assumed true, as we have shown you can have a covariance of $0$ even when the random variables are not independent.
\n\nUse this link to find some resources which will help you revise this topic.
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"expectedx": {"name": "expectedx", "group": "Ungrouped variables", "definition": "(-1)*1/3 + 0*1/3 + 1*1/3", "description": "Expected value of x
", "templateType": "anything", "can_override": false}, "expectedy": {"name": "expectedy", "group": "Ungrouped variables", "definition": "((-1)^2 * 1/3) + (0^2 * 1/3) + (1^2 * 1/3)", "description": "Expected value of y
", "templateType": "anything", "can_override": false}, "expectedxy": {"name": "expectedxy", "group": "Ungrouped variables", "definition": "(-1)*(-1)^2*1/3 + (0)*(0)^2*1/3 + (1)*(1)^2*1/3", "description": "Expected value of xy
", "templateType": "anything", "can_override": false}, "covxy": {"name": "covxy", "group": "Ungrouped variables", "definition": "expectedxy - expectedx*expectedy", "description": "Covariance
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["expectedx", "expectedy", "expectedxy", "covxy"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "a)", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "If two random variables $X$ and $Y$ are independent, what is their covariance, i.e., $Cov(X,Y)$?
", "minValue": "0", "maxValue": "0", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "b)", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Consider a discrete random variable $X$. You can see the possible values that $X$ can take, alongside the associated probabilities, in the table below.
\n| $x$ | \n-1 | \n0 | \n1 | \n
| $P(X=x)$ | \n$\\frac{1}{3}$ | \n$\\frac{1}{3}$ | \n$\\frac{1}{3}$ | \n
We have a second random variable $Y$. Let $Y=X^2$.
\nCalculate the covariance, i.e., $Cov(X,Y)$.
", "minValue": "covxy", "maxValue": "covxy", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "1_n_2", "useCustomName": true, "customName": "c)", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Looking at your answer to part b, can we assume that $X$ and $Y$ are independent random variables?
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["yes", "no"], "matrix": [0, "1"], "distractors": ["", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Lauren Desoysa", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21504/"}, {"name": "Megan Oliver", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/23526/"}], "resources": []}]}], "contributors": [{"name": "Lauren Desoysa", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21504/"}, {"name": "Megan Oliver", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/23526/"}]}