// Numbas version: finer_feedback_settings {"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}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"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}], "name": "Find sample mean, standard deviation, median and interquartile range, , ", "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": "\n\n\n\n\n
Sample Mean (1 dp)Sample Standard Deviation (3 sig figs)Median (exact value)Interquartile Range (exact value)
[[0]][[1]][[2]][[3]]
", "showCorrectAnswer": true, "marks": 0}], "statement": "

The following data are the {whatever}, in {units}, of $\\var{n}$ {things} {description}

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \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]}$$\\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]}$
", "tags": ["checked2015", "cr1", "data analysis", "elementary statistics", "interquartile range", "IQR", "lower quartile", "LQ", "MAS1604", "MAS8380", "MAS8401", "mean", "mean ", "median", "quartile", "sample mean", "sample standard deviation", "sc", "statistics", "tested1", "upper quartile", "UQ"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

11/07/2012:

\n


Added tags.

\n

Calculation not yet checked.

\n

23/07/2012:

\n

Added description.

\n

Checked calculation, OK.

\n

Two minor typos changed.

\n

3/08/2012:

\n

Added tags.

\n

Question appears to be working correctly.

\n

19/12/2012:

\n

Changed to new stats extension functions for variance and stdev. Still using the uniform distribution. Checked calculations again.

\n

Added tested1 tag.

\n

21/12/2012:

\n

Checked rounding, OK. Added cr1 tag. 

\n

Scenarios 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.

\n

Sample standard deviation: The sample standard deviation is $\\var{stdev(r0,true)}=\\var{siground(stdev(r0,true),3)}$ to 3 significant figures.

\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\n\n\n\n\n\n\n\n\n\n\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]}$$\\var{r1[6]}$$\\var{r1[7]}$
$\\var{r1[8]}$$\\var{r1[9]}$$\\var{r1[10]}$$\\var{r1[11]}$$\\var{r1[12]}$$\\var{r1[13]}$$\\var{r1[14]}$$\\var{r1[15]}$
$\\var{r1[16]}$$\\var{r1[17]}$$\\var{r1[18]}$$\\var{r1[19]}$$\\var{r1[20]}$$\\var{r1[21]}$$\\var{r1[22]}$$\\var{r1[23]}$
\n

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

\n

Median: 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}\\]

\n

Interquartile 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}\\]

\n

Hence the Lower Quartile lies between the 6th and 7th entries in the ordered table.

\n

It 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}\\]

\n

Once 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}\\]

\n

Hence the Upper Quartile lies between the 18th and 19th entries in the ordered table.

\n

We 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}\\]

\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} \\]

", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}