// Numbas version: finer_feedback_settings {"name": "Michael's copy of Complete a frequency table and find the measures of central tendency", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "extensions": ["stats"], "statement": "
30 random students were asked about the number of siblings they have. These are their responses:
\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"}, "functions": {}, "variables": {"a2": {"templateType": "anything", "name": "a2", "definition": "shuffle(repeat(random(0..1), 13) + 0 + 2 + 2 + repeat(random(2..3), 10) + repeat(random(4..5), 3) + random(0..6))", "group": "Ungrouped variables", "description": ""}, "a3": {"templateType": "anything", "name": "a3", "definition": "shuffle(repeat(0, 7) + repeat(1, 10) + repeat(2, 5) + repeat(3, 4) + repeat(4, 2) + repeat(5,1) + repeat(6,1))", "group": "Ungrouped variables", "description": ""}, "modea2": {"templateType": "anything", "name": "modea2", "definition": "mode(a2)", "group": "Ungrouped variables", "description": ""}, "mode": {"templateType": "anything", "name": "mode", "definition": "m[0]", "group": "Final data", "description": ""}, "mean": {"templateType": "anything", "name": "mean", "definition": "mean(a)", "group": "Final data", "description": ""}, "a1": {"templateType": "anything", "name": "a1", "definition": "shuffle(repeat(random(0..1), 13) + 0 + 2 + 2 + repeat(random(2..3), 10) + repeat(random(4..5), 3) + random(0..6))", "group": "Ungrouped variables", "description": ""}, "as": {"templateType": "anything", "name": "as", "definition": "sort(a)", "group": "Final data", "description": ""}, "median": {"templateType": "anything", "name": "median", "definition": "median(a)", "group": "Final data", "description": ""}, "a": {"templateType": "anything", "name": "a", "definition": "if(len(modea1) = 1, a1, if(len(modea2) = 1, a2, a3))", "group": "Final data", "description": ""}, "modea1": {"templateType": "anything", "name": "modea1", "definition": "mode(a1)", "group": "Ungrouped variables", "description": ""}, "freq": {"templateType": "anything", "name": "freq", "definition": "map(\nlen(filter(x=j,x,a)),\nj, 0..6)", "group": "Final data", "description": ""}, "modea3": {"templateType": "anything", "name": "modea3", "definition": "mode(a3)", "group": "Ungrouped variables", "description": ""}, "m": {"templateType": "anything", "name": "m", "definition": "mode(a)", "group": "Final data", "description": ""}}, "variable_groups": [{"name": "Final data", "variables": ["a", "mean", "median", "m", "mode", "freq", "as"]}], "tags": ["Frequency Table", "Frequency table", "frequency table", "taxonomy"], "variablesTest": {"condition": "", "maxRuns": "1000"}, "name": "Michael's copy of Complete a frequency table and find the measures of central tendency", "parts": [{"variableReplacementStrategy": "originalfirst", "prompt": "Complete the following frequency table:
\nNumber of siblings | \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]]
", "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": 0, "variableReplacements": [], "scripts": {}, "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "precision": "2", "showCorrectAnswer": true, "mustBeReduced": false, "marks": 1, "precisionPartialCredit": 0, "scripts": {}, "type": "numberentry", "maxValue": "mean", "variableReplacements": [], "precisionMessage": "You have not given your answer to the correct precision.", "precisionType": "dp", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "allowFractions": false, "showPrecisionHint": true, "correctAnswerStyle": "plain", "strictPrecision": false, "minValue": "mean", "mustBeReducedPC": 0}, {"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "marks": 1, "scripts": {}, "minValue": "mode", "maxValue": "mode", "variableReplacements": [], "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "allowFractions": false, "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0}, {"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "marks": 1, "scripts": {}, "minValue": "median", "maxValue": "median", "variableReplacements": [], "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "allowFractions": false, "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0}], "type": "gapfill"}], "ungrouped_variables": ["a1", "modea1", "a2", "modea2", "a3", "modea3"], "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 students with the corresponding number of siblings.
\nNumber of siblings | \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 siblings is the total number of siblings, $\\sum x$, divided by the number of students 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 students $n$ is $30$.
\nTherefore the mean is
\n\\begin{align}
\\bar{x} &= \\frac{\\sum x}{n} \\\\
&= \\frac{\\var{sum(a)}}{30} \\\\
&= \\var{mean} \\text{.}
\\end{align}
Rounding the answer to 2 decimal places, we get $\\var{precround(mean, 2)}$.
\nThe mode is the value with the highest frequency. Here, the mode is $\\var{mode}$ siblings, with frequency $\\var{freq[mode]}$.
\nThe median is the \"middle\" value in the sample, when arranged in numerical order.
\nSince $n = 30$, we have two middle values in this data (15th and 16th place). We can count from the top of the table until we locate rows where these middle 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]}$.As $15$th value $= \\var{as[14]}$ and $16$th value $= \\var{as[15]}$, we need to find their mean.
\n\\[ \\displaystyle \\begin{align} \\frac{\\var{as[14]} + \\var{as[15]}}{2} &= \\frac{\\var{as[14] + as[15]}}{2} \\\\&= \\var{median} \\text{.} \\end{align}\\]
\nThis is the median for this data.
\n", "preamble": {"js": "", "css": ""}, "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}]}