// Numbas version: exam_results_page_options
{"name": "Mean, SD, median and IQR", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "
Find the mean, SD, median and IQR for the following sample of $\\var{n}$ data values:
\n\n\n\n{r0[0]} | \n{r0[1]} | \n{r0[2]} | \n{r0[3]} | \n{r0[4]} | \n{r0[5]} | \n{r0[6]} | \n{r0[7]} | \n{r0[8]} | \n{r0[9]} | \n{r0[10]} | \n{r0[11]} | \n
\n\n{r0[12]} | \n{r0[13]} | \n{r0[14]} | \n{r0[15]} | \n{r0[16]} | \n{r0[17]} | \n{r0[18]} | \n{r0[19]} | \n{r0[20]} | \n{r0[21]} | \n{r0[22]} | \n{r0[23]} | \n
\n\n
\n", "name": "Mean, SD, median and IQR", "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\n\n\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
\n\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
\n\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
\n\n
\nDenote 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} \\]
", "ungrouped_variables": ["uquartile", "r0", "description", "things", "median", "interq", "whatever", "l", "var", "lquartile", "u", "mean", "stdev", "units", "n", "r1"], "extensions": ["stats"], "variable_groups": [], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Find mean, SD, median and IQR for a sample.
"}, "variablesTest": {"maxRuns": 100, "condition": ""}, "tags": [], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"variableReplacementStrategy": "originalfirst", "prompt": "\n\n\nMean (1 dp) | \nSD (3 sf) | \nMedian (exact value) | \nIQR (exact value) | \n
\n\n[[0]] | \n[[1]] | \n[[2]] | \n[[3]] | \n
\n\n
", "variableReplacements": [], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "sortAnswers": false, "scripts": {}, "customName": "", "showFeedbackIcon": true, "useCustomName": false, "gaps": [{"variableReplacementStrategy": "originalfirst", "showFractionHint": true, "variableReplacements": [], "correctAnswerFraction": false, "mustBeReducedPC": 0, "marks": 0.5, "type": "numberentry", "correctAnswerStyle": "plain", "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "minValue": "{precround(mean(r0),1)}", "customName": "", "showFeedbackIcon": true, "mustBeReduced": false, "useCustomName": false, "notationStyles": ["plain", "en", "si-en"], "extendBaseMarkingAlgorithm": true, "maxValue": "{precround(mean(r0),1)}", "unitTests": [], "customMarkingAlgorithm": ""}, {"variableReplacementStrategy": "originalfirst", "showFractionHint": true, "variableReplacements": [], "correctAnswerFraction": false, "mustBeReducedPC": 0, "marks": 0.5, "type": "numberentry", "correctAnswerStyle": "plain", "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "minValue": "{siground(stdev(r0,true),3)}", "customName": "", "showFeedbackIcon": true, "mustBeReduced": false, "useCustomName": false, "notationStyles": ["plain", "en", "si-en"], "extendBaseMarkingAlgorithm": true, "maxValue": "{siground(stdev(r0,true),3)}", "unitTests": [], "customMarkingAlgorithm": ""}, {"variableReplacementStrategy": "originalfirst", "showFractionHint": true, "variableReplacements": [], "correctAnswerFraction": false, "mustBeReducedPC": 0, "marks": 0.5, "type": "numberentry", "correctAnswerStyle": "plain", "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "minValue": "{median}", "customName": "", "showFeedbackIcon": true, "mustBeReduced": false, "useCustomName": false, "notationStyles": ["plain", "en", "si-en"], "extendBaseMarkingAlgorithm": true, "maxValue": "{median}", "unitTests": [], "customMarkingAlgorithm": ""}, {"variableReplacementStrategy": "originalfirst", "showFractionHint": true, "variableReplacements": [], "correctAnswerFraction": false, "mustBeReducedPC": 0, "marks": 0.5, "type": "numberentry", "correctAnswerStyle": "plain", "showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "minValue": "{interq}", "customName": "", "showFeedbackIcon": true, "mustBeReduced": false, "useCustomName": false, "notationStyles": ["plain", "en", "si-en"], "extendBaseMarkingAlgorithm": true, "maxValue": "{interq}", "unitTests": [], "customMarkingAlgorithm": ""}], "extendBaseMarkingAlgorithm": true, "unitTests": [], "customMarkingAlgorithm": ""}], "variables": {"things": {"definition": "'tomatoes '", "group": "Ungrouped variables", "templateType": "anything", "name": "things", "description": ""}, "interq": {"definition": "uquartile-lquartile", "group": "Ungrouped variables", "templateType": "anything", "name": "interq", "description": ""}, "l": {"definition": "random(10..19)", "group": "Ungrouped variables", "templateType": "anything", "name": "l", "description": ""}, "lquartile": {"definition": "0.75*r1[5]+0.25*r1[6]", "group": "Ungrouped variables", "templateType": "anything", "name": "lquartile", "description": ""}, "units": {"definition": "'grams'", "group": "Ungrouped variables", "templateType": "anything", "name": "units", "description": ""}, "r1": {"definition": "sort(r0)", "group": "Ungrouped variables", "templateType": "anything", "name": "r1", "description": ""}, "description": {"definition": "' from a new kind of tomato plant.'", "group": "Ungrouped variables", "templateType": "anything", "name": "description", "description": ""}, "uquartile": {"definition": "0.25*r1[17]+0.75*r1[18]", "group": "Ungrouped variables", "templateType": "anything", "name": "uquartile", "description": ""}, "n": {"definition": "24", "group": "Ungrouped variables", "templateType": "anything", "name": "n", "description": ""}, "mean": {"definition": "mean(r0)", "group": "Ungrouped variables", "templateType": "anything", "name": "mean", "description": ""}, "median": {"definition": "0.5*(r1[11]+r1[12])", "group": "Ungrouped variables", "templateType": "anything", "name": "median", "description": ""}, "r0": {"definition": "repeat(random(l..u),24)", "group": "Ungrouped variables", "templateType": "anything", "name": "r0", "description": ""}, "whatever": {"definition": "'weights'", "group": "Ungrouped variables", "templateType": "anything", "name": "whatever", "description": ""}, "u": {"definition": "random(20..60)", "group": "Ungrouped variables", "templateType": "anything", "name": "u", "description": ""}, "stdev": {"definition": "precround(stdev(r0,true),2)", "group": "Ungrouped variables", "templateType": "anything", "name": "stdev", "description": ""}, "var": {"definition": "variance(r0,true)", "group": "Ungrouped variables", "templateType": "anything", "name": "var", "description": ""}}, "preamble": {"css": "", "js": ""}, "functions": {}, "contributors": [{"name": "Mario Orsi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/427/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Mario Orsi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/427/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}