// Numbas version: exam_results_page_options {"name": "Find sample mean, standard deviation, median and interquartile range - small sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"useCustomName": false, "sortAnswers": false, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "marks": 0, "customMarkingAlgorithm": "", "type": "gapfill", "scripts": {}, "customName": "", "prompt": "

Find the following:

\n

Sample Mean =  [[0]]

\n

Sample Standard Deviation =  [[1]]

\n

Sample Standard Error = [[4]]

\n

Median = [[2]] Give the exact value

\n

Interquartile Range = [[3]] Give the exact value

", "unitTests": [], "gaps": [{"variableReplacements": [], "extendBaseMarkingAlgorithm": true, "maxValue": "mn", "marks": "1", "customMarkingAlgorithm": "", "precisionPartialCredit": 0, "correctAnswerStyle": "plain", "minValue": "mn", "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "precisionType": "dp", "useCustomName": false, "mustBeReduced": false, "mustBeReducedPC": 0, "customName": "", "correctAnswerFraction": false, "precision": "2", "type": "numberentry", "variableReplacementStrategy": "originalfirst", "unitTests": [], "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "strictPrecision": false, "showPrecisionHint": true, "allowFractions": false}, {"variableReplacements": [], "extendBaseMarkingAlgorithm": true, "maxValue": "{precround(stdev(r0,true),2)}", "marks": "1", "customMarkingAlgorithm": "", "precisionPartialCredit": 0, "correctAnswerStyle": "plain", "minValue": "{precround(stdev(r0,true),2)}", "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "precisionType": "dp", "useCustomName": false, "mustBeReduced": false, "mustBeReducedPC": 0, "customName": "", "correctAnswerFraction": false, "precision": "2", "type": "numberentry", "variableReplacementStrategy": "originalfirst", "unitTests": [], "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "strictPrecision": false, "showPrecisionHint": true, "allowFractions": false}, {"variableReplacements": [], "extendBaseMarkingAlgorithm": true, "marks": "1", "customMarkingAlgorithm": "", "showFractionHint": true, "scripts": {}, "minValue": "{median}", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "useCustomName": false, "mustBeReduced": false, "mustBeReducedPC": 0, "customName": "", "correctAnswerFraction": false, "type": "numberentry", "maxValue": "{median}", "unitTests": [], "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "correctAnswerStyle": "plain", "allowFractions": false}, {"variableReplacements": [], "extendBaseMarkingAlgorithm": true, "marks": "1", "customMarkingAlgorithm": "", "showFractionHint": true, "scripts": {}, "minValue": "interq-tol", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "useCustomName": false, "mustBeReduced": false, "mustBeReducedPC": 0, "customName": "", "correctAnswerFraction": false, "type": "numberentry", "maxValue": "interq+tol", "unitTests": [], "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "correctAnswerStyle": "plain", "allowFractions": false}, {"variableReplacements": [], "extendBaseMarkingAlgorithm": true, "maxValue": "stderr", "marks": 1, "customMarkingAlgorithm": "", "precisionPartialCredit": 0, "correctAnswerStyle": "plain", "minValue": "stderr", "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "precisionType": "dp", "useCustomName": false, "mustBeReduced": false, "mustBeReducedPC": 0, "customName": "", "correctAnswerFraction": false, "precision": "2", "type": "numberentry", "variableReplacementStrategy": "originalfirst", "unitTests": [], "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "strictPrecision": false, "showPrecisionHint": true, "allowFractions": false}], "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true}], "variablesTest": {"condition": "", "maxRuns": 100}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "extensions": ["stats"], "name": "Find sample mean, standard deviation, median and interquartile range - small sample", "variable_groups": [], "advice": "

Sample mean: 

\n

Let the data be donated $x$, then the sample mean $\\bar{x}$ is 

\n

\\begin{align}
\\bar{x} &= \\frac{\\var{r0[0]}+\\var{r0[1]}+\\var{r0[2]}+\\var{r0[3]}+\\var{r0[4]}+\\var{r0[5]}}{\\var{length(r0)}} \\\\
&= \\frac{\\var{sum(r0)}}{\\var{length(r0)}} \\\\
&= \\var{mn}\\text{,}
\\end{align}

\n

to 2 decimal places.

\n

\n

Sample standard deviation and standard error:

\n

The sample standard deviation, $s$, is given by

\n

\\begin{align}
s &= \\sqrt{\\frac{\\sum{(x-\\bar{x})^2}}{n-1}} \\\\
&= \\sqrt{\\frac{(\\var{r0[0]}-\\var{mn})^2+(\\var{r0[1]}-\\var{mn})^2+(\\var{r0[2]}-\\var{mn})^2+(\\var{r0[3]}-\\var{mn})^2+(\\var{r0[4]}-\\var{mn})^2+(\\var{r0[5]}-\\var{mn})^2}{\\var{length(r0)-1}}} \\\\
&= \\sqrt{\\frac{\\var{(r0[0]-mn)^2}+\\var{(r0[1]-mn)^2}+\\var{(r0[2]-mn)^2}+\\var{(r0[3]-mn)^2}+\\var{(r0[4]-mn)^2}+\\var{(r0[5]-mn)^2}}{\\var{length(r0)-1}}} \\\\
&= \\sqrt{\\frac{\\var{variance(r0,true)*mn}}{\\var{length(r0)-1}}} \\\\
&= \\sqrt{\\var{variance(r0,true)}} \\\\
&= \\var{dpformat(stdev(r0,true),2)}\\text{.}
\\end{align}

