// Numbas version: finer_feedback_settings {"name": "XProbability mass function of string of heads from weighted coin,", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"notes": "
04/02/2013:
\nFirst draft finished.
", "description": "A weighted coin with given $P(H),\\;P(T)$ is tossed 3 times. Let $X$ be the random variable which denotes the longest string of consecutive heads that occur during these tosses. Find the Probability Mass Function (PMF), expectation and variance of $X$.
", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "preamble": {"css": "", "js": ""}, "advice": "a)
\nEvent | \nHHH | HHT | HTH | HTT |
---|---|---|---|---|
Probability | \n$\\var{h}^3=\\var{h^3}$ | \n$\\var{h}^2\\times\\var{t}=\\var{h^2*t}$ | \n$\\var{h}^2\\times\\var{t}=\\var{h^2*t}$ | \n$\\var{h}\\times\\var{t}^2=\\var{h*t^2}$ | \n
$X$ | \n$3$ | \n$2$ | \n$1$ | \n$1$ | \n
Event | \nTHH | THT | TTH | TTT |
---|---|---|---|---|
Probability | \n$\\var{h}^2\\times\\var{t}=\\var{h^2*t}$ | \n$\\var{h}\\times\\var{t}^2=\\var{h*t^2}$ | \n$\\var{h}\\times\\var{t}^2=\\var{h*t^2}$ | \n$\\var{t}^3=\\var{t^3}$ | \n
$X$ | \n$2$ | \n$1$ | \n$1$ | \n$0$ | \n
So we see that:
\n$P(X=0)=\\var{h0},\\;P(X=1)=\\var{h^2*t}+3\\times \\var{h*t^2}=\\var{h1}$
\n$P(X=2)=2\\times \\var{h^2*t}=\\var{h2},\\;P(X=3)=\\var{h3}$
\nb)
\nThe expectation is given by:
\n$\\operatorname{E}[X]=\\sum x \\;P(X=x)=0\\times \\var{h0}+1\\times \\var{h1}+2\\times \\var{h2}+3\\times \\var{h3}=\\var{ex}$ (exactly).
\nc)
\nFor this discrete distribution we use the formula:
\n\\[\\begin{eqnarray*}\\operatorname{Var}(X)&=&\\operatorname{E}[X^2]-\\operatorname{E}(X)^2\\\\&=&0\\times \\var{h0}+1\\times \\var{h1}+4\\times \\var{h2}+9\\times \\var{h3}-\\var{ex}^2\\\\&=&\\var{var}\\end{eqnarray*}\\] to 4 decimal places.
", "rulesets": {}, "question_groups": [{"pickingStrategy": "all-ordered", "name": "", "pickQuestions": 0, "questions": []}], "functions": {}, "ungrouped_variables": ["h2", "h", "h0", "h1", "thismany", "t", "tol", "h3", "var", "ex"], "showQuestionGroupNames": false, "name": "XProbability mass function of string of heads from weighted coin,", "tags": ["checked2015", "counting", "discrete distribution", "discrete random variable", "expectation", "Probability", "probability", "probability mass function", "random variab;e", "runs", "sample space", "statistics", "variance"], "variablesTest": {"condition": "", "maxRuns": 100}, "variable_groups": [], "variables": {"var": {"name": "var", "definition": "precround(9*h3+4*h2+h1-ex^2,4)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "thismany": {"name": "thismany", "definition": "3", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "tol": {"name": "tol", "definition": "0.0001", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "h": {"name": "h", "definition": "random(0.2..0.9#0.05 except 0.5)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "h0": {"name": "h0", "definition": "t^3", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "ex": {"name": "ex", "definition": "3*h3+2*h2+h1", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "h1": {"name": "h1", "definition": "h^2*t+3*h*t^2", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "h3": {"name": "h3", "definition": "h^3", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "t": {"name": "t", "definition": "1-h", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "h2": {"name": "h2", "definition": "2*h^2*t", "group": "Ungrouped variables", "description": "", "templateType": "anything"}}, "statement": "A coin has two faces, $H$ or $T$. It is weighted so that $P(H)=\\var{h}$ and $P(T)=\\var{t}$ and is tossed $\\var{thismany}$ times.
\nLet $X$ be the random variable which denotes the longest string of consecutive heads that occur during these tosses.
\nCompute the:
\nProbability Mass Function (PMF) of $X$.
\nExpectation of $X$.
\nVariance of $X$.
", "parts": [{"type": "gapfill", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 0, "prompt": "$X$ can take the values $0,\\;1,\\;2$ or $3$.
\nComplete the tables below in order to find the PMF. You must input all numbers as exact decimals - no rounding or approximations.
\nFirst, find the probability of each outcome on tossing the coin.
\nEvent | \nHHH | HHT | HTH | HTT |
---|---|---|---|---|
Probability | \n[[0]] | \n[[1]] | \n[[2]] | \n[[3]] | \n
$X$ | \n$3$ | \n$2$ | \n$1$ | \n$1$ | \n
Event | \nTHH | THT | TTH | TTT |
---|---|---|---|---|
Probability | \n[[4]] | \n[[5]] | \n[[6]] | \n[[7]] | \n
$X$ | \n$2$ | \n$1$ | \n$1$ | \n$0$ | \n
Use the information from the above table to find the PMF for $X$.
\n$X$ | \n$0$ | $1$ | $2$ | $3$ |
---|---|---|---|---|
$P(X=x)$ | \n[[8]] | \n[[9]] | \n[[10]] | \n[[11]] | \n
Find the expectation:
\n$\\operatorname{E}[X]=\\;$?[[0]] (input as an exact decimal).
", "showCorrectAnswer": true, "gaps": [{"maxValue": "ex", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "marks": 1, "minValue": "ex", "showCorrectAnswer": true, "variableReplacements": [], "correctAnswerFraction": false}], "variableReplacements": []}, {"type": "gapfill", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 0, "prompt": "Find the variance:
\n$\\operatorname{Var}(X)=\\;$[[0]] (to 4 decimal places).
", "showCorrectAnswer": true, "gaps": [{"maxValue": "var+tol", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "marks": 1, "minValue": "var-tol", "showCorrectAnswer": true, "variableReplacements": [], "correctAnswerFraction": false}], "variableReplacements": []}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}