// Numbas version: finer_feedback_settings {"name": "Measures of central tendency from frequency tables", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "
The total number of goals scored during a random sample of $30$ Premier League football matches are shown below:
\n$\\var{a[0]}$ | \n$\\var{a[1]}$ | \n$\\var{a[2]}$ | \n$\\var{a[3]}$ | \n$\\var{a[4]}$ | \n$\\var{a[5]}$ | \n$\\var{a[6]}$ | \n$\\var{a[7]}$ | \n$\\var{a[8]}$ | \n$\\var{a[9]}$ | \n
$\\var{a[10]}$ | \n$\\var{a[11]}$ | \n$\\var{a[12]}$ | \n$\\var{a[13]}$ | \n$\\var{a[14]}$ | \n$\\var{a[15]}$ | \n$\\var{a[16]}$ | \n$\\var{a[17]}$ | \n$\\var{a[18]}$ | \n$\\var{a[19]}$ | \n
$\\var{a[20]}$ | \n$\\var{a[21]}$ | \n$\\var{a[22]}$ | \n$\\var{a[23]}$ | \n$\\var{a[24]}$ | \n$\\var{a[25]}$ | \n$\\var{a[26]}$ | \n$\\var{a[27]}$ | \n$\\var{a[28]}$ | \n$\\var{a[29]}$ | \n
Given a table of data, calculate the mean, mode and median, and complete a frequency table.
", "licence": "Creative Commons Attribution 4.0 International"}, "advice": "Organising the data in a frequency table helps to make mistakes less likely when calculating statistics from our data, summarising the responses all in one place with fewer numbers.
\nEach row of the frequency column gives the number of Premier League football matches with the corresponding number of goals.
\nTotal number of goals scored | \nFrequency | \n
---|---|
$0$ | \n$\\var{freq[0]}$ | \n
$1$ | \n$\\var{freq[1]}$ | \n
$2$ | \n$\\var{freq[2]}$ | \n
$3$ | \n$\\var{freq[3]}$ | \n
$4$ | \n$\\var{freq[4]}$ | \n
$5$ | \n$\\var{freq[5]}$ | \n
$6$ | \n$\\var{freq[6]}$ | \n
Total | \n$30$ | \n
Always remember to check whether your frequency column adds up to the total (here, it is $30$) to make sure you have not left out any responses.
\nThe mean number of goals is the total number of goals, $\\sum x$, divided by the number of football matches in the sample, $n$.
\n\\begin{align}
\\sum x &= 0 \\times \\var{freq[0]} + 1 \\times \\var{freq[1]} + 2 \\times \\var{freq[2]} + 3 \\times \\var{freq[3]} + 4 \\times \\var{freq[4]} + 5 \\times \\var{freq[5]} + 6 \\times \\var{freq[6]}
\\\\
&= 0 + \\var{1*freq[1]} + \\var{2*freq[2]} + \\var{3*freq[3]} + \\var{4*freq[4]} + \\var{5*freq[5]} + \\var{6*freq[6]} \\\\&= \\var{sum(a)} \\text{.}
\\end{align}
The total number of football matches $n$ is $30$.
\nTherefore the mean is
\n\\begin{align}
\\bar{x} &= \\frac{\\sum x}{n} \\\\
&= \\frac{\\var{sum(a)}}{30} \\\\
&= \\var{precround(mean, 2)} \\text{.}
\\end{align}
The mode is the value with the highest frequency. Here, the mode is $\\var{mode}$ goals, with frequency $\\var{freq[mode]}$.
\nThe median is the \"middle\" value in the sample, when arranged in ascending order.
\nTo find the middle position within a data set, we take the sample size, add $1$, then divide by $2$. For our data set, the middle position is
\n$\\displaystyle\\frac{n+1}{2}=\\frac{30+1}{2}=15.5.$
\nAs there is not actually a $15.5$th position, we need to find the mean of the $15$th and $16$th values. We can count from the top of the table until we locate rows where these values lie, as the numbers in the table are already sorted by order.
\nHere, both $15$th and $16$th value lie in the row $\\var{as[14]}$.Here, the $15$th value lies in the row $\\var{as[14]}$ while the $16$th value lies in the row $\\var{as[15]}$.
\nAs $15$th value $= 16$th value $= \\var{as[14]}$, the median is $\\var{as[14]}$. The $15$th value $= \\var{as[14]}$ and $16$th value $= \\var{as[15]}$ and their mean is given by
\n$ \\displaystyle \\frac{\\var{as[14]} + \\var{as[15]}}{2} = \\frac{\\var{as[14] + as[15]}}{2} = \\var{median}{.}$
\nThis is the median for this data.
\n", "rulesets": {}, "variablesTest": {"condition": "", "maxRuns": "1000"}, "preamble": {"js": "", "css": ""}, "ungrouped_variables": ["a1", "modea1", "a2", "modea2", "a3", "modea3"], "parts": [{"extendBaseMarkingAlgorithm": true, "gaps": [{"extendBaseMarkingAlgorithm": true, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "marks": 1, "unitTests": [], "variableReplacements": [], "maxValue": "freq[0]", "correctAnswerStyle": "plain", "minValue": "freq[0]"}, {"extendBaseMarkingAlgorithm": true, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "marks": 1, "unitTests": [], "variableReplacements": [], "maxValue": "freq[1]", "correctAnswerStyle": "plain", "minValue": "freq[1]"}, {"extendBaseMarkingAlgorithm": true, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "marks": 1, "unitTests": [], "variableReplacements": [], "maxValue": "freq[2]", "correctAnswerStyle": "plain", "minValue": "freq[2]"}, {"extendBaseMarkingAlgorithm": true, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "marks": 1, "unitTests": [], "variableReplacements": [], "maxValue": "freq[3]", "correctAnswerStyle": "plain", "minValue": "freq[3]"}, {"extendBaseMarkingAlgorithm": true, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "marks": 1, "unitTests": [], "variableReplacements": [], "maxValue": "freq[4]", "correctAnswerStyle": "plain", "minValue": "freq[4]"}, {"extendBaseMarkingAlgorithm": true, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "marks": 1, "unitTests": [], "variableReplacements": [], "maxValue": "freq[5]", "correctAnswerStyle": "plain", "minValue": "freq[5]"}, {"extendBaseMarkingAlgorithm": true, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "marks": 1, "unitTests": [], "variableReplacements": [], "maxValue": "freq[6]", "correctAnswerStyle": "plain", "minValue": "freq[6]"}], "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "customMarkingAlgorithm": "", "scripts": {}, "marks": 0, "unitTests": [], "variableReplacements": [], "prompt": "Complete the following frequency table:
\nNumber goals scored | \nFrequency | \n
---|---|
$0$ | \n[[0]] | \n
$1$ | \n[[1]] | \n
$2$ | \n[[2]] | \n
$3$ | \n[[3]] | \n
$4$ | \n[[4]] | \n
$5$ | \n[[5]] | \n
$6$ | \n[[6]] | \n
Total | \n$30$ | \n
Find the mean, mode and median for this data.
\nMean = [[0]]
\nMode = [[1]]
\nMedian = [[2]]
", "sortAnswers": false}], "variable_groups": [{"variables": ["a", "mean", "median", "m", "mode", "freq", "as"], "name": "Final data"}], "functions": {}, "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Vicky Hall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Lauren Frances Desoysa", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2490/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Vicky Hall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Lauren Frances Desoysa", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2490/"}]}