// Numbas version: exam_results_page_options {"name": "Measures of central tendency from a list", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "

The average number of tackles per game was measured during the last Rugby Union World Cup.

\n

Here is a random sample from 20 forwards:

\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{x[0]}$ $\\var{x[1]}$ $\\var{x[2]}$ $\\var{x[3]}$ $\\var{x[4]}$ $\\var{x[5]}$ $\\var{x[6]}$ $\\var{x[7]}$ $\\var{x[8]}$ $\\var{x[9]}$ $\\var{x[10]}$ $\\var{x[11]}$ $\\var{x[12]}$ $\\var{x[13]}$ $\\var{x[14]}$ $\\var{x[15]}$ $\\var{x[16]}$ $\\var{x[17]}$ $\\var{x[18]}$ $\\var{x[19]}$
\n

", "name": "Measures of central tendency from a list", "preamble": {"js": "", "css": ""}, "rulesets": {}, "contributors": [{"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/", "name": "Christian Lawson-Perfect"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/", "name": "Chris Graham"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/", "name": "Vicky Hall"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/", "name": "Stanislav Duris"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2490/", "name": "Lauren Frances Desoysa"}], "tags": [], "variables": {"range": {"description": "", "name": "range", "group": "final list", "templateType": "anything", "definition": "max(a) - min(a)"}, "mu": {"description": "", "name": "mu", "group": "Ungrouped variables", "templateType": "anything", "definition": "23"}, "rangex": {"description": "", "name": "rangex", "group": "Ungrouped variables", "templateType": "anything", "definition": "range(x)"}, "mean": {"description": "", "name": "mean", "group": "final list", "templateType": "anything", "definition": "mean(a)"}, "as": {"description": "

Sorted list.

", "name": "as", "group": "final list", "templateType": "anything", "definition": "sort(a)"}, "mode": {"description": "

Mode as a vector.

", "name": "mode", "group": "final list", "templateType": "anything", "definition": "mode(a)"}, "median": {"description": "", "name": "median", "group": "final list", "templateType": "anything", "definition": "median(a)"}, "modex": {"description": "", "name": "modex", "group": "Ungrouped variables", "templateType": "anything", "definition": "mode(x)"}, "a2": {"description": "

Option 2 for the list. Only used if there is only one mode and option 1 was not used.

", "name": "a2", "group": "Ungrouped variables", "templateType": "anything", "definition": "repeat(random(0..8), 20)"}, "mode1": {"description": "

Mode as a value.

", "name": "mode1", "group": "final list", "templateType": "anything", "definition": "mode[0]"}, "sigm": {"description": "", "name": "sigm", "group": "Ungrouped variables", "templateType": "anything", "definition": "5"}, "modea2": {"description": "", "name": "modea2", "group": "Ungrouped variables", "templateType": "anything", "definition": "mode(a2)"}, "modea1": {"description": "", "name": "modea1", "group": "Ungrouped variables", "templateType": "anything", "definition": "mode(a1)"}, "meanx": {"description": "", "name": "meanx", "group": "Ungrouped variables", "templateType": "anything", "definition": "mean(x)"}, "modetimes": {"description": "

The vector of number of times of each value in the data.

", "name": "modetimes", "group": "final list", "templateType": "anything", "definition": "map(\nlen(filter(x=j,x,a)),\nj, 0..8)"}, "x": {"description": "", "name": "x", "group": "Ungrouped variables", "templateType": "anything", "definition": "repeat(precround(normalsample(mu,sigm),0),20)"}, "a1": {"description": "

Option 1 for the list. Only used if there is only one mode.

", "name": "a1", "group": "Ungrouped variables", "templateType": "anything", "definition": "repeat(random(0..8), 20)"}, "s": {"description": "", "name": "s", "group": "Ungrouped variables", "templateType": "anything", "definition": "sort(x)"}, "a": {"description": "

The final list.

", "name": "a", "group": "final list", "templateType": "anything", "definition": "if(len(modea1) = 1, a1, if(len(modea2) = 1, a2, a3))"}, "medianx": {"description": "", "name": "medianx", "group": "Ungrouped variables", "templateType": "anything", "definition": "median(x)"}, "a3": {"description": "

Option 3 for the list. Ensures there is only one mode (2) while still randomising the data.

", "name": "a3", "group": "Ungrouped variables", "templateType": "anything", "definition": "shuffle([ random(0..1),\n 2, \n random(4..6),\n random(0..3 except 2), \n random(0..3 except 2),\n random(4..6),\n 2,\n 2,\n random(4..6),\n random(7..8),\n random(0..3 except 2 except 1), \n random(4..6),\n 2,\n random(1..3 except 2), \n random(7..8),\n 2,\n random(7..8),\n random(4..6), \n random(0..3 except 2), \n 2\n])"}}, "functions": {}, "variable_groups": [{"name": "final list", "variables": ["a", "as", "mean", "median", "mode", "mode1", "range", "modetimes"]}], "variablesTest": {"maxRuns": 100, "condition": ""}, "type": "question", "parts": [{"notationStyles": ["plain", "en", "si-en"], "strictPrecision": false, "mustBeReducedPC": 0, "variableReplacements": [], "allowFractions": false, "showFeedbackIcon": true, "correctAnswerFraction": false, "precisionType": "dp", "customMarkingAlgorithm": "", "maxValue": "meanx", "mustBeReduced": false, "scripts": {}, "prompt": "

