// Numbas version: exam_results_page_options {"name": "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": {}, "variable_groups": [{"variables": ["a", "mean", "median", "m", "mode", "freq", "as"], "name": "Final data"}], "tags": ["Frequency Table", "Frequency table", "frequency table", "taxonomy"], "name": "Complete a frequency table and find the measures of central tendency", "functions": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Given a table of data, calculate the mean, mode and median, and complete a frequency table.

"}, "ungrouped_variables": ["a1", "modea1", "a2", "modea2", "a3", "modea3"], "parts": [{"variableReplacementStrategy": "originalfirst", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "freq[0]", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "freq[0]"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "freq[1]", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "freq[1]"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "freq[2]", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "freq[2]"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "freq[3]", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "freq[3]"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "freq[4]", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "freq[4]"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "freq[5]", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "freq[5]"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "freq[6]", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "freq[6]"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "prompt": "

Complete 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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Number of siblingsFrequency
$0$[[0]]
$1$[[1]]
$2$[[2]]
$3$[[3]]
$4$[[4]]
$5$[[5]]
$6$[[6]]
Total$30$
\n

", "variableReplacements": [], "scripts": {}, "marks": 0}, {"variableReplacementStrategy": "originalfirst", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "precisionMessage": "You have not given your answer to the correct precision.", "mustBeReduced": false, "strictPrecision": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "mean", "scripts": {}, "marks": 1, "allowFractions": false, "showPrecisionHint": true, "mustBeReducedPC": 0, "precisionPartialCredit": 0, "precisionType": "dp", "type": "numberentry", "correctAnswerFraction": false, "maxValue": "mean", "precision": "2"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "mode", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "mode"}, {"notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showCorrectAnswer": true, "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "minValue": "median", "scripts": {}, "marks": 1, "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "correctAnswerFraction": false, "maxValue": "median"}], "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "gapfill", "prompt": "

Find the mean, mode and median for this data.

\n

Mean = [[0]]

\n

Mode =  [[1]]

\n

Median =  [[2]]

", "variableReplacements": [], "scripts": {}, "marks": 0}], "variablesTest": {"maxRuns": "1000", "condition": ""}, "variables": {"a1": {"description": "", "definition": "shuffle(repeat(random(0..1), 13) + 0 + 2 + 2 + repeat(random(2..3), 10) + repeat(random(4..5), 3) + random(0..6))", "templateType": "anything", "name": "a1", "group": "Ungrouped variables"}, "a3": {"description": "", "definition": "shuffle(repeat(0, 7) + repeat(1, 10) + repeat(2, 5) + repeat(3, 4) + repeat(4, 2) + repeat(5,1) + repeat(6,1))", "templateType": "anything", "name": "a3", "group": "Ungrouped variables"}, "mode": {"description": "", "definition": "m[0]", "templateType": "anything", "name": "mode", "group": "Final data"}, "median": {"description": "", "definition": "median(a)", "templateType": "anything", "name": "median", "group": "Final data"}, "a": {"description": "", "definition": "if(len(modea1) = 1, a1, if(len(modea2) = 1, a2, a3))", "templateType": "anything", "name": "a", "group": "Final data"}, "mean": {"description": "", "definition": "mean(a)", "templateType": "anything", "name": "mean", "group": "Final data"}, "modea1": {"description": "", "definition": "mode(a1)", "templateType": "anything", "name": "modea1", "group": "Ungrouped variables"}, "a2": {"description": "", "definition": "shuffle(repeat(random(0..1), 13) + 0 + 2 + 2 + repeat(random(2..3), 10) + repeat(random(4..5), 3) + random(0..6))", "templateType": "anything", "name": "a2", "group": "Ungrouped variables"}, "modea3": {"description": "", "definition": "mode(a3)", "templateType": "anything", "name": "modea3", "group": "Ungrouped variables"}, "as": {"description": "", "definition": "sort(a)", "templateType": "anything", "name": "as", "group": "Final data"}, "modea2": {"description": "", "definition": "mode(a2)", "templateType": "anything", "name": "modea2", "group": "Ungrouped variables"}, "freq": {"description": "", "definition": "map(\nlen(filter(x=j,x,a)),\nj, 0..6)", "templateType": "anything", "name": "freq", "group": "Final data"}, "m": {"description": "", "definition": "mode(a)", "templateType": "anything", "name": "m", "group": "Final data"}}, "extensions": ["stats"], "type": "question", "preamble": {"js": "", "css": ""}, "advice": "

a)

\n

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.

\n

Each row of the frequency column gives the number of students with the corresponding number of siblings.

\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\n\n\n\n\n\n\n\n\n
Number of siblingsFrequency
$0$$\\var{freq[0]}$
$1$$\\var{freq[1]}$
$2$$\\var{freq[2]}$
$3$$\\var{freq[3]}$
$4$$\\var{freq[4]}$
$5$$\\var{freq[5]}$
$6$$\\var{freq[6]}$
Total$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.

\n

b)

\n

Mean

\n

The 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}

\n

The total number of students $n$ is $30$.

\n

Therefore the mean is

\n

\\begin{align}
\\bar{x} &= \\frac{\\sum x}{n} \\\\
&= \\frac{\\var{sum(a)}}{30} \\\\
&= \\var{mean} \\text{.}
\\end{align}

\n

Rounding the answer to 2 decimal places, we get $\\var{precround(mean, 2)}$.

\n

Mode

\n

The mode is the value with the highest frequency. Here, the mode is $\\var{mode}$ siblings, with frequency $\\var{freq[mode]}$.

\n

Median

\n

The median is the \"middle\" value in the sample, when arranged in numerical order.

\n

Since $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.

\n

Here, 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]}$.

\n

As $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}\\]

\n

This is the median for this data.

\n

", "statement": "

30 random students were asked about the number of siblings they have. These are their responses:

\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\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]}$
$\\var{a[10]}$$\\var{a[11]}$$\\var{a[12]}$$\\var{a[13]}$$\\var{a[14]}$$\\var{a[15]}$$\\var{a[16]}$$\\var{a[17]}$$\\var{a[18]}$$\\var{a[19]}$
$\\var{a[20]}$$\\var{a[21]}$$\\var{a[22]}$$\\var{a[23]}$$\\var{a[24]}$$\\var{a[25]}$$\\var{a[26]}$$\\var{a[27]}$$\\var{a[28]}$$\\var{a[29]}$
\n

", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}