// Numbas version: exam_results_page_options {"name": "NC SP Difference between mean and median (10+)", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "NC SP Difference between mean and median (10+)", "tags": ["LANTITE"], "metadata": {"description": "

Used for LANTITE preparation (Australia). NC = Non Calculator strand. SP = Statistics & Probability strand.This question provides a list of data to the student. They are asked to find the difference between the mean and the median. This question was based on a Newcastle Uni question which also asked the mode, hence the surplus legacy variables (too tricky to delete).

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "
\n
\n
\n
\n
\n
\n
\n
\n

A random sample of 10 residents from Sydney were asked how many times they had watched a movie at a cinema last year.

\n

Here are their responses:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{a[0]}$$\\var{a[1]}$$\\var{a[2]}$$\\var{a[3]}$$\\var{a[4]}$$\\var{a[5]}$$\\var{a[6]}$$\\var{a[7]}$$\\var{a[8]}$$\\var{a[9]}$
", "advice": "
\n
\n

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

\n

Here, $n = 10$.

\n

\\begin{align}
\\sum x &= \\var{a[0]} + \\var{a[1]} +\\var{a[2]} +\\var{a[3]} +\\var{a[4]} +\\var{a[5]} +\\var{a[6]} +\\var{a[7]} +\\var{a[8]} +\\var{a[9]} \\\\
&= \\var{sum(a)} \\text{.}
\\end{align}

\n

Therefore we calculate the mean

\n

\\begin{align}
\\overline{x} &= \\frac{\\sum x}{n} \\\\[0.5em]
&= \\frac{\\var{sum(a)}}{10} \\\\[0.5em]
&= \\var{mean} \\text{.}
\\end{align}

\n

 

\n

The median is the middle value. We need to sort the list in order:

\n

\\[ \\var{a_s[0]}, \\quad \\var{a_s[1]}, \\quad \\var{a_s[2]}, \\quad \\var{a_s[3]}, \\quad \\var{a_s[4]}, \\quad \\var{a_s[5]}, \\quad \\var{a_s[6]}, \\quad \\var{a_s[7]}, \\quad \\var{a_s[8]}, \\quad \\var{a_s[9]}\\]

\n

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

\n

\\begin{align}
\\frac{\\var{a_s[4]} + \\var{a_s[5]}}{2} &=  \\frac{\\var{a_s[4] + a_s[5]}}{2} \\\\
&= \\var{median} \\text{.} 
\\end{align}

\n

 

\n

To find the difference between the mean and the median, we subtract the two values:

\n
\n

Since we require a positive number, we subtract the median from the mean.

\n

mean - median = {mean} - {median} = {mean-median}

\n

Finally, check that we have answered to one decimal place.

\n

The difference between the mean and the median is {abs(precround({mean-median},1))}.

\n
\n
\n

Since we require a positive number, we subtract the mean from the median.

\n

median - mean = {median} - {mean} =  {median - mean}

\n

Finally, check that we have answered to one decimal place.

\n

The difference between the mean and the median is {abs(precround({mean-median},1))}.

\n
\n
\n

However, the mean and the median are equal.

\n

Therefore the difference between the mean and the median is 0.

\n
", "rulesets": {}, "extensions": ["stats"], "variables": {"a3": {"name": "a3", "group": "Ungrouped variables", "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])", "description": "
\n
\n
\n
\n

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

", "templateType": "anything"}, "a": {"name": "a", "group": "final list", "definition": "if(len(modea1) = 1, a1, if(len(modea2) = 1, a2, a3))", "description": "
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

The final list.

", "templateType": "anything"}, "a_s": {"name": "a_s", "group": "final list", "definition": "sort(a)", "description": "
\n
\n
\n
\n
\n
\n
\n

Sorted list.

", "templateType": "anything"}, "a1": {"name": "a1", "group": "Ungrouped variables", "definition": "repeat(random(0..8), 10)", "description": "
\n
\n
\n
\n
\n

Option 1 for the list. Only used if there is only one mode. Generates a list of 10 numbers between 0 and 8.

", "templateType": "anything"}, "modea1": {"name": "modea1", "group": "Ungrouped variables", "definition": "mode(a1)", "description": "
\n
\n
\n
\n

", "templateType": "anything"}, "modea2": {"name": "modea2", "group": "Ungrouped variables", "definition": "mode(a2)", "description": "
\n
\n
\n

", "templateType": "anything"}, "mean": {"name": "mean", "group": "final list", "definition": "mean(a)", "description": "
\n
\n
\n
\n
\n

The calculated mean of the list of numbers.

", "templateType": "anything"}, "median": {"name": "median", "group": "final list", "definition": "median(a)", "description": "
\n
\n
\n
\n
\n

The calculated median of the list of numbers.

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

Option 2 for the list. Only used if there is only one mode and option 1 was not used. Generates a list of 10 numbers between 0 and 8.

", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["modea1", "modea2", "a1", "a2", "a3"], "variable_groups": [{"name": "final list", "variables": ["a", "a_s", "mean", "median"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "
\n
\n
\n

What is the difference between the mean and the median for this data set? Give your answer as a positive number rounded to one decimal place.

", "minValue": "precround(abs(mean-median),1)", "maxValue": "precround(abs(mean-median),1)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Adelle Colbourn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2083/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Adelle Colbourn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2083/"}]}