// Numbas version: finer_feedback_settings {"name": "Find quartiles, range and interquartile range of small sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"sig": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(4..9)", "description": "", "name": "sig"}, "r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sort(r0)", "description": "", "name": "r1"}, "median": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.5*(r1[15]+r1[16])", "description": "", "name": "median"}, "var": {"templateType": "anything", "group": "Ungrouped variables", "definition": "variance(r0,true)", "description": "", "name": "var"}, "guess2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(guess1/4)", "description": "", "name": "guess2"}, "mean": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mean(r0)", "description": "", "name": "mean"}, "sd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "stdev(r0,true)", "description": "", "name": "sd"}, "mu": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(30..50)", "description": "", "name": "mu"}, "uquartile": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.25*r1[23]+0.75*r1[24]", "description": "", "name": "uquartile"}, "guess4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(7*guess1/4)", "description": "", "name": "guess4"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "32", "description": "", "name": "n"}, "guess1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((r1[31]-r1[0])/4)", "description": "", "name": "guess1"}, "lquartile": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.75*r1[7]+0.25*r1[8]", "description": "", "name": "lquartile"}, "guess3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(guess1/2)", "description": "", "name": "guess3"}, "range": {"templateType": "anything", "group": "Ungrouped variables", "definition": "r1[31]-r1[0]", "description": "", "name": "range"}, "r0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(mu,sig)),32)", "description": "", "name": "r0"}, "stdev": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(stdev(r0,true),2)", "description": "", "name": "stdev"}}, "ungrouped_variables": ["guess3", "guess2", "guess1", "r0", "r1", "guess4", "mean", "median", "n", "mu", "lquartile", "sig", "stdev", "var", "uquartile", "sd", "range"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Find quartiles, range and interquartile range of small sample", "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{r1[0]}", "minValue": "{r1[0]}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{lquartile}", "minValue": "{lquartile}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{median}", "minValue": "{median}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{uquartile}", "minValue": "{uquartile}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{r1[31]}", "minValue": "{r1[31]}", "correctAnswerFraction": false, "marks": 0.4, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n \n \n

Obtain the $5$ number summary MQMQM and input their values below as exact decimals:

\n \n \n \n \n \n \n \n \n \n
MinimumLower QuartileMedianUpper QuartileMaximum
[[0]][[1]][[2]][[3]][[4]]
\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "range", "minValue": "range", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Find the range as an exact decimal.

\n

Range=[[0]]

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{uquartile-lquartile}", "minValue": "{uquartile-lquartile}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n \n \n

Enter the interquartile range: [[0]]

\n \n \n \n

Input as an exact decimal.

\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"displayType": "radiogroup", "choices": ["

{guess1}

", "

{guess2}

", "

{guess3}

", "

{guess4}

"], "displayColumns": 4, "distractors": ["", "", "", ""], "shuffleChoices": true, "scripts": {}, "minMarks": 0, "type": "1_n_2", "maxMarks": 0, "showCorrectAnswer": true, "matrix": [1, 0, 0, 0], "marks": 0}], "type": "gapfill", "prompt": "

Without doing any further calculations, which of the following numbers do you think is likely to be closest to the sample standard deviation?
[[0]]

", "showCorrectAnswer": true, "marks": 0}], "statement": "\n \n \n

Given the following table of data, answer all the following questions:

\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]}$$\\var{r0[24]}$$\\var{r0[25]}$$\\var{r0[26]}$$\\var{r0[27]}$$\\var{r0[28]}$$\\var{r0[29]}$$\\var{r0[30]}$$\\var{r0[31]}$
\n \n \n ", "tags": ["average", "checked2015", "cr1", "data analysis", "interquartile range", "lower quartile", "MAS8380", "maximum", "mean", "mean ", "median", "minumum", "MQMQM", "ordered data", "quartile", "query", "sample standard deviation", "standard deviation", "tested1", "upper quartile"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

11/07/2012:

\n

Added tags.

\n

Calculations not tested yet.

\n

23/07/2012:

\n

Added description.

\n

Checked calculations as stats extension now available. OK.

\n

3/08/2012:

\n

Added tags.

\n

Question appears to be working correctly.

\n

19/12/2012:

\n

Changed to new stats functions and replaced the uniform sample data by a normal sample. 

\n

Checked calculations. Note that the quartiles are defined differently from the stats extension definition - so used the Newcastle definition! Added query tag so that can be decided upon.

\n

Added tested1 tag.

\n

21/12/2012:

\n

Rounding OK, added tag cr1.

\n

 

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given 32 datapoints in a table find their minimum, lower quartile, median, upper quartile, and maximum.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

a)

\n

If you sort 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\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]}$$\\var{r1[24]}$$\\var{r1[25]}$$\\var{r1[26]}$$\\var{r1[27]}$$\\var{r1[28]}$$\\var{r1[29]}$$\\var{r1[30]}$$\\var{r1[31]}$
\n

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

\n

Minimum value: The minimum value is $x_1=\\var{r1[0]}$.

\n

Lower Quartile: 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}=8\\frac{1}{4}\\]

\n

Hence the Lower Quartile lies between the 8th and 9th entries in the ordered table, so it is:

\n

\\[0.75\\times x_8+0.25\\times x_9 = 0.75\\times\\var{r1[7]}+0.25\\times \\var{r1[8]}=\\var{lquartile}\\]

\n

Median: The position of the median in the table is given by

\n

\\[ \\frac{2(n+1)}{4} = \\frac{\\var{2*(n+1)}}{4} = 16 \\frac{1}{2}\\]

\n

The median lies between the 16th and 17th entries in the ordered table and is given by:

\n

\\[0.5\\times x_{16}+0.5\\times x_{17} = 0.5\\times\\var{r1[15]}+0.5\\times \\var{r1[16]}=\\var{median}\\]

\n

Upper Quartile: As there is an even number of values, the Upper Quartile will lie between two values. Its position is calculated by finding

\n

\\[\\frac{3(n+1)}{4}=\\frac{\\var{3*(n+1)}}{4}=24\\frac{3}{4}\\]

\n

Hence the Upper Quartile lies between the 24th and 25th entries in the ordered table.

\n

We find it is \\[0.25\\times x_{24}+0.75\\times x_{25} = 0.25\\times\\var{r1[23]}+0.75\\times \\var{r1[24]}=\\var{uquartile}\\]

\n

Maximum value: The maximum value is $x_{32}=\\var{r1[31]}$

\n

b)

\n

The range is defined to be

Range = Maximum – Minimum

and so in this case we have:

Range = $\\var{r1[31]}-\\var{r1[0]}=\\var{range}$.

\n

c)

\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{uquartile-lquartile} \\]

\n

d)

\n

Most of the data should be spanned by $4s$ where $s$ is the sample standard deviation.

\n

The range of values is $\\var{r1[31]}-\\var{r1[0]}=\\var{r1[31]-r1[0]}$ and so $s$ should be approximately

\n

\\[ \\simplify[std]{({r1[31]}-{r1[0]}) / 4 = {(r1[31] -r1[0]) / 4}} \\]

\n

The most likely value for the sample standard deviation of the options presented is $\\var{guess1}$.

\n

(The actual value is $\\var{stdev}$ to 2 decimal places).

", "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/"}]}