// Numbas version: exam_results_page_options {"name": "Maria's copy of Binomial (practice of formula)", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "name": "Maria's copy of Binomial (practice of formula)", "metadata": {"description": "

$X \\sim \\operatorname{Binomial}(n,p)$. Find $P(X=a)$, $P(X \\leq b)$, $E[X],\\;\\operatorname{Var}(X)$.

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "extensions": ["stats"], "ungrouped_variables": ["w", "ans1", "ans2", "n", "p", "v3", "v4", "tol", "x2", "x1", "tans1", "tans2"], "tags": ["binomial distribution", "Binomial Distribution", "Binomial distribution", "CDF", "cdf", "CDF of binomial distribution", "cr1", "cumulative density function", "Discrete random variables.", "distributions", "Expectation of binomial distribution", "probability", "Probability", "random variables", "REBEL", "rebel", "Rebel", "rebelmaths", "statistics", "tested1", "variance of binomial distribution"], "parts": [{"marks": 0, "gaps": [{"marks": 1, "variableReplacements": [], "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "numberentry", "minValue": "{ans1-tol}", "allowFractions": false, "maxValue": "{ans1+tol}", "showPrecisionHint": false, "showCorrectAnswer": true}], "prompt": "\n \n \n

Compute $P(X=\\var{x1})=\\;\\;$[[0]] (to 3 decimal places).

\n \n \n ", "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "gapfill", "showCorrectAnswer": true, "variableReplacements": []}, {"marks": 0, "gaps": [{"marks": 1, "variableReplacements": [], "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "numberentry", "minValue": "{ans2-tol}", "allowFractions": false, "maxValue": "{ans2+tol}", "showPrecisionHint": false, "showCorrectAnswer": true}], "prompt": "

Compute $P(X\\le\\var{x2})=\\;\\;$[[0]] (to 3 decimal places).

", "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "gapfill", "showCorrectAnswer": true, "variableReplacements": []}], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "variables": {"v3": {"description": "", "name": "v3", "templateType": "anything", "group": "Ungrouped variables", "definition": "switch(x2>2,1,0)"}, "tans2": {"description": "", "name": "tans2", "templateType": "anything", "group": "Ungrouped variables", "definition": "binomialCDF(x2,n,p)"}, "p": {"description": "", "name": "p", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.9#0.1)"}, "tol": {"description": "", "name": "tol", "templateType": "anything", "group": "Ungrouped variables", "definition": "0.001"}, "w": {"description": "", "name": "w", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..100)"}, "x2": {"description": "", "name": "x2", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(2,3,4)"}, "ans2": {"description": "", "name": "ans2", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans2,3)"}, "n": {"description": "", "name": "n", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(6..20)"}, "ans1": {"description": "", "name": "ans1", "templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans1,3)"}, "v4": {"description": "", "name": "v4", "templateType": "anything", "group": "Ungrouped variables", "definition": "switch(x2>3,1,0)"}, "tans1": {"description": "", "name": "tans1", "templateType": "anything", "group": "Ungrouped variables", "definition": "binomialPDF(x1,n,p)"}, "x1": {"description": "", "name": "x1", "templateType": "anything", "group": "Ungrouped variables", "definition": "round((w+(100-w)*(n-1))/100)"}}, "preamble": {"css": "", "js": ""}, "question_groups": [{"pickQuestions": 0, "name": "", "pickingStrategy": "all-ordered", "questions": []}], "variable_groups": [], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

Answer the following questions on the Binomial Distribution.

\n

Suppose \\[X \\sim \\operatorname{Binomial}(\\var{n},\\var{p}),\\]

\n

that is $n=\\var{n}$ and $p=\\var{p}$.

", "type": "question", "advice": "

a)
\\[\\simplify[std,!otherNumbers]{P(X = {x1}) = {n}! / ({n -x1}! * {x1}!) * {p} ^ {x1} * (1 -{p}) ^ {n -x1}} = \\var{ans1}\\]

\n

to 3 decimal places.

\n

b)

\n

We have:

\n

\\[ \\begin{eqnarray*} F_X (\\var{x2}) &=& P(X \\le \\var{x2}) =\\simplify[std]{ P(X = 0) + P(X = 1) + P(X = 2) + {v3} * P(X = 3) + {v4} * P(X = 4)}\\\\ &=& \\simplify[unitFactor,zeroTerm,zeroFactor]{(1 -{p}) ^ {n} + {n} * (1 -{p}) ^ {n -1} * {p} + {(n * (n -1)) / 2} * (1 -{p}) ^ {n -2} * {p} ^ 2 + {v3} * {Comb(n , 3)} * (1 -{p}) ^ {n -3} * {p} ^ 3 + {v4} * {Comb(n , 4)} * (1 -{p}) ^ {n -4} * {p} ^ 4}\\\\ &=&\\var{ans2} \\end{eqnarray*} \\]
to 3 decimal places.

\n

", "showQuestionGroupNames": false, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Maria Aneiros", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3388/"}]}]}], "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Maria Aneiros", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3388/"}]}