// Numbas version: exam_results_page_options {"name": "Harry's copy of Find sample mean, standard deviation, median and interquartile range, , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"IQR": {"templateType": "anything", "description": "", "definition": "0.5*(r1[11]+r1[12])-0.5*(r1[3]+r1[4])", "group": "Ungrouped variables", "name": "IQR"}, "median": {"templateType": "anything", "description": "", "definition": "0.5*(r1[7]+r1[8])", "group": "Ungrouped variables", "name": "median"}, "mean": {"templateType": "anything", "description": "", "definition": "precround(mean(r0),2)", "group": "Ungrouped variables", "name": "mean"}, "r0": {"templateType": "anything", "description": "", "definition": "repeat(random(23..36),16)", "group": "Ungrouped variables", "name": "r0"}, "r1": {"templateType": "anything", "description": "", "definition": "sort(r0)", "group": "Ungrouped variables", "name": "r1"}, "upper_quartile": {"templateType": "anything", "description": "", "definition": "0.5*(r1[11]+r1[12])", "group": "Ungrouped variables", "name": "upper_quartile"}, "lower_quartile": {"templateType": "anything", "description": "", "definition": "0.5*(r1[3]+r1[4])", "group": "Ungrouped variables", "name": "lower_quartile"}, "standard_deviation": {"templateType": "anything", "description": "", "definition": "precround(stdev(r0,true),2)", "group": "Ungrouped variables", "name": "standard_deviation"}}, "parts": [{"variableReplacements": [], "gaps": [{"variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "maxValue": "{mean}", "notationStyles": ["plain", "en", "si-en"], "scripts": {}, "mustBeReduced": false, "variableReplacements": [], "minValue": "{mean}", "showCorrectAnswer": true, "correctAnswerFraction": false, "correctAnswerStyle": "plain", "type": "numberentry", "allowFractions": false, "marks": "1"}, {"variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "maxValue": "{standard_deviation}", "notationStyles": ["plain", "en", "si-en"], "scripts": {}, "mustBeReduced": false, "variableReplacements": [], "minValue": "{standard_deviation}", "showCorrectAnswer": true, "correctAnswerFraction": false, "correctAnswerStyle": "plain", "type": "numberentry", "allowFractions": false, "marks": "1"}, {"variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "maxValue": "{median}", "notationStyles": ["plain", "en", "si-en"], "scripts": {}, "mustBeReduced": false, "variableReplacements": [], "minValue": "{median}", "showCorrectAnswer": true, "correctAnswerFraction": false, "correctAnswerStyle": "plain", "type": "numberentry", "allowFractions": false, "marks": "1"}, {"variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "maxValue": "{IQR}", "notationStyles": ["plain", "en", "si-en"], "scripts": {}, "mustBeReduced": false, "variableReplacements": [], "minValue": "{IQR}", "showCorrectAnswer": true, "correctAnswerFraction": false, "correctAnswerStyle": "plain", "type": "numberentry", "allowFractions": false, "marks": "1"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "prompt": "
Sample Mean (2 dp) | \nSample Standard Deviation (2 dp) | \nMedian (exact value) | \nInterquartile Range (exact value) | \n
---|---|---|---|
[[0]] | \n[[1]] | \n[[2]] | \n[[3]] | \n
Sample of size $24$ is given in a table. Find sample mean, sample standard deviation, sample median and the interquartile range.
"}, "ungrouped_variables": ["r0", "median", "mean", "standard_deviation", "r1", "IQR", "lower_quartile", "upper_quartile"], "tags": [], "name": "Harry's copy of Find sample mean, standard deviation, median and interquartile range, , ", "variable_groups": [], "preamble": {"css": "", "js": ""}, "statement": "\n$\\var{r0[0]}$\n | \n\n$\\var{r0[1]}$\n | \n\n$\\var{r0[2]}$\n | \n\n$\\var{r0[3]}$\n | \n\n$\\var{r0[4]}$\n | \n\n$\\var{r0[5]}$\n | \n\n$\\var{r0[6]}$\n | \n\n$\\var{r0[7]}$\n | \n
\n$\\var{r0[8]}$\n | \n\n$\\var{r0[9]}$\n | \n\n$\\var{r0[10]}$\n | \n\n$\\var{r0[11]}$\n | \n\n$\\var{r0[12]}$\n | \n\n$\\var{r0[13]}$\n | \n\n$\\var{r0[14]}$\n | \n\n$\\var{r0[15]}$\n | \n
Sample mean
\nThe sample mean is $\\frac{\\var{sum(r0)}}{\\var{len(r0)}} = \\var{mean} $, to 2 decimal places.
\n\n
Sample standard deviation
\nThe formula required may be written as
\n\\[s = \\sqrt{\\frac{ \\Sigma(x-\\bar{x})^2}{n-1}}\\]
\n\\text{where }\\bar{x}\\text{ is the sample mean and n is the number of items in the data set (16 in this example). }
\nThis is very time consuming for all but the simplest of questions so you should use your calculator, in statistics mode, to find this.
\n\n\n
If you rearrange the data in ascending 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
Denote the ordered data by $x_j$, thus $x_{10}=\\var{r1[9]}$ for example.
\nMedian: The median is the middle of the data once it has been ordered, it therefore lies between the 8th and 9th entries in the ordered table and is given by:
\n\\[ \\frac{x_{8}+ x_{9}}{2} = \\frac{\\var{r1[7]}+ \\var{r1[8]}}{2}=\\var{median}\\]
\nInterquartile range: There is not one definitive method for finding the the interquartile range (IQR). We will use the following: as there is an even number of values, the Lower Quartile will be the 'median' of the first 8 values. Its position is calculated by finding
\n\\[\\frac{n+1}{2}=\\frac{\\var{8+1}}{2}=4\\frac{1}{2}\\]
\nHence the Lower Quartile lies between the 4th and 5th entries in the ordered table.
\nIt is \\[x_4 + \\frac{1}{2}(x_5 - x_4) = \\var{r1[3]}+ \\frac{1}{2}(\\var{r1[4]} - \\var{r1[3]})=\\var{lower_quartile}\\]
\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\\[x_{12} + \\frac{1}{2}(x_{13} - x_{12}) = \\var{r1[11]}+ \\frac{1}{2}(\\var{r1[12]} - \\var{r1[11]})=\\var{upper_quartile}\\]
\n\nThe interquartile range (IQR) is defined to be
\n\\[ \\text{Upper Quartile} – \\text{Lower Quartile} \\]
\nand so in this case we have:
\n\\[ \\text{Interquartile range} = \\var{upper_quartile}-\\var{lower_quartile}=\\var{iqr} \\]
", "extensions": ["stats"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "type": "question", "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}]}]}], "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}]}