// Numbas version: finer_feedback_settings {"name": "Probability, expectation and standard deviation of binomial distribution", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"condition": "", "maxRuns": 100}, "tags": ["checked2015", "MAS1403"], "variables": {"thisaswell": {"description": "", "templateType": "anything", "definition": "\"our selection contains no more than \"", "name": "thisaswell", "group": "Ungrouped variables"}, "prob1": {"description": "", "templateType": "anything", "definition": "precround(tprob1,3)", "name": "prob1", "group": "Ungrouped variables"}, "v": {"description": "", "templateType": "anything", "definition": "if(thatnumber=1,0,1)", "name": "v", "group": "Ungrouped variables"}, "descx": {"description": "", "templateType": "anything", "definition": "\"the number of chocolate chip cookies\"", "name": "descx", "group": "Ungrouped variables"}, "what": {"description": "", "templateType": "anything", "definition": "\"daily sales.\"", "name": "what", "group": "Ungrouped variables"}, "something": {"description": "", "templateType": "anything", "definition": "''", "name": "something", "group": "Ungrouped variables"}, "number1": {"description": "", "templateType": "anything", "definition": "random(5..12)", "name": "number1", "group": "Ungrouped variables"}, "sd": {"description": "", "templateType": "anything", "definition": "precround(sqrt(number1*prob*(1-prob)),3)", "name": "sd", "group": "Ungrouped variables"}, "prob": {"description": "", "templateType": "anything", "definition": "thismany/100", "name": "prob", "group": "Ungrouped variables"}, "prob2": {"description": "", "templateType": "anything", "definition": "precround(tprob2,3)", "name": "prob2", "group": "Ungrouped variables"}, "tprob1": {"description": "", "templateType": "anything", "definition": "binomialpdf(thisnumber,number1,prob)", "name": "tprob1", "group": "Ungrouped variables"}, "thismany": {"description": "", "templateType": "anything", "definition": "random(15..20)", "name": "thismany", "group": "Ungrouped variables"}, "tprob2": {"description": "", "templateType": "anything", "definition": "binomialcdf(thatnumber,number1,prob)", "name": "tprob2", "group": "Ungrouped variables"}, "pre": {"description": "", "templateType": "anything", "definition": "' '", "name": "pre", "group": "Ungrouped variables"}, "descx1": {"description": "", "templateType": "anything", "definition": "\"number of chocolate chip cookies in our sample:\"", "name": "descx1", "group": "Ungrouped variables"}, "thisnumber": {"description": "", "templateType": "anything", "definition": "if(number1<6,random(2..3), if(number1<8,random(2..4),random(3..6)))", "name": "thisnumber", "group": "Ungrouped variables"}, "else": {"description": "", "templateType": "anything", "definition": "\"biscuits are selected at random.\"", "name": "else", "group": "Ungrouped variables"}, "thatnumber": {"description": "", "templateType": "anything", "definition": "random(1,2)", "name": "thatnumber", "group": "Ungrouped variables"}, "things": {"description": "", "templateType": "anything", "definition": "\"chocolate chip cookies.\"", "name": "things", "group": "Ungrouped variables"}, "post": {"description": "", "templateType": "anything", "definition": "\"% of biscuits made by a baker are chocolate chip cookies.\"", "name": "post", "group": "Ungrouped variables"}, "this": {"description": "", "templateType": "anything", "definition": "\"our selection contains exactly \"", "name": "this", "group": "Ungrouped variables"}, "tol": {"description": "", "templateType": "anything", "definition": "0.001", "name": "tol", "group": "Ungrouped variables"}}, "name": "Probability, expectation and standard deviation of binomial distribution", "advice": "\n

a)

\n

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

\n

2. The expectation is given by $\\operatorname{E}[X]=n\\times p=\\var{number1}\\times \\var{prob}=\\var{number1*prob}$

\n

3. $\\operatorname{stdev}(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}) &=& \\dbinom{\\var{number1}}{\\var{thisnumber}}\\times\\var{prob}^{\\var{thisnumber}}\\times(1-\\var{prob})^{\\var{number1-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

 

\n ", "showQuestionGroupNames": false, "statement": "

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

\n

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

\n

 

\n

 

\n

 

\n

 

", "variable_groups": [], "metadata": {"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", "licence": "Creative Commons Attribution 4.0 International", "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.

"}, "parts": [{"gaps": [{"allowFractions": false, "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": false, "marks": 0.25, "minValue": "number1", "maxValue": "number1", "scripts": {}, "correctAnswerFraction": false}, {"allowFractions": false, "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": false, "marks": 0.25, "minValue": "prob", "maxValue": "prob", "scripts": {}, "correctAnswerFraction": false}, {"allowFractions": false, "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": false, "marks": 0.5, "minValue": "number1*thismany/100", "maxValue": "number1*thismany/100", "scripts": {}, "correctAnswerFraction": false}, {"allowFractions": false, "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": false, "marks": 1, "minValue": "sd-tol", "maxValue": "sd+tol", "scripts": {}, "correctAnswerFraction": false}], "showCorrectAnswer": true, "type": "gapfill", "marks": 0, "scripts": {}, "prompt": "\n

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).

\n "}, {"gaps": [{"allowFractions": false, "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": false, "marks": 1, "minValue": "prob1-tol", "maxValue": "prob1+tol", "scripts": {}, "correctAnswerFraction": false}, {"allowFractions": false, "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": false, "marks": 1, "minValue": "prob2-tol", "maxValue": "prob2+tol", "scripts": {}, "correctAnswerFraction": false}], "showCorrectAnswer": true, "type": "gapfill", "marks": 0, "scripts": {}, "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 "}], "ungrouped_variables": ["pre", "descx1", "something", "thisnumber", "what", "things", "descx", "tol", "prob", "thisaswell", "else", "thismany", "number1", "post", "prob2", "prob1", "thatnumber", "this", "v", "tprob1", "tprob2", "sd"], "type": "question", "preamble": {"js": "", "css": ""}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "pickQuestions": 0, "name": ""}], "functions": {}, "rulesets": {}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}