// Numbas version: finer_feedback_settings {"name": "Statistics Recap Exercises", "metadata": {"description": "", "licence": "None specified"}, "duration": 0, "percentPass": "40", "showQuestionGroupNames": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", "", "", "", "", "", "", "", "", "", "", ""], "questions": [{"name": "Mark's copy of Find mean, standard deviation, median and interquartile range of 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/"}, {"name": "Mark Patterson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5064/"}], "variable_groups": [], "variables": {"av": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(mean(r),2)", "description": "", "name": "av"}, "sig": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..4#0.2)", "description": "", "name": "sig"}, "std": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r,true),2)", "description": "", "name": "std"}, "these": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'specialist camera equipment'", "description": "", "name": "these"}, "m": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(n=2,12,random(7,5))", "description": "", "name": "m"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'an online warehouse' ", "description": "", "name": "this"}, "med": {"templateType": "anything", "group": "Ungrouped variables", "definition": "median(r)", "description": "", "name": "med"}, "tble1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(repeat(max(round(normalsample(me,sig)),random(4..6)),m),n)", "description": "", "name": "tble1"}, "whatever": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'number of orders per ' + period", "description": "", "name": "whatever"}, "interq": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(uquartile(r)-lquartile(r),2)", "description": "", "name": "interq"}, "shortform": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'orders'", "description": "", "name": "shortform"}, "r": {"templateType": "anything", "group": "Ungrouped variables", "definition": "flattenint(tble1)", "description": "", "name": "r"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2,3)", "description": "", "name": "n"}, "tble": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(n=2,map(['Year '+x+':']+tble1[x-1],x,1..2),map(['Week '+ x+':']+tble1[x-1],x,1..3))", "description": "", "name": "tble"}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'over a '+ n + ' '+p+ ' period,'", "description": "", "name": "units"}, "note": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(mean(r)=av,' ','Note that we used the more accurate value $(\\\\var{mean(r)})^2$ for $\\\\bar{x}^2$.')", "description": "", "name": "note"}, "me": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(7..12)", "description": "", "name": "me"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(m=12,'year','week')", "description": "", "name": "p"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(m=12,[' ','J','F','M','A','M','J','J','A','S','O','N','D'],m=5,[' ','M','T','W','T','F'],[' ','M','T','W','T','F','S','S'])", "description": "", "name": "t"}, "period": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(m=7,'day',m=12,'month',m=5,'weekday')", "description": "", "name": "period"}}, "ungrouped_variables": ["me", "tble1", "tble", "p", "shortform", "med", "this", "m", "interq", "whatever", "n", "note", "these", "std", "r", "sig", "t", "av", "units", "period"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {"flattenint": {"type": "list", "language": "javascript", "definition": "/*only for integer arrays*/ \n array.toString().split(',').forEach( function (item, i) \n {array[i] = parseInt(item);\n }\n ); \n return array;", "parameters": [["array", "list"]]}, "uquartile": {"type": "number", "language": "jme", "definition": "interpolate(a,3*(length(a)+1)/4)", "parameters": [["a", "list"]]}, "interpolate": {"type": "number", "language": "jme", "definition": "(1-fract(r))*sort(a)[floor(r)-1]+fract(r)*sort(a)[ceil(r)-1]", "parameters": [["a", "list"], ["r", "number"]]}, "lquartile": {"type": "number", "language": "jme", "definition": "interpolate(a,(length(a)+1)/4)", "parameters": [["a", "list"]]}}, "showQuestionGroupNames": false, "parts": [{"prompt": "
Sample mean = [[0]]{shortform}. Give your answer to $2$ decimal places (include trailing zeros if required).
\nSample Standard Deviation = [[1]] {shortform}. Give your answer to $2$ decimal places (include trailing zeros if required).
\nSample Median = [[2]] (Input as an exact decimal).
\nThe interquartile range= [[3]] (Input as an exact decimal).
", "scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "av-0.01", "maxValue": "av+0.01", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "std-0.01", "maxValue": "std+0.01", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "med", "minValue": "med", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "showPrecisionHint": false}, {"correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "interq", "minValue": "interq", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0}], "statement": "The following data are the {whatever} for {these}, {units} taken by {this}
\n{table(tble,t)}
\nAnswer the following questions:
\n\n
", "tags": ["ACE2013", "checked2015", "interquartile range", "lower quartile", "MAS1403", "mean", "mean ", "median", "quartiles", "sample data", "sample mean", "sample standard deviation", "standard deviation", "statistics", "upper quartile"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "
Note that the uquartile and lquartile are calculated as given by the functions below these may change!
\n21/12/2012:
\nThree user defined functions. Added tag udf.
\nflattenint, takes an array of arrays with integers leaves and converts to an integer array by flattening the array. Other two functions, uquartile and lquartile find the lower and upper quartiles.
\nScenarios possible, added sc.
\n22/10/2013:
\n
Redefined functions uquartile and lquartile to fit new definitions. Added helper udf interpolate.
Given sample data find mean, standard deviation, median, interquartile range,
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "As we have to find the median and the interquartile range it is a good idea to order the data and also to total up the data (for the mean) and find the total of the squares of the data (for the variance).
\n{table([['Data']+sort(r),['Squared data']+map(x^2,x,sort(r)),['Index']+map(x,x,1..m*n)],[])}
\nNote that from the above table:
\n$n=\\var{m*n}$.
\n$\\displaystyle \\sum x_i = \\var{sum(r)}$ and
\n$\\displaystyle \\sum x^2_i = \\var{sum(map(x^2,x,r))}$ .
\nThe sample mean is $\\bar{x}=\\displaystyle \\frac{ \\sum x_i}{n}=\\frac{\\var{sum(r)}}{\\var{m*n}}=\\var{mean(r)}=\\var{av}$ to 2 decimal places.
\nThe sample deviation is the square root of the sample variance.
\nSample variance:\\[\\begin{eqnarray*}\\frac{1}{ n -1}\\left(\\sum x_i ^ 2 - n \\bar{x} ^ 2\\right)&=& \\frac{1}{\\var{m*n-1}}\\left(\\var{sum(map(x^2,x,r))}-\\var{m*n}\\times\\var{mean(r)^2}\\right)\\\\&=&\\var{variance(r,true)}\\end{eqnarray*}\\] {Note}
\nSo the sample standard deviation = $\\sqrt{\\var{variance(r,true)}}=\\var{std}$ to 2 decimal places.
\nThe median is $\\var{median(r)} $.
\nThe lower quartile is : $\\var{lquartile(r)}$.
\nThe upper quartile is : $\\var{uquartile(r)}$.
\nThe interquartile range is the difference between these quartiles =$\\var{uquartile(r)}-\\var{lquartile(r)}=\\var{uquartile(r)-lquartile(r)}$
\n\n
"}, {"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": "Mark's copy of Correlation", "extensions": [], "custom_part_types": [], "resources": [["question-resources/Positive_correlation_TBHAgaf.png", "/srv/numbas/media/question-resources/Positive_correlation_TBHAgaf.png"], ["question-resources/Negative_correlation_0kGEr62.png", "/srv/numbas/media/question-resources/Negative_correlation_0kGEr62.png"], ["question-resources/No_correlation_dgeELhV.png", "/srv/numbas/media/question-resources/No_correlation_dgeELhV.png"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Rachel Staddon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/901/"}, {"name": "Mark Patterson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5064/"}], "tags": [], "metadata": {"description": "Identifying positive, negative and no correlations.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "Answer the following.
", "advice": "A correlation is a relationship between the two variables. This usually looks like a line on a graph. It does not have to be a perfect correlation.
\nIn a positive correlation, as one variable increases, the other increases. This looks like a line of points going up and to the right. In a negative correlation, as one variable increases, the other decreases. This looks like a line of points going down and to the right. If there is no correlation, there is no relationship between the two variables. This looks like a lot of points scattered randomly.
", "rulesets": {}, "variables": {"index": {"name": "index", "group": "Ungrouped variables", "definition": "random(0..len(graphs)-1)", "description": "", "templateType": "anything"}, "wrongcorr1": {"name": "wrongcorr1", "group": "Ungrouped variables", "definition": "corr[index2]", "description": "", "templateType": "anything"}, "wrongcorr2": {"name": "wrongcorr2", "group": "Ungrouped variables", "definition": "corr[index3]", "description": "", "templateType": "anything"}, "graphs": {"name": "graphs", "group": "Ungrouped variables", "definition": "['Positive_correlation_TBHAgaf.png','Negative_correlation_0kGEr62.png','No_correlation_dgeELhV.png']", "description": "", "templateType": "anything"}, "chosencorr": {"name": "chosencorr", "group": "Ungrouped variables", "definition": "corr[index]", "description": "", "templateType": "anything"}, "corr": {"name": "corr", "group": "Ungrouped variables", "definition": "['Positive','Negative','None']", "description": "", "templateType": "anything"}, "index2": {"name": "index2", "group": "Ungrouped variables", "definition": "random(0..len(graphs)-1 except index)", "description": "", "templateType": "anything"}, "index3": {"name": "index3", "group": "Ungrouped variables", "definition": "random(0..len(graphs)-1 except [index2,index])", "description": "", "templateType": "anything"}, "chosengraph": {"name": "chosengraph", "group": "Ungrouped variables", "definition": "graphs[index]", "description": "", "templateType": "anything"}, "chosengraphB": {"name": "chosengraphB", "group": "Ungrouped variables", "definition": "graphs[index2]", "description": "", "templateType": "anything"}, "chosencorrB": {"name": "chosencorrB", "group": "Ungrouped variables", "definition": "corr[index2]", "description": "", "templateType": "anything"}, "wrongcorr1B": {"name": "wrongcorr1B", "group": "Ungrouped variables", "definition": "corr[index3]", "description": "", "templateType": "anything"}, "wrongcorr2B": {"name": "wrongcorr2B", "group": "Ungrouped variables", "definition": "corr[index]", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["graphs", "index", "corr", "chosengraph", "chosencorr", "index2", "index3", "wrongcorr1", "wrongcorr2", "chosengraphB", "chosencorrB", "wrongcorr1B", "wrongcorr2B"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "1_n_2", "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": "Does the graph below have a positive, negative or no correlation?
\n{image('resources/question-resources/'+chosengraph)}
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["{chosencorr}
", "{wrongcorr1}
", "{wrongcorr2}
"], "matrix": ["1", 0, 0], "distractors": ["", "", ""]}, {"type": "1_n_2", "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": "Does the graph below have a positive, negative or no correlation?
\n{image('resources/question-resources/'+chosengraphB)}
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["{chosencorrB}
", "{wrongcorr1B}
", "{wrongcorr2B}
"], "matrix": ["1", 0, 0], "distractors": ["", "", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Mark's copy of Correlation Coefficient", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Habiba Gora", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/494/"}, {"name": "Mark Patterson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5064/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "The data below gives the obesity and blood pressure of seven females (aged 35-60) in a small town:
\nObesity | \nBlood Pressure | \n
{o1} | \n{b1} | \n
{o2} | \n{b2} | \n
{o3} | \n{b3} | \n
{o4} | \n{b4} | \n
{o5} | \n{b5} | \n
{o6} | \n{b6} | \n
{o7} | \n{b7} | \n
Determine the mean of both the obesity and the blood pressure to two decimal places.
\nObesity: [[0]]
\nBlood Pressure: [[1]]
", "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": "meano-0.05", "maxValue": "meano+0.05", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": "50", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "meanb-0.05", "maxValue": "meanb+0.05", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": "50", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"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, "prompt": "What is the correlation coefficient, to two decimal places, between these two quantities?
", "minValue": "(covob/(varo*varb)^0.5)-0.05", "maxValue": "(covob/(varo*varb)^0.5)+0.05", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": "50", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Number of combinations without replacement - lotto ticket, ", "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": {"b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(4..7)", "description": "", "name": "b"}, "ans": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(a,b)", "description": "", "name": "ans"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(30..50)", "description": "", "name": "a"}}, "ungrouped_variables": ["a", "b", "ans"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans", "minValue": "ans", "correctAnswerFraction": false, "marks": 2, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Number of tickets = ?[[0]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "In a lotto game a player buys a ticket and selects $\\var{b}$ numbers from a list of the numbers from $1$ to $\\var{a}$.
\nThen $\\var{b}$ winning numbers are selected at random without replacement.
\nHow many tickets would you need to buy in order to be sure of choosing all $\\var{b}$ numbers correctly?
", "tags": ["binomial coefficients", "checked2015", "choosing without replacement", "combinations", "counting", "MAS1701", "MAS2216", "sc", "selecting"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/02/2013:
\nFinished first draft. Description and tags need to be completed. Added tag sc.
", "licence": "Creative Commons Attribution 4.0 International", "description": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "Each choice of $\\var{b}$ numbers results in a subset of the numbers $1$ to $\\var{a}$.
\nThe number of such possibilities is equal to the number of $\\var{b}$-subsets of $\\var{a}$ elements, so you need to buy this number of tickets to guarantee a win!
\n\\[\\binom{\\var{a}}{\\var{b}}=\\var{ans}.\\]
"}, {"name": "Counting: permutation and combination", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}, {"name": "Stephen Maher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/9339/"}], "tags": [], "metadata": {"description": "Introduction to counting with permutations and combinations
", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "How many ways can you choose $r$ distinct objects from $n$ possible objects?
\nThe answer depends upon whether the order of selection is important.
\nThe NUMBAS syntax for $P(n,r)$ and $C(n,r)$ is perm(n,r)
and comb(n,r)
.
For part a, choosing $\\var{r}$ from $\\var{n}$ distinct objects when order matters can be done in $P(\\var{n},\\var{r}) = \\var{perm(n,r)}$ ways.
\nFor part b, choosing $\\var{r2}$ from $\\var{n}$ distinct objects when order does not matter can be done in $C(\\var{n},\\var{r2}) = \\var{comb(n,r2)}$ ways.
", "rulesets": {}, "variables": {"r2": {"name": "r2", "group": "Ungrouped variables", "definition": "r", "description": "", "templateType": "anything"}, "a2": {"name": "a2", "group": "Ungrouped variables", "definition": "random(1..9 except a1)", "description": "", "templateType": "anything"}, "a1": {"name": "a1", "group": "Ungrouped variables", "definition": "random(1..9)", "description": "", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(5..9)", "description": "", "templateType": "anything"}, "a3": {"name": "a3", "group": "Ungrouped variables", "definition": "random(1..9 except [a1,a2])", "description": "", "templateType": "anything"}, "r": {"name": "r", "group": "Ungrouped variables", "definition": "random(2..(n-1))", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a1", "a2", "a3", "n", "r", "r2"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "You have $\\var{n}$ disctinct Discrete Mathematics textbooks, but you can only display $\\var{r}$ in a row on your bookshelf. How many ways can you arrange your Discrete Mathematics textbooks?
", "stepsPenalty": 0, "steps": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "Does the order of books on your bookshelf matter?
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Yes
", "No
"], "matrix": ["0.5", 0], "distractors": ["Good, you have a well-ordered shelf.", "No, go home and arrange your books properly."]}, {"type": "information", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "If order matters, then the answer is $P(\\var{n},\\var{r})$.
\nIf the order does not matter, then the answer is $C(\\var{n},\\var{r})$.
"}], "answer": "{perm(n,r)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "You want to keep your valuable Discrete Mathematics textbooks close at all times. But it's time for class and you only have room for $\\var{r2}$ Discrete Mathematics books in your backpack. How many ways can you pack your backpack?
", "stepsPenalty": 0, "steps": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "Does the order in which you place books into your backpack change which books you take to UNSW?
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Yes
", "No
"], "matrix": [0, "0.5"], "distractors": ["Perhaps you should get a better backpack.", "The order does not matter in this scenario."]}, {"type": "information", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "If order matters, then the answer is $P(\\var{n},\\var{r2})$.
\nIf the order does not matter, then the answer is $C(\\var{n},\\var{r2})$.
"}], "answer": "{comb(n,r2)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": []}], "type": "question"}, {"name": "Number of permutations of a finite set, ", "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": {"ans": {"templateType": "anything", "group": "Ungrouped variables", "definition": "factorial(a)", "description": "", "name": "ans"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..13)", "description": "", "name": "a"}}, "ungrouped_variables": ["a", "ans"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans", "minValue": "ans", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Number of outcomes = ?[[0]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "Suppose $\\var{a}$ people take part in a race. How many different outcomes does the race have, assuming that there are no ties? This includes all $\\var{a}$ positions.
", "tags": ["checked2015", "combinatorics", "MAS1701", "MAS2216", "number of ways of ordering a finite set", "ordering", "permutations", "sc"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/02/2013:
\nFinished first draft. Need a description and perhaps more tags. Included an sc tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "There are $\\var{a}$ choices for who comes first.
\nThere are therefore $\\var{a-1}$ choices for whoever comes second and so on.
\nSo there are $\\var{a}\\times \\var{a-1}\\times \\cdots\\times1=\\var{a}!=\\var{ans}$ ways in which the race can finish.
"}, {"name": "Number of permutations of three groups of items, ", "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": {"b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "name": "b"}, "ans": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(a+b,a)*comb(a+b+c,c)", "description": "", "name": "ans"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "name": "a"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "name": "c"}}, "ungrouped_variables": ["a", "c", "b", "ans"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans", "minValue": "ans", "correctAnswerFraction": false, "marks": 2, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Number of ways = ?[[0]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "Suppose I drink $\\var{a}$ cups of water, $\\var{b}$ cups of tea, and $\\var{c}$ cups of coffee every day. How many ways can I arrange the order in which I drink them?
", "tags": ["checked2015", "combinatorics", "counting", "MAS1701", "MAS2216", "multinomial", "order", "sc", "selection"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/02/2013:
\nFinished first draft. Included sc tag. Need more information for description and for other tags.
", "licence": "Creative Commons Attribution 4.0 International", "description": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "The Multinomial Theorem can be used to count the number of ways.
\nThe total number of possibilities = $\\displaystyle \\frac{\\var{a+b+c}!}{\\var{a}!\\var{b}!\\var{c}!}=\\var{ans}$
"}, {"name": "The probability of an event not happening - five friends play mini golf", "extensions": ["random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "tags": ["complement", "Complement", "complementary", "Probabilities sum to 1", "probability", "Probability"], "metadata": {"description": "Given the probabilities that each of four out of five friends will win a round of mini-golf, work out the probability that the fifth friend won't win, then use that to find the probability that they will win.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Five friends are playing a game of mini-golf.
\nThe probability that each person wins the game, $\\mathrm{P}(\\text{Person})$, is given in the table.
\nPerson | \n{people[0]['name']} | \n{people[1]['name']} | \n{people[2]['name']} | \n{people[3]['name']} | \n{people[4]['name']} | \n
$\\mathrm{P}(\\text{Person})$ | \n$\\var{probs[0]}$ | \n$\\var{probs[1]}$ | \n\n | $\\var{probs[2]}$ | \n$\\var{probs[3]}$ | \n
All probability situations can be reduced to two possible outcomes: success or failure.
\nWhen we express the outcomes in this way we say that they are complementary.
\nThe sum of the probability of an event and its complement is always $1$.
\nIf $\\mathrm{P}(\\mathrm{E})$ is the probability of an event $\\mathrm{E}$ happening and $\\mathrm{P}(\\bar{\\mathrm{E}})$ is the probability of that event not happening then
\n\\[\\mathrm{P}(\\mathrm{E}) +\\mathrm{P}(\\bar{\\mathrm{E}}) = 1.\\]
\nRearranging this equation gives:
\n\\[\\mathrm{P}(\\bar{\\mathrm{E}}) = 1 - \\mathrm{P}(\\mathrm{E})\\]
\nWe can think of this game as having two possible outcomes: either {pname} wins or {pname} doesn't win.
\nThis means that
\n\\[\\mathrm{P}(\\var{pname}) + \\mathrm{P}(\\text{not } \\var{pname}) = 1 \\text{.}\\]
\n\nIf {pname} doesn't win the game then that means that one of the other four players must win the game.
\nSo the probability of {pname} not winning the game is the same as the probability of any of the other four players winning the game.
\nTherefore
\n\\begin{align}
\\mathrm{P}(\\text{not }\\var{pname}) &= \\mathrm{P}(\\var{people[0]['name']})+\\mathrm{P}(\\var{people[1]['name']})+\\mathrm{P}(\\var{people[3]['name']})+\\mathrm{P}(\\var{people[4]['name']}) \\\\
&= \\var{latex(join(probs,' + '))}\\\\
&= \\var{sum(probs)}.
\\end{align}
Rearranging the equation above gives
\n\\[\\mathrm{P}(\\var{pname}) = 1 - \\mathrm{P}(\\text{not } \\var{pname}).\\]
\nWe know from a) that $\\mathrm{P}(\\text{not } \\var{pname}) = \\var{sum(probs)}$.
\nTherefore
\n\\begin{align}
\\mathrm{P}(\\var{pname}) &= 1 - \\mathrm{P}(\\text{not } \\var{pname})\\\\
&= 1 - \\var{sum(probs)}\\\\
&= \\var{1-sum(probs)}.
\\end{align}
The probability of each of the first 4 friends winning the game. The missing person isn't included, so their probability can be 1 minus the sum of the rest, accumulating any rounding errors.
", "templateType": "anything", "can_override": false}, "pname": {"name": "pname", "group": "Ungrouped variables", "definition": "person['name']", "description": "", "templateType": "anything", "can_override": false}, "person": {"name": "person", "group": "Ungrouped variables", "definition": "people[2]", "description": "The person whose probability is not given.
", "templateType": "anything", "can_override": false}, "raw_probs": {"name": "raw_probs", "group": "Ungrouped variables", "definition": "repeat(random(0..1#0),5)", "description": "Uniform random values for each of the five friends. Their winning probabilities will be in proportion to this.
", "templateType": "anything", "can_override": false}, "people": {"name": "people", "group": "Ungrouped variables", "definition": "random_people(5)", "description": "", "templateType": "anything", "can_override": false}, "p_not_name": {"name": "p_not_name", "group": "Ungrouped variables", "definition": "sum(probs)", "description": "The probability that the chosen person does not win.
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["people", "raw_probs", "probs", "person", "pname", "p_not_name"], "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 $\\mathrm{P}(\\text{not } \\var{pname})$?
\n[[0]]
\n", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "P(not {name})", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "p_not_name", "maxValue": "p_not_name", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"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 $\\mathrm{P}(\\var{pname})$?
\n[[0]]
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "P({name})", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "p_not_name", "part": "p0g0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "1-p_not_name", "maxValue": "1-p_not_name", "correctAnswerFraction": false, "allowFractions": false, "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", "type": "question"}, {"name": "Probability of picking a particular colour ball from a bag", "extensions": [], "custom_part_types": [], "resources": [["question-resources/dice.svg", "/srv/numbas/media/question-resources/dice.svg"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "variable_groups": [], "preamble": {"css": "", "js": ""}, "type": "question", "parts": [{"variableReplacementStrategy": "originalfirst", "type": "gapfill", "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}, "gaps": [{"maxMarks": 0, "type": "1_n_2", "showCorrectAnswer": true, "minMarks": 0, "distractors": ["This is the probability of not picking a blue ball.", "Divide by the total number of outcomes, not the number of unfavourable outcomes.", "", "Divide the number of favourable outcomes by the total number of outcomes.", "There's more than one blue ball."], "displayColumns": 0, "displayType": "radiogroup", "scripts": {}, "showFeedbackIcon": true, "marks": 0, "matrix": [0, 0, "1", 0, 0], "choices": ["$\\displaystyle\\frac{\\var{red+green}}{\\var{total}}$
", "$\\displaystyle\\frac{\\var{blue}}{\\var{green+red}}$
", "$\\displaystyle\\frac{\\var{blue}}{\\var{total}}$
", "$\\displaystyle\\frac{1}{\\var{blue}}$
", "$\\displaystyle\\frac{1}{\\var{total}}$
"], "shuffleChoices": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst"}], "marks": 0, "showFeedbackIcon": true, "prompt": "A bag contains $\\var{red}$ red balls, $\\var{blue}$ blue balls and $\\var{green}$ green balls. One ball is removed from the bag at random. What is the probability that the chosen ball will be blue? Remember to reduce any fractions into their simplest form.
\n[[0]]
"}], "advice": "For equally likely outcomes, you can calculate the probability of a particular event occurring by using the formula
\n$\\text{Probability of an event} = \\displaystyle\\frac{\\text{number of favourable outcomes}}{\\text{total number of outcomes}}$.
\n\nWe are told that the bag contains $\\var{red}$ red balls, $\\var{blue}$ blue balls and $\\var{green}$ green balls and that one ball is removed from the bag at random.
\nThe total number of balls in the bag before the chosen ball is removed is
\n\\[\\var{red}+\\var{blue}+\\var{green} = \\var{total}.\\]
\nAs the ball is being removed randomly from the bag, there is an equal probability of selecting any one of the $\\var{total}$ balls.
\nTherefore, the probability of the chosen ball being blue is
\n\\[
P(\\text{blue}) = \\displaystyle\\frac{\\text{number of favourable outcomes}}{\\text{total number of outcomes}} = \\displaystyle\\frac{\\var{blue}}{\\var{total}}
\\]
number of red balls in part c
", "definition": "random(15,19)", "name": "red", "group": "Ungrouped variables"}, "green": {"templateType": "anything", "description": "number of green balls in part c.
", "definition": "random(4,8,10)", "name": "green", "group": "Ungrouped variables"}, "total": {"templateType": "anything", "description": "total number of balls in part c
", "definition": "red+blue+green", "name": "total", "group": "Ungrouped variables"}, "blue": {"templateType": "anything", "description": "number of blue balls in part c
", "definition": "random(6,7,11)", "name": "blue", "group": "Ungrouped variables"}}, "rulesets": {}, "functions": {}, "ungrouped_variables": ["red", "blue", "green", "total"], "statement": "", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "A bag contains balls of three different colours. You're told how many there are of each, and asked the probability of picking a ball of a particular colour.
"}, "variablesTest": {"condition": "", "maxRuns": "100"}}, {"name": "The gambler's fallacy - probability of getting heads again after repeatedly getting heads", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "type": "question", "tags": ["taxonomy"], "advice": "When we flip an unbiased coin there are two possible events that we could measure: the coin lands on heads or the coin lands on tails.
\nEach toss of the coin is independent; if we flip a coin once and it lands on heads then the next time we flip the coin it is still equally likely to land on either heads or tails.
\nIt doesn't matter what the coin landed on previously as this outcome does not affect the outcome of the next flip of the coin.
\nEven when we flip an unbiased coin $\\var{no_flips}$ times and it lands on heads each time; the next time we flip the coin, it is still equally likely to land on either heads or tails.
\nSo the probability that the coin lands on heads the next time that the coin is flipped is still $\\displaystyle\\frac{1}{2}$.
\n", "variables": {"no_flips": {"description": "Number of flips of the coin
", "name": "no_flips", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(6..9)"}}, "statement": "", "variable_groups": [], "parts": [{"correctAnswerFraction": true, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "maxValue": "1/2", "showFeedbackIcon": true, "prompt": "An unbiased coin is flipped $\\var{no_flips}$ times. Given that the coin landed on heads each time, what is the probability of the coin landing on heads the next time it is flipped?
", "correctAnswerStyle": "plain", "allowFractions": true, "mustBeReduced": false, "minValue": "1/2", "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "ungrouped_variables": ["no_flips"], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Previous throws don't affect the probability distribution of subsequent throws. Believing otherwise is the gambler's fallacy.
"}, "preamble": {"css": "", "js": ""}, "functions": {}}, {"name": "What is the probability of two independent events occurring at the same time?", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Shaun Thompson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/9238/"}], "tags": [], "metadata": {"description": "A probability question
", "licence": "None specified"}, "statement": "You roll a die and flip a coin. What is the probability that you get a 3 on the die and tails on the coin?
", "advice": "The answer is 1/12 = 0.08333333
", "rulesets": {}, "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"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, "prompt": "Give your answer as a probability between 0 and 1.
", "minValue": "0.083", "maxValue": "0.084", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"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 "}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "showresultspage": "oncompletion", "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": true, "startpassword": ""}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"showactualmark": false, "showtotalmark": true, "showanswerstate": false, "allowrevealanswer": false, "advicethreshold": 0, "intro": "", "reviewshowscore": true, "reviewshowfeedback": true, "reviewshowexpectedanswer": true, "reviewshowadvice": true, "feedbackmessages": [], "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "oncompletion", "showactualmarkwhen": "oncompletion", "showtotalmarkwhen": "always", "showanswerstatewhen": "oncompletion", "showadvicewhen": "inreview"}, "type": "exam", "contributors": [{"name": "Mark Patterson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5064/"}], "extensions": ["random_person", "stats"], "custom_part_types": [], "resources": [["question-resources/Positive_correlation_TBHAgaf.png", "/srv/numbas/media/question-resources/Positive_correlation_TBHAgaf.png"], ["question-resources/Negative_correlation_0kGEr62.png", "/srv/numbas/media/question-resources/Negative_correlation_0kGEr62.png"], ["question-resources/No_correlation_dgeELhV.png", "/srv/numbas/media/question-resources/No_correlation_dgeELhV.png"], ["question-resources/dice.svg", "/srv/numbas/media/question-resources/dice.svg"]]}