// Numbas version: finer_feedback_settings {"name": "Simon's copy of Averages (frequency table)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [{"name": "Frequencies", "variables": ["f1", "f2", "f3", "f4", "f5", "f6"]}, {"name": "Cumulative", "variables": ["cf2", "cf3", "cf4", "cf5", "tot"]}, {"name": "Median calculations", "variables": ["a1", "a2", "a3", "a4", "a5", "mp5", "median"]}, {"name": "Mean calculations", "variables": ["sfx", "mn"]}], "statement": "

Calculate the mean, the median and the mode for the following frequency table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Class012345
Frequency{f1}{f2}{f3}{f4}{f5}{f6}
", "preamble": {"js": "", "css": ""}, "extensions": [], "parts": [{"unitTests": [], "marks": "3", "precisionPartialCredit": 0, "prompt": "

Find the mean value, giving your answer to 2 d.p.

", "strictPrecision": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "steps": [{"unitTests": [], "variableReplacementStrategy": "originalfirst", "marks": 0, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "variableReplacements": [], "scripts": {}, "prompt": "

To find the mean use the formula $\\frac{\\Sigma fx}{\\Sigma f}$

", "type": "information", "showFeedbackIcon": true}], "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "scripts": {}, "type": "numberentry", "showPrecisionHint": true, "allowFractions": false, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "minValue": "{mn}", "mustBeReduced": false, "correctAnswerFraction": false, "stepsPenalty": 0, "precisionType": "dp", "maxValue": "{mn}", "precision": "2", "variableReplacements": [], "mustBeReducedPC": 0, "showFeedbackIcon": true}, {"unitTests": [], "scripts": {}, "marks": "3", "showCorrectAnswer": true, "minValue": "{median}", "correctAnswerStyle": "plain", "showFeedbackIcon": true, "prompt": "

What is the median value?

", "correctAnswerFraction": false, "stepsPenalty": "1", "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "allowFractions": false, "steps": [{"unitTests": [], "variableReplacementStrategy": "originalfirst", "marks": 0, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "variableReplacements": [], "scripts": {}, "prompt": "

The median is the \"middle\" value. 

\n

In a frequency table, the observations are already arranged in an ascending order. We can obtain the median by looking for the value in the middle position.

\n

First add up the frequencies to find $n$.

\n

Case 1. When the sum of the frequencies is odd, then the median is the value at the $\\frac{n+1}{2}^{th}$ position.
Case 2. When the sum of the frequencies is even, then the median is the average of values at the positions $\\frac{n}{2}^{th}$ and $\\frac{n+2}{2}^{th}$.

\n


We need to add up the frequencies until we reach this value and then the class we land in is the median.

", "type": "information", "showFeedbackIcon": true}], "customMarkingAlgorithm": "", "maxValue": "{median}", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "type": "numberentry"}, {"unitTests": [], "scripts": {}, "marks": "3", "showCorrectAnswer": true, "minValue": "1", "correctAnswerStyle": "plain", "showFeedbackIcon": true, "prompt": "

What is the mode?

", "correctAnswerFraction": false, "stepsPenalty": "1", "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "allowFractions": false, "steps": [{"unitTests": [], "variableReplacementStrategy": "originalfirst", "marks": 0, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "variableReplacements": [], "scripts": {}, "prompt": "

The mode is the number which occurs most often. In other words the class with the highest frequency.

", "type": "information", "showFeedbackIcon": true}], "customMarkingAlgorithm": "", "maxValue": "1", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "type": "numberentry"}], "metadata": {"description": "

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "rulesets": {}, "ungrouped_variables": ["a", "b"], "tags": [], "advice": "

(a)

\n

To find the mean use the formula $\\frac{\\Sigma fx}{\\Sigma f}$

\n

In other words

\n\n

\n

In other words $\\frac{(0\\times\\var{f1})+(1\\times \\var{f2})+(2\\times\\var{f3})+(3\\times\\var{f4}) +(4\\times\\var{f5})+(5\\times\\var{f6})}{\\var{f1}+\\var{f2}+\\var{f3}+\\var{f4}+\\var{f5}+\\var{f6}}$

\n

$=\\frac{\\var{sfx}}{\\var{tot}}=\\var{precround(sfx/(tot),2)}$

\n

\n

\n

(b)

\n

The median is the \"middle\" value. 

\n

In a frequency table, the observations are already arranged in an ascending order. We can obtain the median by looking for the value in the middle position.

\n

First add up the frequencies to find $n$.

\n

Case 1. When the sum of the frequencies is odd, then the median is the value at the $\\frac{n+1}{2}^{th}$ position.
Case 2. When the sum of the frequencies is even, then the median is the mean of values at the positions $\\frac{n}{2}^{th}$ and $\\frac{n+2}{2}^{th}$.

\n


We need to add up the frequencies until we reach this value and then the class we land in is the median.

\n

\n

In our example, $n=\\var{f1}+\\var{f2}+\\var{f3}+\\var{f4}+\\var{f5}+\\var{f6}=\\var{tot}$

\n

Since $n$ is odd, the median is the value at the $\\frac{n+1}{2}=\\frac{\\var{tot}+1}{2}^{th}$ position, i.e. value number $\\var{(tot+1)/2}$

\n

From our table, we can calculate the following cumulative frequencies:

\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
Class012345
Frequency{f1}{f2}{f3}{f4}{f5}{f6}
Cum Freq{f1}{cf2}{cf3}{cf4}{cf5}{tot}
\n

\n

And by looking at our cumulative frequencies we can see that value number $\\var{(tot+1)/2}$ occurs in class $\\var{median}$, which is therefore our median class.

\n

\n

(c)

\n

The mode is the number which occurs most often. In other words the class with the highest frequency.

\n

In this example, the mode is 1, since {f2} is the highest frequency.

\n

", "name": "Simon's copy of Averages (frequency table)", "variables": {"cf5": {"name": "cf5", "group": "Cumulative", "definition": "cf4+f5", "description": "", "templateType": "anything"}, "cf4": {"name": "cf4", "group": "Cumulative", "definition": "cf3+f4", "description": "", "templateType": "anything"}, "mn": {"name": "mn", "group": "Mean calculations", "definition": "sfx/tot", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(1..f1-1)", "description": "", "templateType": "anything"}, "f3": {"name": "f3", "group": "Frequencies", "definition": "f1-1", "description": "", "templateType": "anything"}, "mp5": {"name": "mp5", "group": "Median calculations", "definition": "tot/2", "description": "", "templateType": "anything"}, "cf2": {"name": "cf2", "group": "Cumulative", "definition": "f1+f2", "description": "", "templateType": "anything"}, "a3": {"name": "a3", "group": "Median calculations", "definition": "switch(cf3mp5,0)", "description": "", "templateType": "anything"}, "tot": {"name": "tot", "group": "Cumulative", "definition": "cf5+f6", "description": "", "templateType": "anything"}, "a2": {"name": "a2", "group": "Median calculations", "definition": "switch(cf2mp5,0)", "description": "", "templateType": "anything"}, "f1": {"name": "f1", "group": "Frequencies", "definition": "random(5..20)", "description": "", "templateType": "anything"}, "f2": {"name": "f2", "group": "Frequencies", "definition": "f1+a", "description": "", "templateType": "anything"}, "median": {"name": "median", "group": "Median calculations", "definition": "a1+a2+a3+a4+a5", "description": "", "templateType": "anything"}, "f5": {"name": "f5", "group": "Frequencies", "definition": "f1-b", "description": "", "templateType": "anything"}, "a1": {"name": "a1", "group": "Median calculations", "definition": "switch(f1mp5,0)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(a..f1)", "description": "", "templateType": "anything"}, "sfx": {"name": "sfx", "group": "Mean calculations", "definition": "0*f1+1*f2+2*f3+3*f4+4*f5+5*f6", "description": "", "templateType": "anything"}, "a4": {"name": "a4", "group": "Median calculations", "definition": "switch(cf4mp5,0)", "description": "", "templateType": "anything"}, "a5": {"name": "a5", "group": "Median calculations", "definition": "switch(cf5mp5,0)", "description": "", "templateType": "anything"}, "cf3": {"name": "cf3", "group": "Cumulative", "definition": "cf2+f3", "description": "", "templateType": "anything"}, "f6": {"name": "f6", "group": "Frequencies", "definition": "a", "description": "", "templateType": "anything"}, "f4": {"name": "f4", "group": "Frequencies", "definition": "f1-a", "description": "", "templateType": "anything"}}, "functions": {}, "variablesTest": {"maxRuns": 100, "condition": "mod(tot,2)=1"}, "type": "question", "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}