Find the mean number of tackles.

", "precisionPartialCredit": 0, "showCorrectAnswer": true, "minValue": "meanx", "precision": "2", "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showPrecisionHint": true, "unitTests": [], "marks": 1, "extendBaseMarkingAlgorithm": true, "precisionMessage": "You have not given your answer to the correct precision.", "type": "numberentry"}, {"showCorrectAnswer": true, "minValue": "medianx", "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "prompt": "

Find the median number of tackles.

", "correctAnswerFraction": false, "mustBeReducedPC": 0, "marks": 1, "maxValue": "medianx", "customMarkingAlgorithm": "", "scripts": {}, "type": "numberentry", "variableReplacements": []}, {"showCorrectAnswer": true, "minValue": "modex[0]", "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "prompt": "

Find the mode number of tackles. If there is more than one modal value, enter the smallest modal value.

", "correctAnswerFraction": false, "mustBeReducedPC": 0, "marks": 1, "maxValue": "modex[0]", "customMarkingAlgorithm": "", "scripts": {}, "type": "numberentry", "variableReplacements": []}, {"showCorrectAnswer": true, "minValue": "rangex", "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "prompt": "

Find the range of the number of tackles.

", "correctAnswerFraction": false, "mustBeReducedPC": 0, "marks": 1, "maxValue": "rangex", "customMarkingAlgorithm": "", "scripts": {}, "type": "numberentry", "variableReplacements": []}], "metadata": {"description": "

This question provides a list of data to the student. They are asked to find the mean, median, mode and range.

a)

\n

The mean is the sum of all the responses ($\\sum x$) divided by the number of responses ($n$).

\n

Here, $n = 20$.

\n

\\begin{align}
\\sum x &= \\var{x[0]} + \\var{x[1]} +\\var{x[2]} +\\var{x[3]} +\\var{x[4]} +\\var{x[5]} +\\var{x[6]} +\\var{x[7]} +\\var{x[8]} +\\var{x[9]} + \\var{x[10]} + \\var{x[11]} +\\var{x[12]} +\\var{x[13]} +\\var{x[14]} +\\var{x[15]} +\\var{x[16]} +\\var{x[17]} +\\var{x[18]} +\\var{x[19]} \\\\
&= \\var{sum(x)} \\text{.}
\\end{align}

\n

Therefore we calculate the mean

\n

\\begin{align}
\\overline{x} &= \\frac{\\sum x}{n} \\\0.5em] &= \\frac{\\var{sum(x)}}{20} \\\\[0.5em] &= \\var{meanx} \\text{.} \\end{align} \n \n b) \n The median is the middle value. We need to sort the list in ascending order: \n \\[ \\var{s[0]}, \\quad \\var{s[1]}, \\quad \\var{s[2]}, \\quad \\var{s[3]}, \\quad \\var{s[4]}, \\quad \\var{s[5]}, \\quad \\var{s[6]}, \\quad \\var{s[7]}, \\quad \\var{s[8]}, \\quad \\var{s[9]}, \\quad \\var{s[10]}, \\quad \\var{s[11]}, \\quad \\var{s[12]}, \\quad \\var{s[13]}, \\quad \\var{s[14]}, \\quad \\var{s[15]}, \\quad \\var{s[16]}, \\quad \\var{s[17]}, \\quad \\var{s[18]}, \\quad \\var{s[19]} \

\n

There is an even number of responses, so there are two numbers in the middle (10th and 11th place). To find the median, we need to find the mean of these two numbers $\\var{s[9]}$ and $\\var{s[10]}$:

\n

\\begin{align}
\\frac{\\var{s[9]} + \\var{s[10]}}{2} &=  \\frac{\\var{s[9] + s[10]}}{2} \\\\
&= \\var{medianx} \\text{.}
\\end{align}

\n

\n

c)

\n

The mode is the value that occurs the most often in the data.

\n

To find a mode, we can look at our sorted list:

\n

$\\var{s[0]}, \\var{s[1]}, \\var{s[2]}, \\var{s[3]}, \\var{s[4]}, \\var{s[5]}, \\var{s[6]}, \\var{s[7]}, \\var{s[8]}, \\var{s[9]}, \\var{s[10]}, \\var{s[11]}, \\var{s[12]}, \\var{s[13]}, \\var{s[14]}, \\var{s[15]}, \\var{s[16]}, \\var{s[17]}, \\var{s[18]}, \\var{s[19]}$.

\n

We notice that the values $\\var{modex}$ occur the most. The lowest of these values is $\\var{modex[0]}$.

\n

\n

d)

\n

Range is the difference between the highest and the lowest value in the data.

\n

To find this, we subtract the lowest value from the highest value:

\n

\$\\var{max(x)} - \\var{min(x)} = \\var{rangex} \\text{.}\$

", "extensions": ["stats"], "ungrouped_variables": ["modea1", "modea2", "a1", "a2", "a3", "mu", "sigm", "x", "modex", "meanx", "medianx", "rangex", "s"]}]}], "contributors": [{"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/", "name": "Christian Lawson-Perfect"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/", "name": "Chris Graham"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/", "name": "Vicky Hall"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/", "name": "Stanislav Duris"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2490/", "name": "Lauren Frances Desoysa"}]}