// Numbas version: exam_results_page_options {"name": "Calculate probability, expected value and variance of a Poisson distribution, ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"v4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(y2>3,1,0)", "description": "", "name": "v4"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans2,3)", "description": "", "name": "ans2"}, "tans": {"templateType": "anything", "group": "Ungrouped variables", "definition": "poissonPDF(y1,p)", "description": "", "name": "tans"}, "y2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2,3,4)", "description": "", "name": "y2"}, "tans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-poissonPDF(0,p)-poissonPDF(1,p)-poissonPDF(2,p)-v3*poissonPDF(3,p)-v4*poissonPDF(4,p)", "description": "", "name": "tans2"}, "la": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..24)", "description": "", "name": "la"}, "y1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(la>15,random(2..6),random(0..5))", "description": "", "name": "y1"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "la/4", "description": "", "name": "p"}, "ans": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans,3)", "description": "", "name": "ans"}, "v3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(y2>2,1,0)", "description": "", "name": "v3"}}, "ungrouped_variables": ["ans", "ans2", "la", "p", "tans", "tans2", "tol", "v3", "v4", "y1", "y2"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Calculate probability, expected value and variance of a Poisson distribution, ", "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "ans", "maxValue": "ans", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "

Compute $\\operatorname{P}(Y=\\var{y1})= $ [[0]]

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "{ans2-tol}", "maxValue": "{ans2+tol}", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "

Compute $\\operatorname{P}(Y \\gt \\var{y2}) = $ [[0]]

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{p}", "minValue": "{p}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{p}", "minValue": "{p}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Find:

\n
    \n
  1. $\\operatorname{E}[Y] = $ [[0]]
  2. \n
  3. $\\operatorname{Var}(Y) = $ [[1]]
  4. \n
", "showCorrectAnswer": true, "marks": 0}], "statement": "

Enter your answers to the following questions to $3$ decimal places.

\n

Suppose $Y \\sim \\operatorname{Poisson}(\\var{p})$.

", "tags": ["checked2015", "cr1", "discrete random variable", "distributions", "expectation of poisson distribution", "MAS1604", "MAS2304", "poisson distribution", "Poisson distribution", "Probability", "probability", "random variables", "statistics", "tested1", "variance of poisson distribution"], "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": "Numbas.jme.display.texOps['prob'] = function(thing,texArgs) {\n return '\\\\operatorname{P}\\\\left( '+texArgs.join(', ')+' \\\\right)';\n}"}, "type": "question", "metadata": {"notes": "

7/07/2012:

\n

Added tags.

\n

Cannot access the poisson functions in the  stats extension and will not run. Issue posted.

\n

Set new tolerance variable tol=0.001 for first two questions.

\n

Cannot check calculations at present under Test Run.

\n

22/07/2012:

\n

Added description.

\n

Corrected typo in formula for Poisson Distribution.

\n

Can now test as stats extension ticked.

\n

Checked calculation.

\n

31/07/2012:

\n

Question appears to be working correctly.

\n

20/12/2012:

\n

Checked calculations agains standard tables, OK. Rounding, OK. Added cr1 tag. Do not use the jstats poissoncdf function! The poissonpdf is OK.

\n

Added tested1 tag.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

$Y \\sim \\operatorname{Poisson}(p)$. Find $P(Y=a)$, $P(Y \\gt b)$, $E[Y],\\;\\operatorname{Var}(Y)$.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

a)

\n

If $Y \\sim \\operatorname{Poisson}(\\lambda)$ then

\n

\\[P(Y=y)=\\frac{\\lambda^y\\;e^{-\\lambda}}{y!}\\]

\n

Hence

\n

\\[ \\operatorname{P}(Y=\\var{y1}) = \\simplify[std,!otherNumbers]{({p}^{y1}*e^{-p}) / {y1}!} = \\var{tans} \\approx \\var{ans} \\]

\n

to 3 decimal places.

\n

b)

\n

\\begin{align}
\\operatorname{P} (Y \\gt \\var{y2}) &= 1-P(Y \\le \\var{y2}) = \\simplify[std]{ 1-prob(Y = 0) - prob(Y = 1) - prob(Y = 2) - {v3} * prob(Y = 3) - {v4} * prob(Y = 4)} \\\\
&= \\simplify[unitFactor,zeroTerm,zeroFactor]{1 -Exp( -{p}) -({p} * Exp( -{p})) -(({p} ^ 2 * Exp( -{p})) / 2) -{ v3} * (({p} ^ 3 * Exp( -{p})) / 6) -{ v4} * (({p} ^ 4 * Exp( -{p})) / 24)} \\\\
&= \\var{tans2} \\\\
&\\approx \\var{ans2}
\\end{align}

\n

to 3 decimal places.

\n

c)

\n

For the Poisson distribution $\\operatorname{Poisson}(\\lambda)$ we have:

\n

\\[ \\operatorname{E}[Y] = \\operatorname{Var}(Y) = \\lambda \\]

\n

Hence in this case:

\n

\\begin{align}
\\operatorname{E}[Y] &= \\var{p} \\\\
\\operatorname{Var}(Y) &= \\var{p}
\\end{align}

", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}