// Numbas version: exam_results_page_options {"name": "Simon'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": [{"statement": "

Answer the following questions on the Binomial Distribution.

\n

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

\n

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

", "parts": [{"gaps": [{"minValue": "{ans1}", "precision": "3", "extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "variableReplacements": [], "correctAnswerFraction": false, "showPrecisionHint": true, "precisionType": "dp", "scripts": {}, "strictPrecision": false, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "unitTests": [], "allowFractions": false, "precisionPartialCredit": 0, "mustBeReducedPC": 0, "type": "numberentry", "customMarkingAlgorithm": "", "notationStyles": ["plain", "en", "si-en"], "maxValue": "{ans1}", "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "showCorrectAnswer": true, "marks": 0, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "scripts": {}, "type": "gapfill", "customMarkingAlgorithm": "", "variableReplacements": [], "prompt": "\n \n \n

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

\n \n \n ", "unitTests": [], "variableReplacementStrategy": "originalfirst", "sortAnswers": false}, {"gaps": [{"minValue": "{ans2}", "precision": "3", "extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "variableReplacements": [], "correctAnswerFraction": false, "showPrecisionHint": true, "precisionType": "dp", "scripts": {}, "strictPrecision": false, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "unitTests": [], "allowFractions": false, "precisionPartialCredit": 0, "mustBeReducedPC": 0, "type": "numberentry", "customMarkingAlgorithm": "", "notationStyles": ["plain", "en", "si-en"], "maxValue": "{ans2}", "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "showCorrectAnswer": true, "marks": 0, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "scripts": {}, "type": "gapfill", "customMarkingAlgorithm": "", "variableReplacements": [], "prompt": "

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

", "unitTests": [], "variableReplacementStrategy": "originalfirst", "sortAnswers": false}], "variables": {"tans2": {"name": "tans2", "description": "", "definition": "binomialCDF(x2,n,p)", "group": "Ungrouped variables", "templateType": "anything"}, "v3": {"name": "v3", "description": "", "definition": "switch(x2>2,1,0)", "group": "Ungrouped variables", "templateType": "anything"}, "ans1": {"name": "ans1", "description": "", "definition": "precround(tans1,3)", "group": "Ungrouped variables", "templateType": "anything"}, "n": {"name": "n", "description": "", "definition": "random(6..20)", "group": "Ungrouped variables", "templateType": "anything"}, "x2": {"name": "x2", "description": "", "definition": "random(2,3,4)", "group": "Ungrouped variables", "templateType": "anything"}, "tol": {"name": "tol", "description": "", "definition": "0.001", "group": "Ungrouped variables", "templateType": "anything"}, "x1": {"name": "x1", "description": "", "definition": "round((w+(100-w)*(n-1))/100)", "group": "Ungrouped variables", "templateType": "anything"}, "ans2": {"name": "ans2", "description": "", "definition": "precround(tans2,3)", "group": "Ungrouped variables", "templateType": "anything"}, "tans1": {"name": "tans1", "description": "", "definition": "binomialPDF(x1,n,p)", "group": "Ungrouped variables", "templateType": "anything"}, "v4": {"name": "v4", "description": "", "definition": "switch(x2>3,1,0)", "group": "Ungrouped variables", "templateType": "anything"}, "p": {"name": "p", "description": "", "definition": "random(0.1..0.9#0.1)", "group": "Ungrouped variables", "templateType": "anything"}, "w": {"name": "w", "description": "", "definition": "random(1..100)", "group": "Ungrouped variables", "templateType": "anything"}}, "tags": [], "preamble": {"js": "", "css": ""}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "functions": {}, "variablesTest": {"maxRuns": 100, "condition": "ans1>0.01 and ans2>0.01"}, "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"}, "name": "Simon's copy of Binomial (practice of formula)", "ungrouped_variables": ["w", "ans1", "ans2", "n", "p", "v3", "v4", "tol", "x2", "x1", "tans1", "tans2"], "variable_groups": [], "extensions": ["stats"], "advice": "

If a random variable $X$ follows a binomial distribution with parameters $n$ and $p$, then the probability of $r$ successes out of $n$ trials is given by:

\n

$P(X=r)=\\binom{n}{r}p^{r}q^{n-r}$

\n

where

\n

$p=$ probability of success for each trial, $q=1-p=$probability of failure for each trial, and $\\binom{n}{r} = ^nC_r= \\frac{n!}{r!(n-r)!}$

\n

\n

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

\n

to 3 decimal places.

\n

\n

(b)

\n

We have:

\n

\\[ \\begin{eqnarray*}  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

", "type": "question", "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}