// Numbas version: exam_results_page_options {"showQuestionGroupNames": false, "type": "question", "name": "Etain's copy of Nigel's copy of Mathematics and statistics for bioinformatics", "metadata": {"description": "Questions used in a university course titled \"Mathematics and statistics for bioinformatics\"", "licence": "Creative Commons Attribution 4.0 International"}, "question_groups": [{"pickingStrategy": "all-ordered", "name": "", "questions": [{"name": "Find mean and standard deviation of differences between samples", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu1,sig1)),5)", "description": "", "name": "r1"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "5", "description": "", "name": "thismany"}, "sig1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1.5..2.5#0.5)", "description": "", "name": "sig1"}, "performing": {"templateType": "anything", "group": "Ungrouped variables", "definition": " 'working at $\\\\var{100}$ watts on an exercise machine' ", "description": "", "name": "performing"}, "r2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu2,sig2)),5)", "description": "", "name": "r2"}, "attempt": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'attempt'", "description": "", "name": "attempt"}, "meandiff": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(d)", "description": "", "name": "meandiff"}, "objects": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'people'", "description": "", "name": "objects"}, "mu1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(16..20#0.5)", "description": "", "name": "mu1"}, "sig2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sig1+random(-0.5..-0.2#0.1)", "description": "", "name": "sig2"}, "mu2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mu1+random(1..3#0.1)", "description": "", "name": "mu2"}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "list(vector(r2)-vector(r1))", "description": "", "name": "d"}, "stdiff": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(d,true),3)", "description": "", "name": "stdiff"}, "object": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'person'", "description": "", "name": "object"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Oxygen uptake values (mL/kg.min)'", "description": "", "name": "something"}}, "ungrouped_variables": ["meandiff", "performing", "attempt", "r1", "objects", "mu2", "object", "sig1", "thismany", "stdiff", "sig2", "something", "r2", "mu1", "d"], "functions": {}, "preamble": {"css": "", "js": ""}, "parts": [{"customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "prompt": "
Find the mean and standard deviation of the difference between first and second {attempt}s.
\nCalculate differences for second {attempt} – first {attempt}.
\nMean of difference = [[0]] (input as an exact decimal)
\nStandard deviation of difference = [[1]] (input to 3 decimal places)
", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "{meandiff}", "maxValue": "{meandiff}", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "mustBeReducedPC": 0}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "{stdiff}", "maxValue": "{stdiff}", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 0.5, "mustBeReducedPC": 0}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "statement": "{Something} for $\\var{thismany}$ {objects} {performing} were:
\n{capitalise(object)} | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
First {attempt} | \n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n
Second {attempt} | \n$\\var{r2[0]}$ | \n$\\var{r2[1]}$ | \n$\\var{r2[2]}$ | \n$\\var{r2[3]}$ | \n$\\var{r2[4]}$ | \n
An experiment is performed twice, each with $5$ outcomes
\n$x_i,\\;y_i,\\;i=1,\\dots 5$ . Find mean and s.d. of their differences $y_i-x_i,\\;i=1,\\dots 5$.
"}, "type": "question", "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "The table of differences is given by:
\n{capitalise(object)} | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
First {attempt} | \n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n
Second {attempt} | \n$\\var{r2[0]}$ | \n$\\var{r2[1]}$ | \n$\\var{r2[2]}$ | \n$\\var{r2[3]}$ | \n$\\var{r2[4]}$ | \n
Differences | \n$\\var{d[0]}$ | \n$\\var{d[1]}$ | \n$\\var{d[2]}$ | \n$\\var{d[3]}$ | \n$\\var{d[4]}$ | \n
The mean of the differences is $\\var{meandiff}$.
\nThe variance $V$ of the differences is
\n\\begin{align}
V &= \\frac{1}{4}\\left(\\simplify[]{({d[0]}^2+{d[1]}^2+{d[2]}^2+{d[3]}^2+{d[4]}^2)}-5\\times \\var{meandiff}^2\\right) \\\\
&= \\var{variance(d,true)}
\\end{align}
Hence the standard deviation is $\\sqrt{V}=\\var{stdiff}$ to 3 decimal places.
"}, {"name": "Find quartiles, range and interquartile range of a small sample, , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"sig": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(4..9)", "description": "", "name": "sig"}, "r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sort(r0)", "description": "", "name": "r1"}, "median": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.5*(r1[15]+r1[16])", "description": "", "name": "median"}, "var": {"templateType": "anything", "group": "Ungrouped variables", "definition": "variance(r0,true)", "description": "", "name": "var"}, "guess2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(guess1/4)", "description": "", "name": "guess2"}, "mean": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r0)", "description": "", "name": "mean"}, "sd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "stdev(r0,true)", "description": "", "name": "sd"}, "mu": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(30..50)", "description": "", "name": "mu"}, "uquartile": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.25*r1[23]+0.75*r1[24]", "description": "", "name": "uquartile"}, "guess4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(7*guess1/4)", "description": "", "name": "guess4"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "32", "description": "", "name": "n"}, "guess1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((r1[31]-r1[0])/4)", "description": "", "name": "guess1"}, "lquartile": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.75*r1[7]+0.25*r1[8]", "description": "", "name": "lquartile"}, "guess3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(guess1/2)", "description": "", "name": "guess3"}, "range": {"templateType": "anything", "group": "Ungrouped variables", "definition": "r1[31]-r1[0]", "description": "", "name": "range"}, "r0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu,sig)),32)", "description": "", "name": "r0"}, "stdev": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r0,true),2)", "description": "", "name": "stdev"}}, "ungrouped_variables": ["guess3", "guess2", "guess1", "r0", "r1", "guess4", "mean", "median", "n", "mu", "lquartile", "sig", "stdev", "var", "uquartile", "sd", "range"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{r1[0]}", "minValue": "{r1[0]}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{lquartile}", "minValue": "{lquartile}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{median}", "minValue": "{median}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{uquartile}", "minValue": "{uquartile}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{r1[31]}", "minValue": "{r1[31]}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n \n \nObtain the $5$ number summary MQMQM and input their values below as exact decimals:
\n \n \n \nMinimum | Lower Quartile | Median | Upper Quartile | Maximum |
---|---|---|---|---|
[[0]] | [[1]] | [[2]] | [[3]] | [[4]] |
Enter the interquartile range: [[0]]
\n \n \n \nInput as an exact decimal.
\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["{guess1}
", "{guess2}
", "{guess3}
", "{guess4}
"], "displayColumns": 4, "distractors": ["", "", "", ""], "shuffleChoices": true, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": [1, 0, 0, 0], "marks": 0}], "type": "gapfill", "prompt": "Without doing any further calculations, which of the following numbers do you think is likely to be closest to the sample standard deviation?
[[0]]
Given the following table of data, answer all the following questions:
\n \n \n \n$\\var{r0[0]}$ | $\\var{r0[1]}$ | $\\var{r0[2]}$ | $\\var{r0[3]}$ | $\\var{r0[4]}$ | $\\var{r0[5]}$ | $\\var{r0[6]}$ | $\\var{r0[7]}$ | $\\var{r0[8]}$ | $\\var{r0[9]}$ | $\\var{r0[10]}$ | $\\var{r0[11]}$ | $\\var{r0[12]}$ | $\\var{r0[13]}$ | $\\var{r0[14]}$ | $\\var{r0[15]}$ |
$\\var{r0[16]}$ | $\\var{r0[17]}$ | $\\var{r0[18]}$ | $\\var{r0[19]}$ | $\\var{r0[20]}$ | $\\var{r0[21]}$ | $\\var{r0[22]}$ | $\\var{r0[23]}$ | $\\var{r0[24]}$ | $\\var{r0[25]}$ | $\\var{r0[26]}$ | $\\var{r0[27]}$ | $\\var{r0[28]}$ | $\\var{r0[29]}$ | $\\var{r0[30]}$ | $\\var{r0[31]}$ |
11/07/2012:
\nAdded tags.
\nCalculations not tested yet.
\n23/07/2012:
\nAdded description.
\nChecked calculations as stats extension now available. OK.
\n3/08/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n19/12/2012:
\nChanged to new stats functions and replaced the uniform sample data by a normal sample.
\nChecked calculations. Note that the quartiles are defined differently from the stats extension definition - so used the Newcastle definition! Added query tag so that can be decided upon.
\nAdded tested1 tag.
\n21/12/2012:
\nRounding OK, added tag cr1.
\n", "licence": "Creative Commons Attribution 4.0 International", "description": "
Given 32 datapoints in a table find their minimum, lower quartile, median, upper quartile, and maximum.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "If you sort the data in increasing order you get the following table:
\n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n$\\var{r1[5]}$ | \n$\\var{r1[6]}$ | \n$\\var{r1[7]}$ | \n$\\var{r1[8]}$ | \n$\\var{r1[9]}$ | \n$\\var{r1[10]}$ | \n$\\var{r1[11]}$ | \n$\\var{r1[12]}$ | \n$\\var{r1[13]}$ | \n$\\var{r1[14]}$ | \n$\\var{r1[15]}$ | \n
$\\var{r1[16]}$ | \n$\\var{r1[17]}$ | \n$\\var{r1[18]}$ | \n$\\var{r1[19]}$ | \n$\\var{r1[20]}$ | \n$\\var{r1[21]}$ | \n$\\var{r1[22]}$ | \n$\\var{r1[23]}$ | \n$\\var{r1[24]}$ | \n$\\var{r1[25]}$ | \n$\\var{r1[26]}$ | \n$\\var{r1[27]}$ | \n$\\var{r1[28]}$ | \n$\\var{r1[29]}$ | \n$\\var{r1[30]}$ | \n$\\var{r1[31]}$ | \n
Denote the ordered data by $x_j$, thus $x_{10}=\\var{r1[9]}$ for example.
\nMinimum value: The minimum value is $x_1=\\var{r1[0]}$.
\nLower Quartile: As there is an even number of values, the Lower Quartile will lie between two values. Its position is calculated by finding
\n\\[\\frac{n+1}{4}=\\frac{\\var{n+1}}{4}=8\\frac{1}{4}\\]
\nHence the Lower Quartile lies between the 8th and 9th entries in the ordered table, so it is:
\n\\[0.75\\times x_8+0.25\\times x_9 = 0.75\\times\\var{r1[7]}+0.25\\times \\var{r1[8]}=\\var{lquartile}\\]
\nMedian: The position of the median in the table is given by
\n\\[ \\frac{2(n+1)}{4} = \\frac{\\var{2*(n+1)}}{4} = 16 \\frac{1}{2}\\]
\nThe median lies between the 16th and 17th entries in the ordered table and is given by:
\n\\[0.5\\times x_{16}+0.5\\times x_{17} = 0.5\\times\\var{r1[15]}+0.5\\times \\var{r1[16]}=\\var{median}\\]
\nUpper Quartile: As there is an even number of values, the Upper Quartile will lie between two values. Its position is calculated by finding
\n\\[\\frac{3(n+1)}{4}=\\frac{\\var{3*(n+1)}}{4}=24\\frac{3}{4}\\]
\nHence the Upper Quartile lies between the 24th and 25th entries in the ordered table.
\nWe find it is \\[0.25\\times x_{24}+0.75\\times x_{25} = 0.25\\times\\var{r1[23]}+0.75\\times \\var{r1[24]}=\\var{uquartile}\\]
\nMaximum value: The maximum value is $x_{32}=\\var{r1[31]}$
\nThe interquartile range is defined to be
\n\\[ \\text{Upper Quartile} – \\text{Lower Quartile} \\]
\nand so in this case we have:
\n\\[ \\text{Interquartile range} = \\var{uquartile}-\\var{lquartile}=\\var{uquartile-lquartile} \\]
\nMost of the data should be spanned by $4s$ where $s$ is the sample standard deviation.
\nThe range of values is $\\var{r1[31]}-\\var{r1[0]}=\\var{r1[31]-r1[0]}$ and so $s$ should be approximately
\n\\[ \\simplify[std]{({r1[31]}-{r1[0]}) / 4 = {(r1[31] -r1[0]) / 4}} \\]
\nThe most likely value for the sample standard deviation of the options presented is $\\var{guess1}$.
\n(The actual value is $\\var{stdev}$ to 2 decimal places).
"}, {"name": "Find sample mean, standard deviation, median and interquartile range, , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sort(r0)", "description": "", "name": "r1"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'tomatoes '", "description": "", "name": "things"}, "median": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.5*(r1[11]+r1[12])", "description": "", "name": "median"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "24", "description": "", "name": "n"}, "uquartile": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.25*r1[17]+0.75*r1[18]", "description": "", "name": "uquartile"}, "u": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(20..60)", "description": "", "name": "u"}, "whatever": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'weights'", "description": "", "name": "whatever"}, "interq": {"templateType": "anything", "group": "Ungrouped variables", "definition": "uquartile-lquartile", "description": "", "name": "interq"}, "l": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..19)", "description": "", "name": "l"}, "var": {"templateType": "anything", "group": "Ungrouped variables", "definition": "variance(r0,true)", "description": "", "name": "var"}, "description": {"templateType": "anything", "group": "Ungrouped variables", "definition": "' from a new kind of tomato plant.'", "description": "", "name": "description"}, "lquartile": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.75*r1[5]+0.25*r1[6]", "description": "", "name": "lquartile"}, "mean": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r0)", "description": "", "name": "mean"}, "r0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(random(l..u),24)", "description": "", "name": "r0"}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'grams'", "description": "", "name": "units"}, "stdev": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r0,true),2)", "description": "", "name": "stdev"}}, "ungrouped_variables": ["uquartile", "r0", "description", "things", "median", "interq", "whatever", "l", "var", "lquartile", "u", "mean", "stdev", "units", "n", "r1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{precround(mean(r0),1)}", "minValue": "{precround(mean(r0),1)}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{siground(stdev(r0,true),3)}", "minValue": "{siground(stdev(r0,true),3)}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{median}", "minValue": "{median}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{interq}", "minValue": "{interq}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Sample Mean (1 dp) | Sample Standard Deviation (3 sig figs) | Median (exact value) | Interquartile Range (exact value) |
---|---|---|---|
[[0]] | [[1]] | [[2]] | [[3]] |
The following data are the {whatever}, in {units}, of $\\var{n}$ {things} {description}
\n$\\var{r0[0]}$ | \n$\\var{r0[1]}$ | \n$\\var{r0[2]}$ | \n$\\var{r0[3]}$ | \n$\\var{r0[4]}$ | \n$\\var{r0[5]}$ | \n$\\var{r0[6]}$ | \n$\\var{r0[7]}$ | \n
$\\var{r0[8]}$ | \n$\\var{r0[9]}$ | \n$\\var{r0[10]}$ | \n$\\var{r0[11]}$ | \n$\\var{r0[12]}$ | \n$\\var{r0[13]}$ | \n$\\var{r0[14]}$ | \n$\\var{r0[15]}$ | \n
$\\var{r0[16]}$ | \n$\\var{r0[17]}$ | \n$\\var{r0[18]}$ | \n$\\var{r0[19]}$ | \n$\\var{r0[20]}$ | \n$\\var{r0[21]}$ | \n$\\var{r0[22]}$ | \n$\\var{r0[23]}$ | \n
11/07/2012:
\n
Added tags.
Calculation not yet checked.
\n23/07/2012:
\nAdded description.
\nChecked calculation, OK.
\nTwo minor typos changed.
\n3/08/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n19/12/2012:
\nChanged to new stats extension functions for variance and stdev. Still using the uniform distribution. Checked calculations again.
\nAdded tested1 tag.
\n21/12/2012:
\nChecked rounding, OK. Added cr1 tag.
\nScenarios possible. Added sc tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Sample of size $24$ is given in a table. Find sample mean, sample standard deviation, sample median and the interquartile range.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "Sample mean: The sample mean is $\\frac{\\var{sum(r0)}}{\\var{len(r0)}} = \\var{precround(mean(r0),1)}$ to 1 decimal place.
\nSample standard deviation: The sample standard deviation is $\\var{stdev(r0,true)}=\\var{siground(stdev(r0,true),3)}$ to 3 significant figures.
\nIf you order the data in increasing order you get the following table:
\n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n$\\var{r1[5]}$ | \n$\\var{r1[6]}$ | \n$\\var{r1[7]}$ | \n
$\\var{r1[8]}$ | \n$\\var{r1[9]}$ | \n$\\var{r1[10]}$ | \n$\\var{r1[11]}$ | \n$\\var{r1[12]}$ | \n$\\var{r1[13]}$ | \n$\\var{r1[14]}$ | \n$\\var{r1[15]}$ | \n
$\\var{r1[16]}$ | \n$\\var{r1[17]}$ | \n$\\var{r1[18]}$ | \n$\\var{r1[19]}$ | \n$\\var{r1[20]}$ | \n$\\var{r1[21]}$ | \n$\\var{r1[22]}$ | \n$\\var{r1[23]}$ | \n
Denote the ordered data by $x_j$, thus $x_{10}=\\var{r1[9]}$ for example.
\nMedian: The median lies between the 12th and 13th entries in the ordered table and is given by:
\n\\[0.5\\times x_{12}+0.5\\times x_{13} = 0.5\\times\\var{r1[11]}+0.5\\times \\var{r1[12]}=\\var{median}\\]
\nInterquartile range: As there is an even number of values, the Lower Quartile will lie between two values. Its position is calculated by finding
\n\\[\\frac{n+1}{4}=\\frac{\\var{n+1}}{4}=6\\frac{1}{4}\\]
\nHence the Lower Quartile lies between the 6th and 7th entries in the ordered table.
\nIt is \\[0.75\\times x_6+0.25\\times x_7 = 0.75\\times\\var{r1[5]}+0.25\\times \\var{r1[6]}=\\var{lquartile}\\]
\nOnce again as there is an even number of values, the Upper Quartile will lie between two values and its position is calculated by finding
\n\\[\\frac{3(n+1)}{4}=\\frac{\\var{3*(n+1)}}{4}=18\\frac{3}{4}\\]
\nHence the Upper Quartile lies between the 18th and 19th entries in the ordered table.
\nWe find it is \\[0.25\\times x_{18}+0.75\\times x_{19} = 0.25\\times\\var{r1[17]}+0.75\\times \\var{r1[18]}=\\var{uquartile}\\]
\nThe interquartile range is defined to be
\n\\[ \\text{Upper Quartile} – \\text{Lower Quartile} \\]
\nand so in this case we have:
\n\\[ \\text{Interquartile range} = \\var{uquartile}-\\var{lquartile}=\\var{interq} \\]
"}, {"name": "Sample standard deviation", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "description": "", "name": "tol"}, "r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu,sig1)),n)", "description": "", "name": "r1"}, "mean2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r1)", "description": "", "name": "mean2"}, "sig1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(9..15)", "description": "", "name": "sig1"}, "mean1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r0)", "description": "", "name": "mean1"}, "sig0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(6..12)", "description": "", "name": "sig0"}, "stdev1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r0,true),1)", "description": "", "name": "stdev1"}, "stdev2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r1,true),1)", "description": "", "name": "stdev2"}, "exam2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Cell Biology'", "description": "", "name": "exam2"}, "stdevoverall": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(sscores,true),1)", "description": "", "name": "stdevoverall"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "10", "description": "", "name": "n"}, "mu": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(55..65)", "description": "", "name": "mu"}, "total": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Total Score'", "description": "", "name": "total"}, "ssq2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(x^2,x,r1))", "description": "", "name": "ssq2"}, "exam1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Anatomy'", "description": "", "name": "exam1"}, "var2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(variance(r1,true),3)", "description": "", "name": "var2"}, "sscores": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(r0[x]+r1[x],x,0..n-1)", "description": "", "name": "sscores"}, "overallvar": {"templateType": "anything", "group": "Ungrouped variables", "definition": "variance(sscores,true)", "description": "", "name": "overallvar"}, "ssq1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(x^2,x,r0))", "description": "", "name": "ssq1"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "2", "description": "", "name": "s"}, "overallmean": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(sscores)", "description": "", "name": "overallmean"}, "r0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalSample(mu,sig0)),n)", "description": "", "name": "r0"}, "var1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(variance(r0,true),3)", "description": "", "name": "var1"}}, "ungrouped_variables": ["overallmean", "mean1", "mean2", "overallvar", "ssq1", "ssq2", "total", "exam2", "tol", "exam1", "stdev1", "stdev2", "var1", "var2", "sig1", "sig0", "stdevoverall", "r0", "r1", "n", "mu", "s", "sscores"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{stdev1+tol}", "minValue": "{stdev1-tol}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n \n \nSample Standard Deviation = [[0]] (to one decimal place)
\n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{stdev2+tol}", "minValue": "{stdev2-tol}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n \n \nSample Standard Deviation = [[0]] (to one decimal place)
\n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{stdevoverall+tol}", "minValue": "{stdevoverall-tol}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n \n \nSample Standard Deviation = [[0]] (to one decimal place)
\n \n ", "showCorrectAnswer": true, "marks": 0}], "statement": "\n \n \nThe following table gives the examination marks in {exam1} and in {exam2} and their total for a group of $n=\\var{n}$ students.
\n \n \n \n{exam1} | $\\var{r0[0]}$ | $\\var{r0[1]}$ | $\\var{r0[2]}$ | $\\var{r0[3]}$ | $\\var{r0[4]}$ | $\\var{r0[5]}$ | $\\var{r0[6]}$ | $\\var{r0[7]}$ | $\\var{r0[8]}$ | $\\var{r0[9]}$ | Mean = $\\var{mean1}$ |
---|---|---|---|---|---|---|---|---|---|---|---|
{exam2} | $\\var{r1[0]}$ | $\\var{r1[1]}$ | $\\var{r1[2]}$ | $\\var{r1[3]}$ | $\\var{r1[4]}$ | $\\var{r1[5]}$ | $\\var{r1[6]}$ | $\\var{r1[7]}$ | $\\var{r1[8]}$ | $\\var{r1[9]}$ | Mean = $\\var{mean2}$ |
{total} | $\\var{sscores[0]}$ | $\\var{sscores[1]}$ | $\\var{sscores[2]}$ | $\\var{sscores[3]}$ | $\\var{sscores[4]}$ | $\\var{sscores[5]}$ | $\\var{sscores[6]}$ | $\\var{sscores[7]}$ | $\\var{sscores[8]}$ | $\\var{sscores[9]}$ | Mean = $\\var{overallmean}$ |
Find the sample standard deviation for each of {exam1}, {exam2} and Total Score.
\n \n ", "tags": ["checked2015", "cr1", "data analysis", "elementary statistics", "mean ", "sample", "sample mean", "sample standard deviation", "sample variance", "standard deviation", "statistics", "stats", "tested1", "unused", "variance"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "11/07/2012:
\nAdded tags.
\nSet new variable tol=0 for all numeric input so that answers have to be accurate to 1 decimal place.
\nTesting calculation not yet possible due to stats extension unavailability.
\n23/07/2012:
\nCorrected error in calculation of variance of Total Score. The variable scores was not used and so mean and variance were not correct.
\nChecked calculations. OK.
\nAdded description.
\n1/08/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n19/12/2012:
\nChanged stats functions to the ones from the new stats extension.
\nChecked calculations.
\nAdded tested1 tag.
\n21/12/2012:
\nChecked rounding, OK. Added cr1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Two ordered data sets, each with 10 numbers. Find the sample standard deviation for each and for their sum.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "\n \n \nThe solution to the first part is here – the other parts can be done in the same way.
\n \n \n \nFor {exam1} we have the mean is:
\n \n \n \n\\[\\simplify[]{({r0[0]} + {r0[1]} + {r0[2]} + {r0[3]} + {r0[4]} + {r0[5]} + {r0[6]} + {r0[7]} + {r0[8]} + {r0[9]}) / {n} = {mean1}}\\]
\n \n \n \nThe sample variance is given by the formula:
\n \n \n \n\\[\\textrm{Sample Variance} = \\frac{1}{n-1}\\left(\\sum_{j=1}^{n}x_j^2 -n\\mu^2\\right)\\]
\n \n \n \nwhere the $x_j$ are the exam scores for {exam1}, $n=\\var{n}$ the number of students and $\\mu=\\var{mean1}$ the sample mean.
\n \n \n \nWe find that
\\[\\begin{eqnarray*}\\sum_{j=1}^{n}x_j^2 &=& \\simplify[]{({r0[0]}^2 + {r0[1]}^2 + {r0[2]}^2 + {r0[3]}^2 + {r0[4]}^2 + {r0[5]}^2 + {r0[6]}^2 + {r0[7]}^2 + {r0[8]}^2 + {r0[9]}^2)}\\\\ \n \n &=& \\var{ssq1}\\\\\n \n \\\\\n \n \\\\\n \n n\\mu^2 &=&\\var{n} \\times\\var{mean1}^2\\\\\n \n &=& \\var{n*mean1^2}\n \n \\end{eqnarray*}\n \n \\]
Hence substituting these values into the formula we find that:
\\[\\begin{eqnarray*}\n \n \\textrm{Sample Variance} &=& \\frac{1}{\\var{n-1}}\\left(\\var{ssq1}-\\var{n*mean1^2}\\right)\\\\\n \n &=& \\var{var1}\n \n \\end{eqnarray*}\n \n \\] to 3 decimal places.
\n \n \n \nThe Sample Standard Deviation is then the square root of the Sample Variance i.e.
\n \n \n \nSample Standard Deviation = $\\sqrt{\\var{var1}} = \\var{stdev1}$ to one decimal place.
\n \n "}, {"name": "Calculate probability of combinations of events happening or not, , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "parts": [{"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{intersect-tol}", "maxValue": "{intersect+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n$P(A\\cap B)=\\;\\;$[[0]]
\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{intcom-tol}", "maxValue": "{intcom+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n$P(A^c\\cap B^c)=\\;\\;$[[0]]
\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{unioncom-tol}", "maxValue": "{unioncom+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n$P(A^c\\cup B^c)=\\;\\;$[[0]]
\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{prob4-tol}", "maxValue": "{prob4+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n$P(A^c\\cap B)=\\;\\;$[[0]]
\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{prob5-tol}", "maxValue": "{prob5+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n$P(A^c\\cup B)=\\;\\;$[[0]]
\n \n \n ", "showCorrectAnswer": true, "marks": 0}], "variables": {"prob4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-prob2-intersect,10)", "name": "prob4", "description": ""}, "intcom": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-prob3", "name": "intcom", "description": ""}, "intersect": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(prob1+1-prob2-prob3,2)", "name": "intersect", "description": "P(A and B)
"}, "prob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.9#0.05)", "name": "prob2", "description": "P(not B)
"}, "prob3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((t*(max(prob1,1-prob2))+(100-t)*min(0.95,prob1+1-prob2))/100,2)", "name": "prob3", "description": "P(A or B)
"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "name": "tol", "description": ""}, "unioncom": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-intersect", "name": "unioncom", "description": ""}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.9#0.05)", "name": "prob1", "description": "P(A)
"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..100)", "name": "t", "description": ""}, "prob5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-prob1+1-prob2-prob4", "name": "prob5", "description": ""}}, "ungrouped_variables": ["intcom", "intersect", "prob1", "prob2", "prob3", "prob4", "prob5", "t", "tol", "unioncom"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "showQuestionGroupNames": false, "variable_groups": [], "functions": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\nLet $A$ and $B$ be events with:
\n1. $P(A) = \\var{prob1}$
\n2. $P(A \\cup B)=\\var{prob3}$
\n3. $P(B^c)=\\var{prob2}$
\nFind the following probabilities (all answers to 2 decimal places):
\n ", "tags": ["axiom", "axioms of probability", "checked2015", "complement", "complement of an event", "cr1", "elementary probability", "intersection of events", "intersection of sets", "laws of sets", "MAS1604", "MAS8380", "MAS8401", "Probability", "probability", "probability laws", "set laws", "sets", "statistics", "tested1", "union", "union of events", "union of sets"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nSet tolerances via new variable tol=0 for all answers.
\nChecked calculations.
\n22/07/2012:
\nAdded description.
\nSwitched on stats extension (not needed, but policy for all stats questions).
\n31/07/2012:
\nAdded tags.
\nIn the Advice section, moved \\Rightarrow to beginning of the line instead of the end of the previous line.
\nQuestion appears to be working correctly.
\n20/12/2012:
\nAdded tested1 tag after checking again - calculations OK.
\n21/12/2012:
\nChecked rounding, OK. Added tag cr1.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given $P(A)$, $P(A\\cup B)$, $P(B^c)$ find $P(A \\cap B)$, $P(A^c \\cap B^c)$, $P(A^c \\cup B^c)$ etc..
"}, "advice": "It follows from the axioms of probability that:
\n\\[P(A \\cup B)=P(A)+P(B)-P(A \\cap B)\\]
\nHence
\n\\begin{align}
P(A \\cap B) &= P(A)+P(B)-P(A \\cup B) \\\\
&= \\var{prob1}+1-\\var{prob2}-\\var{prob3} \\\\
&= \\var{intersect}
\\end{align}
Note that we have used $P(B)=1-P(B^c)= 1-\\var{prob2}=\\var{1-prob2}$
\nThe laws of sets gives:
\n\\[A^c \\cap B^c=(A \\cup B)^c\\]
\nso
\n\\begin{align}
P(A^c \\cap B^c) &= P((A \\cup B)^c) \\\\
&= 1-P(A \\cup B) \\\\
&= 1-\\var{prob3} \\\\
&= \\var{1-prob3}
\\end{align}
Similarly to b), the laws of sets gives:
\n\\[A^c \\cup B^c=(A \\cap B)^c\\]
\nso
\n\\begin{align}
P(A^c \\cup B^c) &= P((A \\cap B)^c) \\\\
&= 1-P(A \\cap B) \\\\
&= 1-\\var{intersect} \\\\
&= \\var{1-intersect}
\\end{align}
Note that $B$ is the following union of disjoint sets:
\n\\[B = (A^c \\cap B) \\cup (A \\cap B)\\]
\nHence
\n\\begin{align}
P(B) &= P(A^c \\cap B) + P(A \\cap B) \\\\
\\implies P(A^c \\cap B) &= P(B)-P(A\\cap B) \\\\
&= 1-\\var{prob2}-\\var{intersect} \\\\
&= \\var{prob4}
\\end{align}
Once again using a familiar result we have:
\n\\begin{align}
P(A^c \\cup B) &= P(A^c)+P(B)-P(A^c \\cap B) \\\\
&= 1-\\var{prob1}+1-\\var{prob2}-\\var{prob4} \\\\
&= \\var{prob5}
\\end{align}
Where we used the result from d) that $P(A^c \\cap B)=\\var{prob4}$
"}, {"name": "Calculate probability of either of two events occurring", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"dothisandthat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on both domestic and European routes\"", "description": "", "name": "dothisandthat"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-prob1,2)", "description": "", "name": "ans2"}, "desc2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"are in training\"", "description": "", "name": "desc2"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'stewardesses'", "description": "", "name": "things"}, "dothat1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"works on European routes\"", "description": "", "name": "dothat1"}, "p3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "p-random(85..95)", "description": "", "name": "p3"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((p-p3)/100,2)", "description": "", "name": "prob1"}, "therest": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The remainder\"", "description": "", "name": "therest"}, "desc1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"with a small UK-based airline\"", "description": "", "name": "desc1"}, "p2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "p-p1", "description": "", "name": "p2"}, "thing": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"stewardess\"", "description": "", "name": "thing"}, "dothis1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"works on domestic routes\"", "description": "", "name": "dothis1"}, "desc4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"is in training\"", "description": "", "name": "desc4"}, "dothat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on European routes\"", "description": "", "name": "dothat"}, "dothis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on domestic routes\"", "description": "", "name": "dothis"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(40..70)", "description": "", "name": "p1"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(105..125)", "description": "", "name": "p"}, "desc3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"working with this airline\"", "description": "", "name": "desc3"}}, "ungrouped_variables": ["dothisandthat", "desc4", "p1", "desc1", "dothat", "desc3", "things", "ans2", "p3", "p", "p2", "dothat1", "dothis", "therest", "desc2", "thing", "dothis1", "prob1"], "functions": {}, "variable_groups": [], "preamble": {"css": "", "js": ""}, "parts": [{"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "\nFind the probabilities that a randomly chosen {thing} {desc3}:
\na) {dothis1} or {dothat1}.
\nProbability = [[0]]
\nb) {desc4}.
\nProbability = [[1]]
\nEnter both probabilities to 2 decimal places.
\n ", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "prob1", "maxValue": "prob1", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "mustBeReducedPC": 0}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ans2", "maxValue": "ans2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "mustBeReducedPC": 0}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "statement": "\n$\\var{p1}$% of {things} {desc1} {dothis}, $\\var{p2}$% {dothat} and $\\var{p3}$% {dothisandthat}.
\n{therest} {desc2}
\n ", "tags": ["checked2015"], "rulesets": {}, "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Example showing how to calculate the probability of A or B using the law $p(A \\;\\textrm{or}\\; B)=p(A)+p(B)-p(A\\;\\textrm{and}\\;B)$.
\nAlso converting percentages to probabilities.
\nEasily adapted to other applications.
"}, "advice": "a) There are $\\var{p1}+\\var{p2}-\\var{p3}=\\var{p-p3}$ % of stewardesses working on one of the routes. The probability that a random stewardess is working on one of these routes is therefore $\\displaystyle \\frac{\\var{p-p3}}{100}=\\var{prob1}$.
\nb) The rest are in training and the probability that a randomly selected stewardess is in training is $1-\\var{prob1}=\\var{1-prob1}$.
"}, {"name": "Convert gambling odds to probabilities, , ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"wdw": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'A bookmaker lists'", "description": "", "name": "wdw"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..20)", "description": "", "name": "t"}, "player1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Australia'", "description": "", "name": "player1"}, "odds22": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(odds12*odds21/odds11)-random(2..5 except round(odds12*odds21/odds11))", "description": "", "name": "odds22"}, "den2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "odds21+odds22", "description": "", "name": "den2"}, "odds21": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(8..20)", "description": "", "name": "odds21"}, "between": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'between'", "description": "", "name": "between"}, "odds12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((t*round(odds11+1)/2+(20-t)*(odds11-1))/20)", "description": "", "name": "odds12"}, "odds11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(8..20)", "description": "", "name": "odds11"}, "event": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'the next series of games'", "description": "", "name": "event"}, "player2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'England'", "description": "", "name": "player2"}, "den1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "odds11+odds12", "description": "", "name": "den1"}}, "ungrouped_variables": ["odds12", "odds11", "den2", "den1", "wdw", "player2", "player1", "t", "between", "odds22", "event", "odds21"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"answer": "{odds11}/{den1}", "musthave": {"message": "Input as a fraction.
", "showStrings": false, "partialCredit": 0, "strings": ["/"]}, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "showCorrectAnswer": true, "expectedvariablenames": [], "notallowed": {"message": "Input your answer as a fraction and not a decimal.
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "answersimplification": "std, fractionNumbers", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "You should take the bet if you think that $\\Pr(\\var{player1}\\text{ win})$ is greater than [[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"answer": "{odds22}/{den2}", "musthave": {"message": "Input as a fraction.
", "showStrings": false, "partialCredit": 0, "strings": ["/"]}, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "showCorrectAnswer": true, "expectedvariablenames": [], "notallowed": {"message": "Input your answer as a fraction and not a decimal.
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "answersimplification": "std, fractionNumbers", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "You should take the bet if you think that $\\Pr(\\var{player2}\\text{ win})$ is greater than [[0]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "The following odds are given for {event} {between} {player1} and {player2}
\n{player1} $\\var{odds11}: \\var{odds12}$ on | \n{player2} $\\var{odds21}: \\var{odds22}$ against | \n
Convert these statements about odds into probabilities.
\nGive your answers as fractions.
", "tags": ["checked2015", "converting odds", "elementary probability", "MAS1604", "MAS8380", "MAS8401", "odds", "odds into probabilities", "probability", "Probability", "statistics", "tested1"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nAdded decimal point as forbidden string for both answers.
\nChecked calculation.
\n22/07/2012:
\nAdded description.
\n31/07/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n20/12/2012:
\nChecked calculations, OK. Added tested1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Converting odds to probabilities.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "Odds of $\\var{odds11}: \\var{odds12}$ on means that you should take the bet if you think the probability of {player1} winning is greater than:
\n\\[ \\frac{\\var{odds11}}{\\var{odds11}+\\var{odds12}} = \\simplify[std]{{odds11}/{odds11+odds12}}\\]
\nOdds of $\\var{odds21}: \\var{odds22}$ against means that you should take the bet if you think that the probability of {player2} losing is less than:
\n\\[ \\frac{\\var{odds21}}{\\var{odds21}+\\var{odds22}} = \\simplify[std]{{odds21}/{odds21+odds22}}\\]
\nThat is, if you think the probability of {player2} winning is greater than:
\n\\[ 1- \\simplify[std]{{odds21}/{odds21+odds22}}=\\simplify[std]{{odds22}/{odds21+odds22}}\\]
\nNote that the sum of these probabilities is:
\n\\[\\simplify[std]{{odds11}/{odds11+odds12}}+\\simplify[std]{{odds22}/{odds21+odds22}}=\\simplify[std]{{odds11*odds21+odds22*odds12+2*odds11*odds22}/{odds11*odds21+odds22*odds12+odds11*odds22+odds12*odds21}}\\]
\nwhich is less than $1$, as otherwise you could bet on both to win and not lose any money!
"}, {"name": "Roll a pair of dice - find probability at least one die shows a given number.", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "tags": ["checked2015", "dice", "Dice", "die", "elementary probability", "events", "independence", "Independence", "independent events", "Probability", "probability", "probability dice", "statistics", "tested1"], "metadata": {"description": "Rolling a pair of dice. Find probability that at least one die shows a given number.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Two fair six-sided dice are rolled.
", "advice": "\n \n \nLet $A$ be the event that first dice shows a $\\var{number}$ $\\Rightarrow P(A)=\\frac{1}{6}$.
\n \n \n \nLet $B$ be the event that second dice shows a $\\var{number}$ $\\Rightarrow P(B)=\\frac{1}{6}$.
\n \n \n \n$A$ and $B$ are independent events so $P(A\\cap B) = P(A)\\times P(B)$.
\n \n \n \nWe want the probability $P(A \\cup B)$ of either $A$ or $B$ showing $\\var{number}$ and
\n \n \n \n\\[\\begin{eqnarray*}\n \n P(A \\cup B) &=& P(A)+P(B)-P(A \\cap B)\\\\\n \n &=& P(A)+P(B)-P(A)P(B)\\\\\n \n &=&\\frac{1}{6}+ \\frac{1}{6}-\\frac{1}{36}\\\\\n \n &=& \\frac{11}{36}\n \n \\end{eqnarray*}\n \n \\]
\n \n \n ", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"number": {"name": "number", "group": "Ungrouped variables", "definition": "random(1..6)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["number"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is the probability of at least one die showing a $\\var{number}$?
\nProbability = [[0]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "11/36", "maxValue": "11/36", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Probability - draw without replacement", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.0001", "description": "", "name": "tol"}, "is": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(m=1,'is','are')", "description": "", "name": "is"}, "colour2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('white','yellow','blue')", "description": "", "name": "colour2"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(prob,4)", "description": "", "name": "prob1"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..100)", "description": "", "name": "t"}, "k": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..8)", "description": "", "name": "k"}, "nochoices": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(n,k)*comb(g-n,m-k)", "description": "", "name": "nochoices"}, "prob0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(g-n,m)/possiblechoices", "description": "", "name": "prob0"}, "atleastone": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-prob0,4)", "description": "", "name": "atleastone"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "g-k", "description": "", "name": "n"}, "returned": {"templateType": "anything", "group": "Ungrouped variables", "definition": "''", "description": "", "name": "returned"}, "possiblechoices": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(g,m)", "description": "", "name": "possiblechoices"}, "colour1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('black','red','green')", "description": "", "name": "colour1"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'balls'", "description": "", "name": "things"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "name": "m"}, "special": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'coloured '+ colour1", "description": "", "name": "special"}, "caught1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "''", "description": "", "name": "caught1"}, "caught2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'drawn'", "description": "", "name": "caught2"}, "later": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'Next'", "description": "", "name": "later"}, "prob": {"templateType": "anything", "group": "Ungrouped variables", "definition": "nochoices/possiblechoices", "description": "", "name": "prob"}, "g": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..15)", "description": "", "name": "g"}, "indef": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(container='urn', 'n','')", "description": "", "name": "indef"}, "marked": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'coloured '+ colour1+ ' the rest '+ colour2", "description": "", "name": "marked"}, "then": {"templateType": "anything", "group": "Ungrouped variables", "definition": "''", "description": "", "name": "then"}, "container": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('urn','box','container')", "description": "", "name": "container"}}, "ungrouped_variables": ["is", "marked", "special", "atleastone", "container", "things", "caught2", "caught1", "tol", "prob", "indef", "then", "returned", "nochoices", "prob0", "prob1", "possiblechoices", "g", "k", "later", "m", "n", "colour2", "colour1", "t"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "showQuestionGroupNames": false, "functions": {}, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "correctAnswerFraction": false, "minValue": "{atleastone-tol}", "maxValue": "{atleastone+tol}", "marks": 2}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\nA{indef} {container} contains $\\var{g}$ {things}. {Then} $\\var{n}$ of these are {caught1} {marked} {returned}.
\n{Later} $\\var{m}$ {things} {is} {caught2} without replacement.
\nWhat is the probability that at least one of the $\\var{m}$ is {special}?
\nInput your answer to $4$ decimal places.
\nProbability = [[0]]?
\n ", "marks": 0}], "statement": "\n \n \nAnswer the following question.
\n \n \n ", "tags": ["MAS1604", "Probability", "checked2015", "combinations", "cr1", "elementary probability", "number of selections", "sample space", "selection without replacement", "statistics", "tested1", "urn model", "without replacement"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nIncluded more detail in Advice by showing number of combinations explicitly.
\nAnswer tolerance set as new variable tol=0.0001. Perhaps 3 dps and tol=0?
\nChecked calculation. OK.
\n22/07/2012:
\nAdded description.
\nChecked stats extension box.
\n31/07/2012:
\nQuestion appears to be working correctly.
\n20/12/2012:
\nChecked calculation again, OK. Added tested1 tag.
\nNote that there is scope for setting questions with different wording to that of urn models.
\n21/12/2012:
\nChecked rounding, OK. Added tag cr1.
", "licence": "Creative Commons Attribution 4.0 International", "description": "\n \t\tA box contains $n$ balls, $m$ of these are red the rest white.
\n \t\t$r$ are drawn without replacement.
\n \t\tWhat is the probability that at least one of the $r$ is red?
\n \t\t"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "\nThe probability that at least one of the {things} is {special} is the same as 1 – probability that none of them are {special}.
\nThe number of selections without {things} {special} is
\n\\[ {\\var{g-n} \\choose \\var{m}}=\\var{comb(g-n,m)}\\] as all have to be selected from the $\\var{g-n}$ which are {colour2}.
\nThere are $\\displaystyle {\\var{g} \\choose \\var{m}}=\\var{comb(g,m)}$ ways of drawing $\\var{m}$ {things} from the $\\var{g}$.
\nHence the probability that none them are {special} is:
\n\\[ \\frac{{\\var{g-n} \\choose \\var{m}}}{{\\var{g} \\choose \\var{m}}}=\\frac{\\var{comb(g-n,m)}}{\\var{possiblechoices}}\\]
\nSo the probability we want is
\n\\[1- \\frac{\\var{comb(g-n,m)}}{\\var{possiblechoices}} = \\var{atleastone}\\] to 4 decimal places.
\n "}, {"name": "Probability - sum of two numbers drawn without replacement", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"noeven": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(isint(mi/2),di/2+1,di/2)", "description": "", "name": "noeven"}, "botheven": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(noeven,2)", "description": "", "name": "botheven"}, "together": {"templateType": "anything", "group": "Ungrouped variables", "definition": "botheven+bothodd", "description": "", "name": "together"}, "numpar": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(parity='even',noeven,noodd)", "description": "", "name": "numpar"}, "mess": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(gcd(comb(numpar,2),together)=1,'','(after reducing to lowest form as a fraction).')", "description": "", "name": "mess"}, "mi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..10)", "description": "", "name": "mi"}, "otherparity": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(parity='even','odd','even')", "description": "", "name": "otherparity"}, "bothodd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(noodd,2)", "description": "", "name": "bothodd"}, "ma": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mi+random(8..12#2)", "description": "", "name": "ma"}, "di": {"templateType": "anything", "group": "Ungrouped variables", "definition": "ma-mi", "description": "", "name": "di"}, "parity": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('odd','even')", "description": "", "name": "parity"}, "noodd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(isint(mi/2),di/2,di/2+1)", "description": "", "name": "noodd"}, "numotherpar": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(parity='even',noodd,noeven)", "description": "", "name": "numotherpar"}, "bothsame": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(parity='odd',bothodd,botheven)", "description": "", "name": "bothsame"}}, "ungrouped_variables": ["parity", "otherparity", "ma", "di", "mess", "mi", "numotherpar", "noodd", "together", "bothodd", "botheven", "numpar", "bothsame", "noeven"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"answer": "{bothsame}/{botheven+bothodd}", "musthave": {"showStrings": false, "message": "Input your answer as a fraction
", "strings": ["/"], "partialCredit": 0}, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "answersimplification": "std", "expectedvariablenames": [], "notallowed": {"showStrings": false, "message": "Input your answer as a fraction not a decimal.
", "strings": ["."], "partialCredit": 0}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "showCorrectAnswer": true, "marks": 2, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\nProbability that both numbers are {parity}= [[0]]
\nEnter your answer as a fraction and not a decimal.
\n ", "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\nTwo numbers are drawn at random (and without replacement) from the numbers $\\var{mi}$ to $\\var{ma}$.
\nFind the probability that both numbers are {parity} given that their sum is even.
\n ", "tags": ["MAS1604", "Probability", "checked2015", "conditional probability", "counting", "drawn without replacement", "events", "sampling space", "select without replacement", "sets", "statistics", "subset", "tested1", "urn model", "without replacement"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nReminded user to input answer as a fraction.
\nChecked calculation.
\n22/07/2012:
\nAdded description.
\nChecked stats extension box.
\n31/07/2012:
\nQuestion appears to be working correctly.
\n20/12/2012:
\nChecked calculation, OK. Added tested1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "\n \t\tTwo numbers are drawn at random without replacement from the numbers m to n.
\n \t\tFind the probability that both are odd given their sum is even.
\n \t\t"}, "advice": "\n \n \nAs we are sampling without replacement the best sampling space is the space of all unordered pairs.
\n \n \n \nThis means that when we count up the number of pairs we use the number of ways of selecting pairs.
\n \n \n \nLet $A$ be the event that both numbers are {parity} and $B$ the event that their sum is even.
\n \n \n \nNote that $A$ is a subset of $B$ hence $P(A \\cap B)=P(A)$.
\n \n \n \nThe probability we want to find is $P(A | B)$.
\n \n \n \nUsing the definition of conditional probability:
\n \n \n \n\\[P(A | B) = \\frac{P(A \\cap B)}{P(B)} = \\frac{P(A)}{P(B)} \\]
\n \n \n \nNow there are $\\var{numpar}$ {parity} numbers between $\\var{mi}$ and $\\var{ma}$.
\n \n \n \nand as we are sampling without replacement there are
\n \n \n \n\\[{\\var{numpar} \\choose 2} = \\frac{\\var{numpar}\\times \\var{numpar-1}}{2} = \\var{comb(numpar,2)}\\]
\n \n \n \nsuch pairs, both {parity}.
\n \n \n \nThis gives the number of elements in $A$.
\n \n \n \nAlso since there are $\\var{ma-mi+1-numpar}$ {otherparity} numbers in the range, there are:
\n \n \n \n\\[{\\var{numotherpar} \\choose 2}=\\var{comb(numotherpar,2)}\\] such pairs, both {otherparity}.
\n \n \n \nThere are $\\var{botheven}+\\var{bothodd}=\\var{together}$ pairs with sum even.
\n \n \n \nThis gives the number of events in $B$.
\n \n \n \nHence \\[\\frac{P(A)}{P(B)}=\\frac{\\var{comb(numpar,2)}}{\\var{together}}\\]
\n \n \n \nSo the probability that both are {parity} given their sum is even is
\n \n \n \n\\[\\simplify[std]{{comb(numpar,2)}/{together}}\\]
\n \n \n \n{mess}
\n \n \n "}, {"name": "Probability of not choosing any from a subset", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"noguilty": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(men-guilty,suspects-guilty)", "description": "", "name": "noguilty"}, "p4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=3,1,ns-3)", "description": "", "name": "p4"}, "ns": {"templateType": "anything", "group": "Ungrouped variables", "definition": "men-suspects", "description": "", "name": "ns"}, "is": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(guilty=1,'is','are')", "description": "", "name": "is"}, "overallnumber": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(men,suspects)", "description": "", "name": "overallnumber"}, "is2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects-guilty=1,'is','are')", "description": "", "name": "is2"}, "t3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=5,1,0)", "description": "", "name": "t3"}, "nguilty": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(men-suspects,suspects)", "description": "", "name": "nguilty"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(guilty=1,'man','men')", "description": "", "name": "p"}, "q5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects<5,1,men-4)", "description": "", "name": "q5"}, "guilty": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects>2,suspects-random(1,2),suspects-1)", "description": "", "name": "guilty"}, "ans3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(nguilty/overallnumber,3)", "description": "", "name": "ans3"}, "suspects": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(3,4,5)", "description": "", "name": "suspects"}, "q6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects<6,1,men-5)", "description": "", "name": "q6"}, "t2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=4,1,0)", "description": "", "name": "t2"}, "t4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=6,1,0)", "description": "", "name": "t4"}, "singpl": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects-guilty=1,'man','men')", "description": "", "name": "singpl"}, "test": {"templateType": "anything", "group": "Ungrouped variables", "definition": "nguilty/overallnumber", "description": "", "name": "test"}, "t1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=3,1,0)", "description": "", "name": "t1"}, "q4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects=3,1,men-3)", "description": "", "name": "q4"}, "men": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(12..20)", "description": "", "name": "men"}, "p5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects<5,1,ns-4)", "description": "", "name": "p5"}, "p6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(suspects<6,1,ns-5)", "description": "", "name": "p6"}}, "ungrouped_variables": ["guilty", "is", "ans3", "suspects", "noguilty", "q5", "q4", "q6", "is2", "test", "ns", "men", "singpl", "p6", "p4", "p5", "t4", "nguilty", "t2", "t3", "t1", "p", "overallnumber"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"answer": "{nguilty}/{overallnumber}", "musthave": {"showStrings": false, "message": "Input your answer as a fraction
", "strings": ["/"], "partialCredit": 0}, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "answersimplification": "std", "expectedvariablenames": [], "notallowed": {"showStrings": false, "message": "Input your answer as a fraction, not a decimal.
", "strings": ["."], "partialCredit": 0}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "showCorrectAnswer": true, "marks": 2, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n \n \nWhat is the probability that none of the suspects are chosen?
\n \n \n \nProbability = [[0]]?
\n \n \n \nInput your answer as a fraction and not as a decimal.
\n \n ", "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "A line-up of $\\var{men}$ men is conducted in order that a witness can identify $\\var{suspects}$ suspects.
\nSuppose that all $\\var{suspects}$ suspects are in the line-up.
\nAlso suppose that the witness does not recognise any of the suspects but simply chooses $\\var{suspects}$ men at random.
", "tags": ["MAS1604", "Probability", "checked2015", "choosing", "combinations", "counting", "cr1", "query", "sample space", "selecting", "selection", "statistics", "tested1", "ways of choosing"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nAdded an alternative solution to this question (Method 2).
\nChecked calculation.
\n22/07/2012:
\nAdded description.
\nChecked the stats extension box.
\nPerhaps the answer should be a decimal rather than a fraction - looks clumsy.
\n31/07/2012:
\nQuestion appears to be working correctly.
\n20/12/2012:
\nCould have a variant of this question by using 'scenario' string variables. Added sc tag for this. Also query the above point about a decimal solution rather than a fraction.
\nChecked calculation, OK. Added tested1 tag.
\nImproved display of numbers by texifying them.
\n21/12/2012:
\nChecked rounding, OK. Added tag cr1.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given subset $T \\subset S$ of $m$ objects in $n$ find the probability of choosing without replacement $r\\lt n-m$ from $S$ and not choosing any element in $T$.
"}, "advice": "We can work out the probability in two ways:
\nMethod 1.
\nThere are $\\var{men-suspects}$ of the $\\var{men}$ who are not suspects.
\nThe probability of picking the first who is not a suspect is therefore:
\n\\[\\simplify[]{{men-suspects}/{men}}\\]
\nThe second choice of a non-suspect will be from $\\var{men-suspects-1}$ non-suspects in $\\var{men-1}$ with probability:
\n\\[\\simplify[]{{men-suspects-1}/{men-1}}\\]
\nHence the probability of choosing two non-suspects will be .
\n\\[\\simplify[]{{men -suspects} / {men}}\\times \\simplify[]{{men -suspects-1} / {men-1}}\\]
\nContinuing in this way we see that the probability of choosing $\\var{suspects}$ non-suspects is:
\n\\[\\simplify[zeroFactor,unitFactor,zeroTerm]{{t1} * ({men -suspects} / {men}) * ({men -suspects -1} / {men -1}) * ({men -suspects -2} / {men -2}) + {t2} * ({men -suspects} / {men}) * ({men -suspects -1} / {men -1}) * ({men -suspects -2} / {men -2}) * ({ns -3} / {men -3}) + {t3} * ({men -suspects} / {men}) * ({men -suspects -1} / {men -1}) * ({men -suspects -2} / {men -2}) * ({ns -3} / {men -3}) * ({ns -4} / {men -4}) + {t4} * ({men -suspects} / {men}) * ({men -suspects -1} / {men -1}) * ({men -suspects -2} / {men -2}) * ({ns -3} / {men -3}) * ({ns -4} / {men -4}) * ({ns -5} / {men -5})}=\\simplify[std]{{nguilty}/{overallnumber}}\\]
\non reducing the fraction to its lowest form.
\nMethod 2.
\nThere are $\\var{men-suspects}$ of the $\\var{men}$ who are not suspects.
\nHence there are \\[{\\var{men-suspects}\\choose \\var{suspects}}=\\var{comb(men-suspects,suspects)}\\] ways of choosing $\\var{suspects}$ non-suspects.
\nIn total there are \\[{\\var{men}\\choose \\var{suspects}}=\\var{comb(men,suspects)}\\] ways of choosing $\\var{suspects}$ from all present.
\nHence the probability is \\[\\frac{\\var{comb(men-suspects,suspects)}}{\\var{comb(men,suspects)}}= \\simplify[std]{{nguilty}/{overallnumber}} \\]
"}, {"name": "Calculate expectation and a probability from a frequency table, , , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [{"variables": ["idef", "thing", "episodes", "period", "activity"], "name": "Strings"}, {"variables": ["p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "probabilities", "values"], "name": "Probabilities"}, {"variables": ["r", "s", "t", "t1", "t2", "u1", "u2", "u3", "d"], "name": "Stuff to generate probabilities"}], "variables": {"p4": {"templateType": "anything", "group": "Probabilities", "definition": "t-p8-p7-p6-p5", "description": "", "name": "p4"}, "expected_number": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(x*y,[x,y],zip(probabilities,values)))", "description": "", "name": "expected_number"}, "u2": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "u1", "description": "", "name": "u2"}, "p1": {"templateType": "anything", "group": "Probabilities", "definition": "p0+t1", "description": "", "name": "p1"}, "p3": {"templateType": "anything", "group": "Probabilities", "definition": "r-p0-p1-p2", "description": "", "name": "p3"}, "t": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "100-r", "description": "", "name": "t"}, "probexceed": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(if(j>expected_number,probabilities[j],0),j,0..8))", "description": "", "name": "probexceed"}, "values": {"templateType": "anything", "group": "Probabilities", "definition": "list(0..8)", "description": "", "name": "values"}, "thing": {"templateType": "string", "group": "Strings", "definition": "\"airline\"", "description": "", "name": "thing"}, "u3": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "u1", "description": "", "name": "u3"}, "u1": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(d*random(70..100)/100)", "description": "", "name": "u1"}, "expect_int": {"templateType": "anything", "group": "Ungrouped variables", "definition": "floor(expected_number)", "description": "", "name": "expect_int"}, "activity": {"templateType": "string", "group": "Strings", "definition": "\"luggage handling\"", "description": "", "name": "activity"}, "probabilities": {"templateType": "anything", "group": "Probabilities", "definition": "map(x/100,x,[p0,p1,p2,p3,p4,p5,p6,p7,p8])", "description": "Probability of there being $i$ episodes
", "name": "probabilities"}, "d": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(t/15)", "description": "", "name": "d"}, "episodes": {"templateType": "string", "group": "Strings", "definition": "\"complaints\"", "description": "", "name": "episodes"}, "t2": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "t1", "description": "", "name": "t2"}, "p8": {"templateType": "anything", "group": "Probabilities", "definition": "d", "description": "", "name": "p8"}, "p7": {"templateType": "anything", "group": "Probabilities", "definition": "p8+u1", "description": "", "name": "p7"}, "p5": {"templateType": "anything", "group": "Probabilities", "definition": "p6+u3", "description": "", "name": "p5"}, "idef": {"templateType": "string", "group": "Strings", "definition": "\"an\"", "description": "", "name": "idef"}, "p2": {"templateType": "anything", "group": "Probabilities", "definition": "p1+t2", "description": "", "name": "p2"}, "t1": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(s*random(70..100)/100)", "description": "", "name": "t1"}, "r": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "random(45..65)", "description": "", "name": "r"}, "s": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(r/10)", "description": "", "name": "s"}, "p0": {"templateType": "anything", "group": "Probabilities", "definition": "s", "description": "", "name": "p0"}, "p6": {"templateType": "anything", "group": "Probabilities", "definition": "p7+u2", "description": "", "name": "p6"}, "period": {"templateType": "string", "group": "Strings", "definition": "\"day\"", "description": "", "name": "period"}}, "ungrouped_variables": ["expected_number", "expect_int", "probexceed"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "expected_number", "maxValue": "expected_number", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 2}], "type": "gapfill", "prompt": "Find the expected number of {episodes} per {period}.
\nExpected number = [[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "probexceed", "maxValue": "probexceed", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 2}], "type": "gapfill", "prompt": "What is the probability that the number of {episodes} will exceed the expected number?
\nProbability = [[0]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "The probabilities that {idef} {thing} will receive {episodes} per {period} about its {activity} are given by the following table:
\nComplaints | {values[0]} | {values[1]} | {values[2]} | {values[3]} | {values[4]} | {values[5]} | {values[6]} | {values[7]} | {values[8]} |
---|---|---|---|---|---|---|---|---|---|
Probability | \n{probabilities[0]} | \n{probabilities[1]} | \n{probabilities[2]} | \n{probabilities[3]} | \n{probabilities[4]} | \n{probabilities[5]} | \n{probabilities[6]} | \n{probabilities[7]} | \n{probabilities[8]} | \n
Answer the following two parts, giving your answers to $2$ decimal places.
", "tags": ["checked2015", "discrete distribution", "expectation", "expected value", "MAS1604", "MAS2304", "MAS8380", "MAS8401", "mass function", "pmf", "PMF", "Probability", "probability", "probability mass function", "query", "sc", "statistics", "tested1"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nChecked calculation.
\n22/07/2012:
\nAdded description.
\nTicked stats extension box.
\n31/07/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n20/12/2012:
\nCould increase the number of scenarios by using random string variables. Query tag added for that.
\nAlso very cumbersome use of variables. But no change proposed for now.
\nChecked calculation, OK. Added tested1 tag.
\n21/12/2012:
\nAlthough asks for solution to 2 dps, there is no rounding as the raw values are to 2 dps. Added sc tag for possible scenarios.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given a probability mass function $P(X=i)$ with outcomes $i \\in \\{0,1,2,\\ldots 8\\}$, find the expectation $E$ and $P(X \\gt E)$.
"}, "variablesTest": {"condition": "", "maxRuns": "100"}, "advice": "The expected number of {episodes} is given by:
\n\\[ \\simplify[]{{probabilities[0]}*{values[0]} + {probabilities[1]}*{values[1]} + {probabilities[2]}*{values[2]} + {probabilities[3]}*{values[3]} + {probabilities[4]}*{values[4]} + {probabilities[5]}*{values[5]} + {probabilities[6]}*{values[6]} + {probabilities[7]}*{values[7]} + {probabilities[8]}*{values[8]}} = \\var{expected_number} \\]
\nWe want the probability that the number of {episodes} exceeds $\\var{expected_number}$.
\nSince the number of {episodes} is a whole number, this is the same as the probability that the number is $\\var{expect_int+1}$ or more and is
\n\\[\\sum_{i=\\var{expect_int+1}}^{i=8} \\left( \\text{Probability}(\\var{episodes} = i ) \\right)= \\simplify[zeroTerm]{ {if(expect_int<1,probabilities[1],0)} + {if(expect_int<2,probabilities[2],0)} + {if(expect_int<3,probabilities[3],0)} + {if(expect_int<4,probabilities[4],0)} + {if(expect_int<5,probabilities[5],0)} + {if(expect_int<6,probabilities[6],0)} + {if(expect_int<7,probabilities[7],0)} + {if(expect_int<8,probabilities[8],0)}} = \\var{probexceed}\\]
"}, {"name": "Find expected profit of gambles, ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"profit": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(numberbets*bet-numberbets*bet*(odds1+odds2)/(odds2*number),2)", "description": "", "name": "profit"}, "r": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(3..6)", "description": "", "name": "r"}, "number": {"templateType": "anything", "group": "Ungrouped variables", "definition": "37", "description": "", "name": "number"}, "odds2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1", "description": "", "name": "odds2"}, "bet": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,10,50,100)", "description": "", "name": "bet"}, "odds1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "35", "description": "", "name": "odds1"}, "numberbets": {"templateType": "anything", "group": "Ungrouped variables", "definition": "10^r", "description": "", "name": "numberbets"}}, "ungrouped_variables": ["profit", "numberbets", "number", "r", "bet", "odds2", "odds1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "profit", "minValue": "profit", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\nExpected profit=£[[0]]
\nEnter to two decimal places.
\n \n ", "showCorrectAnswer": true, "marks": 0}], "statement": "A roulette table has $\\var{number}$ numbers and pays at $\\var{odds1}$ to $\\var{odds2}$ if the winning number is chosen.
\nFind the expected profit to the casino if $\\var{10^{r}}$ bets of £$\\var{bet}$ are placed independently.
", "tags": ["checked2015", "MAS8380", "MAS8401"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "04/11/2013
\nFix typo \"fod\" -> \"find\".
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given a large number of gambles, find the expected profit.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "\nThe probability of winning is $\\dfrac{1}{\\var{number}}$ and the odds of $\\var{odds1}$ to $\\var{odds2}$ tells us that each winning choice realises \\[\\text{£}\\simplify{{odds1+odds2}/{odds2}}\\times \\var{bet}=\\text{£}\\var{(odds1+odds2)*bet/odds2}\\]on a bet of £ $\\var{bet}$.
\nHence the expected payout on a bet of £$\\var{bet}$ is £$\\frac{\\var{(odds1+odds2)*bet}}{\\var{odds2*number}}$
\nSo the expected payout on $\\var{numberbets}$ bets of £$\\var{bet}$ is $\\var{numberbets}\\times \\frac{\\var{(odds1+odds2)*bet}}{\\var{odds2*number}}$
\nHence:
\nProfit = Income - Payout
\n$=\\text{£}\\var{numberbets}\\times \\var{bet}-\\var{numberbets}\\times \\frac{\\var{(odds1+odds2)*bet}}{\\var{odds2*number}}= \\text{£}\\var{profit}$ to 2 decimal places.
\n \n "}, {"name": "Is the given function a probability mass function?, , , ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [{"variables": ["is_pmf", "has_negative_probability", "probabilities_dont_sum", "explain_decision"], "name": "Descriptions"}], "variables": {"d3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "d2+random(2..4)", "description": "", "name": "d3"}, "negerror": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(-b/a)-random(1,2)", "description": "", "name": "negerror"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "name": "b"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a*(d1+d2+d3+d4)+4*b + error", "description": "", "name": "c"}, "d1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "has_negative_probability*negerror+(1-has_negative_probability)*random(3..5)", "description": "", "name": "d1"}, "explain_decision": {"templateType": "anything", "group": "Descriptions", "definition": "if(has_negative_probability,\n if(probabilities_dont_sum,\n \"the probabilities do not sum to $1$ and there is a negative probability\",\n \"there is a negative probability\"\n ),\n if(probabilities_dont_sum,\n \"the probabilities do not sum to $1$\",\n \"the probabilities sum to $1$ and all probabilities are non-negative\"\n )\n)", "description": "", "name": "explain_decision"}, "d2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "d1+random(1..5)", "description": "", "name": "d2"}, "has_negative_probability": {"templateType": "anything", "group": "Descriptions", "definition": "random(0,1)", "description": "", "name": "has_negative_probability"}, "is_pmf": {"templateType": "anything", "group": "Descriptions", "definition": "has_negative_probability=0 and probabilities_dont_sum=0", "description": "", "name": "is_pmf"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..4)", "description": "", "name": "a"}, "probabilities_dont_sum": {"templateType": "anything", "group": "Descriptions", "definition": "random(0,1)", "description": "0 if probabilities sum to 1
", "name": "probabilities_dont_sum"}, "error": {"templateType": "anything", "group": "Ungrouped variables", "definition": "probabilities_dont_sum*random(1..9)", "description": "", "name": "error"}, "d4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "d3+random(3..5)", "description": "", "name": "d4"}}, "ungrouped_variables": ["a", "negerror", "c", "b", "error", "d3", "d4", "d2", "d1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["Yes, it is a probability mass function
", "No, it is not a probability mass function
"], "displayColumns": 2, "distractors": ["", ""], "shuffleChoices": false, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": "if(is_pmf,[1,0],[0,1])", "marks": 0}], "type": "gapfill", "prompt": "Does the following define a valid probability mass function?
\n\\[P(X=x) = \\simplify{({a}x+{b})/{c}},\\;\\;\\;x \\in S=\\{\\var{d1},\\;\\var{d2},\\;\\var{d3},\\;\\var{d4}\\}\\]
\n[[0]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "checkbox", "choices": ["Probabilities sum to $1$
", "Probabilities do not sum to $1$
", "All probabilities are non-negative
", "There is a negative probability
"], "matrix": "if(probabilities_dont_sum=0,[1,-2],[-2,1])+if(has_negative_probability=0,[1,-2],[-2,1])", "distractors": ["", "", "", ""], "type": "m_n_2", "maxAnswers": 2, "shuffleChoices": false, "warningType": "none", "scripts": {}, "minMarks": 0, "minAnswers": 0, "maxMarks": "2", "showCorrectAnswer": true, "displayColumns": 1, "marks": 0}], "type": "gapfill", "prompt": "Tick all boxes which describe this function:
\n[[0]]
\nNote that if you choose an incorrect option then you will lose 2 marks.
\nThe minimum number of marks you can obtain is 0.
", "showCorrectAnswer": true, "marks": 0}], "statement": "Determine whether the following defines a valid probability mass function.
\nAlso choose the options which describe the function.
", "tags": ["checked2015", "discrete distribution", "MAS1604", "MAS2304", "MAS8380", "MAS8401", "mass function", "pmf", "PMF", "Probability", "probability", "probability mass function", "statistics", "tested1"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus", "!simplifyFractions"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "25/02/2015: see the editing history for changes from now on.
\n\n
7/07/2012:
\nAdded tags.
\nChecked answers.
\n22/07/2012:
\nAdded description.
\nTicked stats extension box.
\nIssue with the multiple response question.The feedback on choosing only one correct answer out of the two says that both marks are awarded. This needs to be modified to the correct number of marks awarded and also in practice mode should give the information that there are other correct responses.
\nAnother linked issue is that there should be an option for forcing a number of choices for multiple response.
\n31/07/2012:
\nAdded tags.
\n20/12/2012:
\nThe above issue on multiple response has been resolved. Changed the MR so that lose 2 marks if choose an incorrect response (min mark 0).
\nCorrected error in setting up negative values for function, but still claiming that it was a PMF.
\nChecked calculation, OK. Added tested1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Determine if the following describes a probability mass function.
\n$P(X=x) = \\frac{ax+b}{c},\\;\\;x \\in S=\\{n_1,\\;n_2,\\;n_3,\\;n_4\\}\\subset \\mathbb{R}$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "A probability mass function $f(x)=P(X=x)$ has to satisfy:
\n1. $f(x) \\ge 0$, $\\forall x \\in S$
\n2. $\\sum_{x \\in S} f(x) = 1$
\nTo verify this we calculate the function as follows:
\n\\begin{align}
P(X = \\var{d1}) &= \\simplify[std]{({a} * {d1} + {b}) / {c} = {a * d1 + b} / {c}} \\\\ \\\\
P(X = \\var{d2}) &= \\simplify[std]{({a} * {d2} + {b}) / {c} = {a * d2 + b} / {c}} \\\\ \\\\
P(X = \\var{d3}) &= \\simplify[std]{({a} * {d3} + {b}) / {c} = {a * d3 + b} / {c}} \\\\ \\\\
P(X = \\var{d4}) &= \\simplify[std]{({a} * {d4} + {b}) / {c} = {a * d4 + b} / {c}}
\\end{align}
and
\n\\[ \\sum_{x \\in S} f(x) =\\simplify[std]{ {a*d1+b}/{c} + {a*d2+b}/{c} + {a*d3+b}/{c} + {a*d4+b}/{c}} = \\simplify[fractionNumbers]{{c-error}/{c}} = \\simplify[std,simplifyFractions]{{c-error}/{c}} \\]
\nIn this case, {if(is_pmf,\"this is a probability mass function\",\"this is not a probability mass function\")} as {explain_decision}.
"}, {"name": "Calculate expectation, variance and CDF of uniform distribution", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "name": "tol", "description": ""}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((upper-lower)^2/12,3)", "name": "ans2", "description": ""}, "ans3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((c-lower)/(upper-lower),3)", "name": "ans3", "description": ""}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(d1=f1,d1-1,min(d1,f1))", "name": "d", "description": ""}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower+1)", "name": "c", "description": ""}, "f": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(d1,f1)", "name": "f", "description": ""}, "ans1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(upper+lower)/2", "name": "ans1", "description": ""}, "d1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower+1)", "name": "d1", "description": ""}, "ans4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((f-d)/(upper-lower),3)", "name": "ans4", "description": ""}, "upper": {"templateType": "anything", "group": "Ungrouped variables", "definition": "lower+random(2..20#2)", "name": "upper", "description": ""}, "lower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-10..10)", "name": "lower", "description": ""}, "f1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower)", "name": "f1", "description": ""}}, "ungrouped_variables": ["upper", "lower", "f", "d", "f1", "ans1", "ans2", "ans3", "ans4", "c", "tol", "d1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "showQuestionGroupNames": false, "functions": {}, "parts": [{"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "ans1", "correctAnswerFraction": false, "marks": 1, "maxValue": "ans1"}, {"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "ans2-tol", "correctAnswerFraction": false, "marks": 1, "maxValue": "ans2+tol"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "The expectation $\\operatorname{E}[Y]=\\;$[[0]] (to 3 decimal places).
\nThe variance $\\operatorname{Var}(Y)=\\;$[[1]] (to 3 decimal places).
\n", "marks": 0}, {"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "ans3-tol", "correctAnswerFraction": false, "marks": 1, "maxValue": "ans3+tol"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "
$P(Y \\le \\var{c})=\\;$[[0]]
\n(to 3 decimal places).
", "marks": 0}, {"scripts": {}, "gaps": [{"answer": "(y-{lower})/({upper-lower})", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "answersimplification": "basic", "expectedvariablenames": [], "notallowed": {"showStrings": false, "message": "Input all numbers as fractions or integers.
", "strings": ["."], "partialCredit": 0}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "showCorrectAnswer": true, "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "Input the CDF $F_Y(y)$ for $y$ in the range $\\var{lower} \\le y \\le \\var{upper}$
\n$F_Y(y)=\\;$[[0]]
\nInput all numbers as fractions or integers
", "marks": 0}, {"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "ans4-tol", "correctAnswerFraction": false, "marks": 1, "maxValue": "ans4+tol"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "$P(\\var{d} \\lt Y \\lt \\var{f})=\\;$[[0]]
\n\nEnter your answer to 3 decimal places.
", "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "Let $Y$ be a random variable with the uniform distribution
\n\\[Y \\sim \\operatorname{U}(\\var{lower},\\var{upper})\\]
", "tags": ["CDF uniform", "checked2015", "continuous distributions", "expectation", "MAS1604", "Probability", "probability", "sc", "statistical distributions", "uniform distribution", "uniformly distributed", "variance"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "25/01/2013:
\nCopy made of 1403CBA3Q5 and then edited.
\nAdded fourth part.
\nTo be tested.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Exercise using a given uniform distribution $Y$, calculating the expectation and variance as well as asking for the CDF. Also finding $P(Y \\le a)$ and $P( b \\lt Y \\lt c)$ for a given values $a,\\;b,\\;c$.
"}, "advice": "a) For a Uniform distribution \\[Y \\sim \\operatorname{U}(\\var{lower},\\var{upper})\\] we have:
\n$\\displaystyle \\operatorname{E}[Y] = \\simplify[!collectNumbers]{({lower}+{upper})/2}=\\var{ans1}$
\n$\\displaystyle \\operatorname{Var}(Y) =\\simplify[basic,!collectNumbers,!noleadingminus]{({upper}-{lower})^2/12}=\\frac{\\var{upper-lower}^2}{12}=\\var{ans2}$ to 3 decimal places.
\nb)
\n$\\displaystyle P(Y \\le \\var{c})=\\simplify[basic,!collectNumbers,!noleadingminus]{({c} -{lower})/({upper}-{lower})}=\\var{ans3}$ to 3 decimal places.
\nc) The CDF for a uniform distribution $Y$ on the interval $a \\le y \\le b$ is given by:
\n\\[F_Y(y) = \\begin{cases} 0 & y \\lt a \\\\ \\frac{y-a}{b-a} & a \\le y \\le b, \\\\ 1 & y \\gt b. \\end{cases}\\]
\nHence in this case we have:
\n\\[F_Y(y) = \\simplify[basic]{(y-{lower})/({upper-lower})}\\] for $\\var{lower}\\le y \\le \\var{upper}$
\nd) Using the CDF we have:
\n\\[\\begin{eqnarray}P(\\var{d} \\lt Y \\lt \\var{f})&=&F_Y(\\var{f})-F_Y(\\var{d})\\\\&=& \\simplify[basic]{({f}-{lower})/({upper-lower})- ({d}-{lower})/({upper-lower})}\\\\&=&\\var{ans4}\\end{eqnarray}\\]
\nto 3 decimal places.
"}, {"name": "Calculate probabilities from a normal distribution, ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.0001", "description": "", "name": "tol"}, "amount": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"electricity consumption\"", "description": "", "name": "amount"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "normalcdf((upper-m)/s,0,1)", "description": "", "name": "p1"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(750..1250#50)", "description": "", "name": "m"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(normalcdf(lower,m,s),4)", "description": "", "name": "prob1"}, "stuff": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"a frozen foods warehouse each week in the summer months \"", "description": "", "name": "stuff"}, "lower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(m-1.5*s..m-0.5s#5)", "description": "", "name": "lower"}, "prob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-normalcdf(upper,m,s),4)", "description": "", "name": "prob2"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(60..100#10)", "description": "", "name": "s"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "normalcdf((m-lower)/s,0,1)", "description": "", "name": "p"}, "upper": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(m+0.5s..m+1.5*s#5)", "description": "", "name": "upper"}, "units1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"k Wh\"", "description": "", "name": "units1"}}, "ungrouped_variables": ["units1", "upper", "lower", "p1", "m", "s", "p", "amount", "stuff", "tol", "prob2", "prob1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"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": "Find the probability that in a particular week the {amount} is less than {lower} {units1}:
\nProbability = [[0]](to 4 decimal places)
\nFind the probability that in a particular week the {amount} is greater than {upper} {units1}:
\nProbability = [[1]](to 4 decimal places)
", "showCorrectAnswer": true, "marks": 0}], "statement": "The {amount}, $X$, of {stuff} is normally distributed with mean {m}{units1} and standard deviation {s}{units1}.
\ni.e. \\[X \\sim \\operatorname{N}(\\var{m},\\var{s}^2)\\]
\n", "tags": ["checked2015", "continuous random variable", "MAS8380", "MAS8401", "mean", "mean ", "Normal distribution", "normal distribution", "normal tables", "probabilities", "random variable", "sc", "standard deviation", "statistical distributions", "statistics", "z-scores"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t \t\t
1/1/2012:
\n \t\t \t\tCan be configured to other applications using the string variables suppplied. Included tag sc.
\n \t\t \n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "Given a random variable $X$ normally distributed as $\\operatorname{N}(m,\\sigma^2)$ find probabilities $P(X \\gt a),\\; a \\gt m;\\;\\;P(X \\lt b),\\;b \\lt m$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "1. Converting to $\\operatorname{N}(0,1)$
\n$\\simplify[all,!collectNumbers]{P(X < {lower}) = P(Z < ({lower} -{m}) / {s}) = P(Z < {lower-m}/{s}) = 1 -P(Z < {m-lower}/{s})} = 1 -\\var{p} = \\var{precround(1 -p,4)}$ to 4 decimal places.
\nHere the probability could have been looked up from normal CDF tables. Alternatively we can simply do the whole
\ncalculation in R by typing $\\operatorname{pnorm}(\\var{lower},\\var{m},\\var{s})$.
\n2. Converting to $\\operatorname{N}(0,1)$
\n$\\simplify[all,!collectNumbers]{P(X > {upper}) = P(Z > ({upper} -{m}) / {s}) = P(Z > {upper-m}/{s}) = 1 -P(Z < {upper-m}/{s})} = 1-\\var{p1} = \\var{precround(1 -p1,4)}$ to 4 decimal places.
\nHere the probability could have been looked up from normal CDF tables. Alternatively we can
\nsimply do the whole calculation in R by typing 1 - pnorm({upper},{m},{s})
.
Find the probability that the {stuff} concentration exceeds $\\var{thismany}$ parts per million in a one hour period.
\nInput your answer to 3 decimal places.
", "minValue": "p-tol", "maxValue": "p+tol", "marks": 1, "showPrecisionHint": false}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "prompt": "A control strategy reduced the mean to $\\var{m1}$ parts per million.
\nNow find the probability that a concentration exceeds $\\var{thismany}$ parts per million in a one hour period.
\nInput your answer to 3 decimal places.
", "minValue": "p1-tol", "maxValue": "p1+tol", "marks": 1, "showPrecisionHint": false}], "statement": "One hour {stuff} concentrations in samples of air taken at a location in {place} have an approximate exponential distribution with mean $\\var{m}$ parts per million.
", "tags": ["checked2015", "continuous distributions", "distributions", "exponential distribution", "MAS1604", "MAS2304", "Probability", "statistical distributions", "statistics"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "29/01/2013:
\n
First draft completed.
Calculating simple probabilities using the exponential distribution.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "The random variable $X$ is {stuff} concentration {ppm} and $ \\displaystyle X \\sim \\operatorname{Exp}\\left(\\frac{1}{\\var{m}}\\right )$.
\nHence the probability that $X \\lt x$ is $P(X \\lt x)=1-e^{-x/\\var{m}}$.
\na)
\n$P(X \\gt \\var{thismany})=1-P(X \\lt \\var{thismany})=1-(1-e^{-\\var{thismany}/\\var{m}})=\\var{p}$ to 3 decimal places.
\n\n
b) Changing the mean value gives:
\n$P(X \\gt \\var{thismany})=1-P(X \\lt \\var{thismany})=1-(1-e^{-\\var{thismany}/\\var{m1}})=\\var{p1}$ to 3 decimal places.
\n"}, {"name": "Expectation and variance of combinations of estimators", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'B'", "name": "b", "description": ""}, "e3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "s3*m", "name": "e3", "description": ""}, "unb2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(unb1=0,1,random(0,1))", "name": "unb2", "description": ""}, "s7": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,-1)", "name": "s7", "description": ""}, "sqsum1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "cw1^2+cx1^2+cy1^2+cz1^2", "name": "sqsum1", "description": ""}, "wrong": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(unb1*unb2>0,'C',if(unb1=1,'B','A'))", "name": "wrong", "description": ""}, "t3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(unb3=1,1,random(2..9))", "name": "t3", "description": ""}, "v1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sqsum1*sd^2", "name": "v1", "description": ""}, "su2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "cw2+cx2+cy2+cz2", "name": "su2", "description": ""}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('W','X','Y','Z')", "name": "p", "description": ""}, "cy1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(cx1=0,random(1..9),random(-9..9))", "name": "cy1", "description": ""}, "sd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..6)", "name": "sd", "description": ""}, "cw1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)", "name": "cw1", "description": ""}, "t1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(unb1=1,1,random(2..9))", "name": "t1", "description": ""}, "tw": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0,1)", "name": "tw", "description": ""}, "cy3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..9)", "name": "cy3", "description": ""}, "sqsum2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "cw2^2+cx2^2+cy2^2+cz2^2", "name": "sqsum2", "description": ""}, "v3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sqsum3*sd^2", "name": "v3", "description": ""}, "s1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "cw1+cx1+cy1+cz1", "name": "s1", "description": ""}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.01", "name": "tol", "description": ""}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'A'", "name": "a", "description": ""}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'C'", "name": "c", "description": ""}, "sqsum3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "cw3^2+cx3^2+cy3^2+cz3^2", "name": "sqsum3", "description": ""}, "s2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(unb2=1,su2,su2+random(1..4))", "name": "s2", "description": ""}, "unb1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0,1)", "name": "unb1", "description": ""}, "cz3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "t3-cw3-cx3-cy3", "name": "cz3", "description": ""}, "cx2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)", "name": "cx2", "description": ""}, "cw3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "tw*random(10..40)", "name": "cw3", "description": ""}, "sx": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,-1)", "name": "sx", "description": ""}, "correct2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(unb1=1,if(unb2=1,'B','C'),'C')", "name": "correct2", "description": ""}, "cw2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)", "name": "cw2", "description": ""}, "q": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(p='X',random('W','Y','Z'),p='W',random('X','Y','Z'),p='Y',random('W','X','Z'),random('W','X','Y'))", "name": "q", "description": ""}, "e2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(su2*m/S2,2)", "name": "e2", "description": ""}, "e1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "s1*m", "name": "e1", "description": ""}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "s7*random(1..10)", "name": "m", "description": ""}, "correct1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(unb1=1,'A','B')", "name": "correct1", "description": ""}, "cz2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)", "name": "cz2", "description": ""}, "unb3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(unb1*unb2>0,0,1)", "name": "unb3", "description": ""}, "cy2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)", "name": "cy2", "description": ""}, "cx1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-9..9)", "name": "cx1", "description": ""}, "s3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "cw3+cx3+cy3+cz3", "name": "s3", "description": ""}, "v2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sqsum2*sd^2/S2^2,2)", "name": "v2", "description": ""}, "cx3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "tx*sx*random(1..9)", "name": "cx3", "description": ""}, "cz1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "t1-cx1-cw1-cy1", "name": "cz1", "description": ""}, "tx": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(tw=0,1,0)", "name": "tx", "description": ""}}, "ungrouped_variables": ["cy3", "cy2", "cy1", "t3", "correct2", "correct1", "t1", "unb3", "unb2", "unb1", "s3", "tw", "s1", "s7", "tol", "cx1", "cx2", "cx3", "sqsum1", "sqsum3", "sqsum2", "cz2", "cz3", "cz1", "v1", "v2", "v3", "e1", "e3", "e2", "a", "c", "b", "tx", "cw1", "cw3", "cw2", "m", "wrong", "sx", "q", "p", "su2", "s2", "sd"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "showQuestionGroupNames": false, "functions": {}, "parts": [{"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{e1}", "correctAnswerFraction": false, "marks": 1, "maxValue": "{e1}"}, {"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{v1}", "correctAnswerFraction": false, "marks": 1, "maxValue": "{v1}"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "
$\\simplify[std]{A = {cw1} * W + {cx1} * X + {cy1} * Y + {cz1} * Z}$
\n$ \\operatorname{E}[A]=\\;\\;$[[0]]$\\;\\;\\;\\;\\operatorname{Var}(A)=\\;\\;\\;$[[1]]
\nInput both as integers.
", "marks": 0}, {"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{e2-tol}", "correctAnswerFraction": false, "marks": 1, "maxValue": "{e2+tol}"}, {"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{v2-tol}", "correctAnswerFraction": false, "marks": 1, "maxValue": "{v2+tol}"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "$\\simplify[std]{B = (1 / {S2}) * ({cw2} * W + {cx2} * X + {cy2} * Y + {cz2} * Z)}$
\n$\\operatorname{E}[B]=\\;\\;$[[0]]$\\;\\;\\;\\;\\operatorname{Var}(B)=\\;\\;\\;$[[1]]
\nInput both to 2 decimal places.
", "marks": 0}, {"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{e3}", "correctAnswerFraction": false, "marks": 1, "maxValue": "{e3}"}, {"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{v3}", "correctAnswerFraction": false, "marks": 1, "maxValue": "{v3}"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "$\\simplify[std]{C = {cw3} * W + {cx3} * X + {cy3} * Y + {cz3} * Z}$
\n$ \\operatorname{E}[C]=\\;\\;$[[0]]$\\;\\;\\;\\;\\operatorname{Var}(C)=\\;\\;\\;$[[1]]
\nInput both as integers.
", "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "checkbox", "choices": ["$\\var{Correct1}$
", "$\\var{Correct2}$
", "$\\var{Wrong}$
"], "matrix": [1, 1, -1], "distractors": ["", "", ""], "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": true, "scripts": {}, "maxMarks": 0, "type": "m_n_2", "minMarks": 0, "showCorrectAnswer": true, "displayColumns": 3, "marks": 0}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n \n \nWhich of the estimators $A,\\;\\;B$ or $C$ above are unbiased for $\\mu$? Select the correct choices.
You will lose a mark for selecting a wrong choice.
[[0]]
\n \n ", "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["$\\var{B}$
", "$\\var{A}$
", "$\\var{C}$
"], "matrix": [1, 0, 0], "distractors": ["", "", ""], "shuffleChoices": true, "scripts": {}, "maxMarks": 0, "type": "1_n_2", "minMarks": 0, "showCorrectAnswer": true, "displayColumns": 3, "marks": 0}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\n \n \nWhich of the estimators $A,\\;\\;B$ or $C$ above is the most efficient?
\n \n \n \n[[0]]
\n \n ", "marks": 0}, {"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{m^2}", "correctAnswerFraction": false, "marks": 1, "maxValue": "{m^2}"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "Find $\\operatorname{E}[\\var{p}\\var{q}]=\\;\\;$[[0]]
", "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "Suppose $W,\\;\\;X,\\;\\;Y,\\;\\;$ and $Z$ are i.i.d. variables with mean $\\mu=\\var{m}$, standard deviation $\\sigma=\\var{sd}$
\nFind the expectation and variance of each of the following estimators of $\\mu$.
", "tags": ["IID", "MAS1604", "biased", "checked2015", "cr1", "efficient estimators", "estimators", "expectation", "i.i.d", "identical independent distributions", "iid", "independent identical distributions", "mean ", "random variables", "standard deviation", "statistics", "tested1", "unbiased", "unbiased estimators", "variance"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "13/07/2012:
\nAdded tags.
\nImproved and made consistent the display in various content areas.
\nSet new tolerance variable tol=0 for 2 dps numeric input questions.
\nAdded formula for $\\operatorname{Var}(aR+bS)$.
\nChecked calculation.
\nAdded description.
\n1/08/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\n21/12/2012:
\nChecked calculation, OK. Added tested1 tag.
\nChecked rounding, OK. Added tag cr1.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given three linear combinations of four i.i.d. variables, find the expectation and variance of these estimators of the mean $\\mu$. Which are unbiased and efficient?
"}, "advice": "We use the result throughout these solutions that for independent random variables $R$ and $S$ then $\\operatorname{E}[aR+bS]=a \\operatorname{E}[R]+b\\operatorname{E}[S]$ and $\\operatorname{Var}(aR+bS)=a^2\\operatorname{Var}(R)+b^2\\operatorname{Var}(S)$.
\na)
\\[\\begin{eqnarray*} \\operatorname{E}[A] &=& \\operatorname{E}[\\simplify[std]{{cw1} * W + {cx1} * X + {cy1} * Y + {cz1} * Z}]\\\\ &=& \\simplify[std]{{cw1} * {m} + {cx1} * {m} + {cy1} * {m} + {cz1} * {m}}\\\\ &=& \\var{e1}\\\\ \\\\ \\\\ \\operatorname{Var}(A) &=& \\operatorname{Var}[\\simplify[std]{{cw1} * W + {cx1} * X + {cy1} * Y + {cz1} * Z}]\\\\ &=& \\simplify[std]{ {cw1 ^ 2} * Var(W) + {cx1 ^ 2} * Var(X) + {cy1 ^ 2} * Var(Y) + {cz1 ^ 2} * Var(Z)}\\\\ &=& \\simplify[std]{{cw1 ^ 2} * {sd ^ 2} + {cx1 ^ 2} * {sd ^ 2} + {cy1 ^ 2} * {sd ^ 2} + {cz1 ^ 2} * {sd ^ 2} }\\\\ &=& \\var{v1} \\end{eqnarray*} \\]
b)
\\[\\begin{eqnarray*} \\operatorname{E}[B] &=& \\frac{1}{\\var{S2}}\\left(\\operatorname{E}[\\simplify[std]{{cw2} * W + {cx2} * X + {cy2} * Y + {cz2} * Z}]\\right)\\\\ &=& \\frac{1}{\\var{S2}}\\left(\\simplify[std]{{cw2} * {m} + {cx2} * {m} + {cy2} * {m} + {cz2} * {m}}\\right)\\\\ &=& \\var{e2}\\\\ \\\\ \\\\ \\operatorname{Var}(B) &=& \\frac{1}{\\var{S2^2}}\\left(\\operatorname{Var}[\\simplify[std]{{cw2} * W + {cx2} * X + {cy2} * Y + {cz2} * Z}]\\right)\\\\ &=& \\frac{1}{\\var{S2^2}}\\left(\\simplify[std]{ {cw2 ^ 2} * Var(W) + {cx2 ^ 2} * Var(X) + {cy2 ^ 2} * Var(Y) + {cz2 ^ 2} * Var(Z)}\\right)\\\\ &=& \\frac{1}{\\var{S2^2}}\\left(\\simplify[std]{{cw2 ^ 2} * {sd ^ 2} + {cx2 ^ 2} * {sd ^ 2} + {cy2 ^ 2} * {sd ^ 2} + {cz2 ^ 2} * {sd ^ 2} }\\right)\\\\ &=& \\var{v2} \\end{eqnarray*} \\]
c)
\\[\\begin{eqnarray*} \\operatorname{E}[C] &=& \\operatorname{E}[\\simplify[std,collectNumbers]{{cw3} * W + {cx3} * X + {cy3} * Y + {cz3} * Z}]\\\\ &=& \\simplify[std,collectNumbers]{{cw3} * {m} + {cx3} * {m} + {cy3} * {m} + {cz3} * {m}}\\\\ &=& \\var{e3}\\\\ \\\\ \\\\ \\operatorname{Var}(C) &=& \\operatorname{Var}[\\simplify[std]{{cw3} * W + {cx3} * X + {cy3} * Y + {cz3} * Z}]\\\\ &=& \\simplify[std]{ {cw3 ^ 2} * Var(W) + {cx3 ^ 2} * Var(X) + {cy3 ^ 2} * Var(Y) + {cz3 ^ 2} * Var(Z)}\\\\ &=& \\simplify[std]{{cw3 ^ 2} * {sd ^ 2} + {cx3 ^ 2} * {sd ^ 2} + {cy3 ^ 2} * {sd ^ 2} + {cz3 ^ 2} * {sd ^ 2} }\\\\ &=& \\var{v3} \\end{eqnarray*} \\]
d)
\nWe see that $\\var{Correct1},\\;\\;\\var{Correct2}\\;\\;$ are unbiased estimators for $\\mu=\\var{m}$ as their expectations are $\\var{m}$.
\ne)
\nThe most efficient estimator is $B$ as it has the smallest variance.
\nf)
Since $\\var{p}$ and $\\var{q}$ are independent we have:
$\\operatorname{E}[\\var{p}\\var{q}]=\\operatorname{E}[\\var{p}]\\operatorname{E}[\\var{q}] = \\var{m}\\times \\var{m} = \\var{m^2}$
"}, {"name": "Find expectation, variance and probability sample mean in range for normal distribution, , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.0001", "description": "", "name": "tol"}, "zlowsam": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sqrt(sa)*zlow", "description": "", "name": "zlowsam"}, "pupsam": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(normalCDF(zupsam,0,1),6)", "description": "", "name": "pupsam"}, "tol1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "description": "", "name": "tol1"}, "sva": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(s^2/sa,2)", "description": "", "name": "sva"}, "pup": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(normalcdf(zup,0,1),6)", "description": "", "name": "pup"}, "plowsam": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(normalCDF(abs(zlowsam),0,1),6)", "description": "", "name": "plowsam"}, "zlow": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(lower-m)/s", "description": "", "name": "zlow"}, "sup": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.75#0.005)", "description": "", "name": "sup"}, "upper": {"templateType": "anything", "group": "Ungrouped variables", "definition": "m+sup*s", "description": "", "name": "upper"}, "lower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "m-slow*s", "description": "", "name": "lower"}, "plow": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(normalcdf(abs(zlow),0,1),6)", "description": "", "name": "plow"}, "nationality": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('English','Australian','African','American','Chinese','Mediterranean')", "description": "", "name": "nationality"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(100..300#10)", "description": "", "name": "m"}, "animals": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('rabbits','goats','mice','cows','rats')", "description": "", "name": "animals"}, "sb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(sa=9,random(16,25,36),if(sa=16,random(25,36),36))", "description": "", "name": "sb"}, "probsam": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pupsam+plowsam-1,4)", "description": "", "name": "probsam"}, "zup": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(upper-m)/s", "description": "", "name": "zup"}, "stuff": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('sodium choride','fatty acid','potassium','protein','carbonic anhydrase','fibrinogen')", "description": "", "name": "stuff"}, "slow": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.75#0.005)", "description": "", "name": "slow"}, "zupsam": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sqrt(sa)*zup", "description": "", "name": "zupsam"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(15..30#5)", "description": "", "name": "s"}, "svb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(s^2/sb,2)", "description": "", "name": "svb"}, "prob": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pup+plow-1,4)", "description": "", "name": "prob"}, "sa": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(s=25,random(9,16),random(9,16,25))", "description": "", "name": "sa"}}, "ungrouped_variables": ["upper", "zlowsam", "zlow", "m", "plowsam", "plow", "slow", "tol", "sup", "prob", "zup", "probsam", "zupsam", "nationality", "pup", "lower", "animals", "pupsam", "svb", "sva", "s", "stuff", "sb", "sa", "tol1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{prob+tol}", "minValue": "{prob-tol}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\nFind:
\n$P(\\var{lower} \\lt X \\lt \\var{upper})=\\;\\;$[[0]]
\nCorrect to 4 decimal places.
\n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{m}", "minValue": "{m}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{sva+tol1}", "minValue": "{sva-tol1}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{m}", "minValue": "{m}", "correctAnswerFraction": false, "marks": 0.5, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{svb+tol1}", "minValue": "{svb-tol1}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Let $\\overline{X}$ be the random variable given by the sample mean.
\nFind $\\operatorname{E}[ \\overline{X}]$ and $\\operatorname{Var}(\\overline{X})$ in the following cases:
\n1) A sample of size $\\var{sa}$
\n$\\operatorname{E}[ \\overline{X}]=\\;\\;$[[0]]$\\;\\;\\;\\operatorname{Var}(\\overline{X})=\\;\\;$[[1]]
\n2) A sample of size $\\var{sb}$
\n$\\operatorname{E}[ \\overline{X}]=\\;\\;$[[2]]$\\;\\;\\;\\operatorname{Var}(\\overline{X})=\\;\\;$[[3]]
\nEnter the variances to 2 decimal places.
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{probsam+tol}", "minValue": "{probsam-tol}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n \n \nAssuming that $\\overline{X}$ also follows a normal distribution.
\n \n \n \nFind $P(\\var{lower} \\lt \\overline{X} \\lt \\var{upper})$ in a sample of size $\\var{sa}$.
\n \n \n \n$P(\\var{lower} \\lt \\overline{X} \\lt \\var{upper})=\\;\\;$[[0]]
\n \n \n \nEnter the value correct to 4 decimal places.
\n \n \n ", "showCorrectAnswer": true, "marks": 0}], "statement": "The total {stuff} content of the blood plasma of {nationality} {animals} ($X$, in mg/100ml) is known to follow a $N(\\var{m},\\var{s^2})$ distribution.
", "tags": ["checked2015", "cr1", "distribution of sample mean", "distributions", "MAS1604", "MAS8380", "MAS8401", "normal distribution", "Normal distribution", "Probability", "probability", "random variables", "sample", "sample distribution", "sample mean", "sc", "statistics", "tested1", "z scores"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "13/07/2012:
\nAdded tags.
\nCannot check calculations as yet as cannot access stats extension.
\nSet new tolerance variable tol=0.0001 for numeric entries to 4 dps.
\nSet new tolerance variable tol=0 for numeric entries to 2 dps.
\n21/12/2012:
\nChecked calculations against standard tables, OK. Added tested1 tag.
\nCorrected a typos and improved display in Advice.
\nChecked rounding, OK. Added tag cr1.
\nThis has scenarios - could be extended. Added sc tag.
\n", "licence": "Creative Commons Attribution 4.0 International", "description": "
Normal distribution $X \\sim N(\\mu,\\sigma^2)$ given. Find $P(a \\lt X \\lt b)$. Find expectation, variance, $P(c \\lt \\overline{X} \\lt d)$ for sample mean $\\overline{X}$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a) Converting to $Z$ scores in $N(0,1)$ we have for $X \\sim N(\\var{m},\\var{s^2})$
\n\\[\\begin{eqnarray*} P(\\var{lower} \\lt X \\lt \\var{upper})&=&P(X \\lt \\var{upper})-P(X \\lt \\var{lower})\\\\ &=&P\\left(Z \\lt \\frac{\\var{upper}-\\var{m}}{\\var{s}}\\right)-P\\left(Z \\lt \\frac{\\var{lower}-\\var{m}}{\\var{s}}\\right)\\\\ &=&P(Z \\lt \\var{zup})-P( Z \\lt \\var{zlow})\\\\ &=&\\var{pup}-\\var{1-plow}\\\\ &=&\\var{prob} \\end{eqnarray*} \\] to 4 decimal places.
\nHere the probabilities could have been looked up from normal CDF tables. Alternatively we can simply do the whole calculation in
\nR by typing $\\operatorname{pnorm}(\\var{upper},\\var{m},\\var{s})-\\operatorname{pnorm}(\\var{lower},\\var{m},\\var{s})$.
\nb)
This part reminds you that for the sample mean for samples of size $n$ from a normal distribution $N(\\mu,\\sigma^2)$ has a normal distribution $\\displaystyle N\\left(\\mu,\\frac{\\sigma^2}{n}\\right)$.
Hence for a sample size $\\var{sa}$:
\n$\\displaystyle \\operatorname{E}[\\overline{X}] = \\mu=\\var{m}$ and $\\displaystyle \\operatorname{Var}(\\overline{X}) = \\frac{\\sigma^2}{n}=\\frac{\\var{s^2}}{\\var{sa}}=\\var{sva}$
\nHence for a sample size $\\var{sb}$:
\n$\\operatorname{E}[\\overline{X}] = \\mu=\\var{m}$ and $\\displaystyle \\operatorname{Var}(\\overline{X}) = \\frac{\\sigma^2}{n}=\\frac{\\var{s^2}}{\\var{sb}}=\\var{svb}$
\nc)
Since the sample size is $\\var{sa}$ we are dealing with the normal distribution $N(\\var{m},\\simplify[std]{{s^2}/{sa}})$.
Converting to $Z$ scores in $N(0,1)$ we have for $\\overline{X} \\sim N(\\var{m},\\simplify[std]{{s^2}/{sa}})$
\n\\[\\begin{eqnarray*} P(\\var{lower} \\lt \\overline{X} \\lt \\var{upper})&=&P(\\overline{X} \\lt \\var{upper})-P(\\overline{X}\\lt \\var{lower})\\\\ &=&P\\left(Z \\lt \\frac{\\sqrt{\\var{sa}}(\\var{upper}-\\var{m})}{\\var{s}}\\right)-P\\left(Z \\lt \\frac{\\sqrt{\\var{sa}}(\\var{lower}-\\var{m})}{\\var{s}}\\right)\\\\ &=&P(Z \\lt \\var{zupsam})-P( Z \\lt \\var{zlowsam})\\\\ &=&\\var{pupsam}-\\var{1-plowsam}\\\\ &=&\\var{probsam} \\end{eqnarray*} \\] to 4 decimal places.
\nHere the probabilities could have been looked up from normal CDF tables. Alternatively we can simply do the whole calculation in
\nR by typing $\\operatorname{pnorm}(\\var{upper},\\var{m},\\frac{\\var{s}}{\\sqrt{\\var{sa}}})-\\operatorname{pnorm}(\\var{lower},\\var{m},\\frac{\\var{s}}{\\sqrt{\\var{sa}}})$ i.e. $\\operatorname{pnorm}(\\var{upper},\\var{m},\\var{s/sqrt(sa)})-\\operatorname{pnorm}(\\var{lower},\\var{m},\\var{s/sqrt(sa)})$
"}], "pickQuestions": 0}], "variable_groups": [], "contributors": [{"name": "Etain Kiely", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1608/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}