\n

The sample standard error is the sample standard deviation divided by the square root of the sample size.

\n

$\\text{Sample standard error} = \\displaystyle{\\frac{\\var{stdev}}{\\sqrt{\\var{n}}} =\\var{dpformat(stderr,2)}}$.

\n

Median and Interquartile range:

\n

If you order the data in increasing order you get the following table:

\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$
\n

Denote the ordered data by $x_j$, thus $x_{3}=\\var{r1[2]}$ for example.

\n

The median lies between the 2nd and 3rd entries in the ordered table and is given by:

\n

\\[0.5\\times x_{3}+0.5\\times x_{4} = 0.5\\times\\var{r1[2]}+0.5\\times \\var{r1[3]}=\\var{median}\\]

\n

The lower quartile is given by $x_2 = \\var{r1[1]}$

\n

The upper quartile is given by $x_5 = \\var{r1[4]}$

\n

The interquartile range is defined to be

\n

\\[ \\text{Upper Quartile} – \\text{Lower Quartile} \\]

\n

and so in this case we have:

\n

\\[ \\text{Interquartile range} = \\var{uquartile}-\\var{lquartile}=\\var{interq} \\]

", "functions": {}, "variables": {"u": {"description": "", "name": "u", "group": "Ungrouped variables", "definition": "random(20..60)", "templateType": "anything"}, "var": {"description": "", "name": "var", "group": "Ungrouped variables", "definition": "variance(r0,true)", "templateType": "anything"}, "stderr": {"description": "", "name": "stderr", "group": "Ungrouped variables", "definition": "stdev/sqrt(n)", "templateType": "anything"}, "r1": {"description": "", "name": "r1", "group": "Ungrouped variables", "definition": "sort(r0)", "templateType": "anything"}, "lquartile": {"description": "", "name": "lquartile", "group": "Ungrouped variables", "definition": "0.25*r1[0]+0.75*r1[1]", "templateType": "anything"}, "things": {"description": "", "name": "things", "group": "Ungrouped variables", "definition": "' bottled sports drinks.'", "templateType": "anything"}, "description": {"description": "", "name": "description", "group": "Ungrouped variables", "definition": "' bottled sports drinks.'", "templateType": "anything"}, "uquartile": {"description": "", "name": "uquartile", "group": "Ungrouped variables", "definition": "0.75*r1[4]+0.25*r1[5]", "templateType": "anything"}, "r0": {"description": "", "name": "r0", "group": "Ungrouped variables", "definition": "repeat(random(l..30),n)", "templateType": "anything"}, "interq": {"description": "", "name": "interq", "group": "Ungrouped variables", "definition": "uquartile-lquartile", "templateType": "anything"}, "tol": {"description": "", "name": "tol", "group": "Ungrouped variables", "definition": "abs(interq-(quartiles(r1)[2]-quartiles(r1)[0]))", "templateType": "anything"}, "whatever": {"description": "", "name": "whatever", "group": "Ungrouped variables", "definition": "'weight of carbohydrate'", "templateType": "anything"}, "mn": {"description": "", "name": "mn", "group": "Ungrouped variables", "definition": "precround(mean(r0),2)", "templateType": "anything"}, "stdev": {"description": "", "name": "stdev", "group": "Ungrouped variables", "definition": "precround(stdev(r0,true),2)", "templateType": "anything"}, "l": {"description": "", "name": "l", "group": "Ungrouped variables", "definition": "random(10..19)", "templateType": "anything"}, "median": {"description": "", "name": "median", "group": "Ungrouped variables", "definition": "0.5*(r1[2]+r1[3])", "templateType": "anything"}, "units": {"description": "", "name": "units", "group": "Ungrouped variables", "definition": "'grams'", "templateType": "anything"}, "n": {"description": "", "name": "n", "group": "Ungrouped variables", "definition": "6", "templateType": "anything"}}, "tags": [], "statement": "

The following data are the weight (in grams) of carbohydrate in $\\var{n}$ sports drinks:

\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{r0[0]}$$\\var{r0[1]}$$\\var{r0[2]}$$\\var{r0[3]}$$\\var{r0[4]}$$\\var{r0[5]}$
", "preamble": {"js": "", "css": ""}, "ungrouped_variables": ["uquartile", "r0", "description", "things", "median", "interq", "whatever", "l", "var", "lquartile", "u", "mn", "stdev", "units", "n", "r1", "stderr", "tol"], "metadata": {"description": "

Sample of size $24$ is given in a table. Find sample mean, sample standard deviation, sample median and the interquartile range.

", "licence": "Creative Commons Attribution 4.0 International"}, "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/"}]}]}], "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/"}]}