// Numbas version: exam_results_page_options {"name": "Calculate probabilities from a binomial 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": {"thisnumber": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(number1<6,random(2..3), if(number1<8,random(2..4),random(3..6)))", "description": "", "name": "thisnumber"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "descx1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"number of chocolate chip cookies in our sample:\"", "description": "", "name": "descx1"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..20)", "description": "", "name": "thismany"}, "post": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"% of biscuits made by a baker are chocolate chip cookies.\"", "description": "", "name": "post"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tprob1,3)", "description": "", "name": "prob1"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"our selection contains exactly \"", "description": "", "name": "this"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(thatnumber=1,0,1)", "description": "", "name": "v"}, "prob": {"templateType": "anything", "group": "Ungrouped variables", "definition": "thismany/100", "description": "", "name": "prob"}, "tprob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "binomialpdf(thisnumber,number1,prob)", "description": "", "name": "tprob1"}, "else": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"biscuits are selected at random.\"", "description": "", "name": "else"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "''", "description": "", "name": "something"}, "thisaswell": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"our selection contains no more than \"", "description": "", "name": "thisaswell"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"chocolate chip cookies.\"", "description": "", "name": "things"}, "descx": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"the number of chocolate chip cookies\"", "description": "", "name": "descx"}, "sd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sqrt(number1*prob*(1-prob)),3)", "description": "", "name": "sd"}, "thatnumber": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,2)", "description": "", "name": "thatnumber"}, "tprob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "binomialcdf(thatnumber,number1,prob)", "description": "", "name": "tprob2"}, "prob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tprob2,3)", "description": "", "name": "prob2"}, "what": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"daily sales.\"", "description": "", "name": "what"}, "pre": {"templateType": "anything", "group": "Ungrouped variables", "definition": "' '", "description": "", "name": "pre"}, "number1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..12)", "description": "", "name": "number1"}}, "ungrouped_variables": ["pre", "descx1", "something", "thisnumber", "what", "things", "descx", "tol", "prob", "thisaswell", "else", "thismany", "number1", "post", "prob2", "prob1", "thatnumber", "this", "v", "tprob1", "tprob2", "sd"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Calculate probabilities from a binomial distribution", "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "number1", "minValue": "number1", "correctAnswerFraction": false, "marks": 0.25, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "prob", "minValue": "prob", "correctAnswerFraction": false, "marks": 0.25, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "number1*thismany/100", "minValue": "number1*thismany/100", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "sd+tol", "minValue": "sd-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Assuming a binomial distribution for $X$ , {descX}, write down the values of $n$ and $p$.

\n

$X \\sim \\operatorname{Bin}(n,p)$

\n

$n=\\; $?[[0]]        $p=\\;$?[[1]]

\n

Find $\\operatorname{E}[X]$ the expected {descX1}

\n

$\\operatorname{E}[X]=$?[[2]]

\n

Find the standard deviation for the {descX1}

\n

Standard deviation = ? [[3]] (to 3 decimal places).

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

Find the probability that {this} $\\var{thisnumber}$ {things}

\n

$\\operatorname{P}(X=\\var{thisnumber})=$? [[0]] (to 3 decimal places).

\n

 

\n

Find the probability that {thisaswell} {thatnumber} {things}

\n

Probability = ? [[1]] (to 3 decimal places).

\n ", "showCorrectAnswer": true, "marks": 0}], "statement": "

{pre} $\\var{thismany}$ {post}

\n

{something} $\\var{number1}$ {else}

", "tags": ["binomial distribution", "Binomial Distribution", "Binomial distribution", "checked2015", "expectation", "expected number", "MAS1403", "probability", "Probability", "sc", "standard deviation", "statistical distributions", "statistics"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

31/12/2012:

\n

Can be configured to other applications using the string variables supplied. Hence added tag sc.

\n

Not as yet properly tested.

\n

13/01/2013:

\n

Used stats extension functions binomialpdf and binomialcdf instead of calculating insitu.

\n

26/11/2014:

\n

Minor edits to the question and advice to better reflect the notation used in the coursse, e.g. Bin rather than bin.

\n

", "licence": "Creative Commons Attribution 4.0 International", "description": "\n \t\t

Application of the binomial distribution given probabilities of success of an event.

\n \t\t

Finding probabilities using the binomial distribution.

\n \t\t"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

a)

\n

1. $X \\sim \\operatorname{Bin}(\\var{number1},\\var{prob})$, so $n= \\var{number1},\\;\\;p=\\var{prob}$.

\n

2. The expected number (or mean) is given by $\\operatorname{E}[X]=n\\times p=\\var{number1}\\times \\var{prob}=\\var{number1*prob}$

\n

3. $\\operatorname{SD}(X)=\\sqrt{\\operatorname{Var}(X)}=\\sqrt{n\\times p \\times (1-p)}=\\sqrt{\\var{number1}\\times \\var{prob} \\times \\var{1-prob}}=\\var{sd}$ to 3 decimal places.

\n

b)

\n

1. \\[ \\begin{eqnarray*}\\operatorname{P}(X = \\var{thisnumber}) &=& ^\\var{number1}C_\\var{thisnumber}\\times\\var{prob}^{\\var{thisnumber}}\\times\\var{1-prob}^{\\var{number1}-\\var{thisnumber}}\\\\&=& \\var{comb(number1,thisnumber)} \\times\\var{prob}^{\\var{thisnumber}}\\times\\var{1-prob}^{\\var{number1-thisnumber}}\\\\&=&\\var{prob1}\\end{eqnarray*} \\] to 3 decimal places.

\n

 

\n

2. 

\n

\\[ \\begin{eqnarray*}\\operatorname{P}(X \\leq \\var{thatnumber})& =& \\simplify[all,!collectNumbers]{P(X = 0) + P(X = 1) + {v}*P(X = 2)}\\\\& =& \\simplify[zeroFactor,zeroTerm,unitFactor]{{1 -prob} ^ {number1}+ {number1} *{prob} *{1 -prob} ^ {number1 -1} + {v} * ({number1} * {number1 -1}/2)* {prob} ^ 2 *( {1 -prob} ^ {number1 -2})}\\\\& =& \\var{prob2}\\end{eqnarray*} \\]

\n

to 3 decimal places.

\n

 

", "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/"}]}