// Numbas version: exam_results_page_options {"name": "Ollie's copy of Harry's copy of Calculate measures of central tendency and spread", "type": "exam", "showstudentname": true, "navigation": {"showfrontpage": true, "allowregen": true, "reverse": true, "onleave": {"action": "none", "message": ""}, "preventleave": true, "showresultspage": "oncompletion", "browse": true}, "feedback": {"showanswerstate": true, "showtotalmark": true, "advicethreshold": 0, "intro": "", "showactualmark": true, "allowrevealanswer": true, "feedbackmessages": []}, "metadata": {"description": "

Calculate and work with measures of central tendency such as mean, median and mode, and measures of spread such as range and standard deviation.

", "licence": "Creative Commons Attribution 4.0 International"}, "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 1, "name": "Group", "questions": [{"name": "Calculate the measures of central tendency for a sample", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "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/"}], "variable_groups": [{"variables": ["a", "a_s", "mean", "median", "mode", "mode1", "range", "modetimes"], "name": "final list"}], "preamble": {"js": "", "css": ""}, "parts": [{"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "minValue": "mean", "maxValue": "mean", "showFractionHint": true, "variableReplacements": [], "useCustomName": false, "customName": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "scripts": {}, "marks": 1, "prompt": "

Find the mean.

"}, {"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "minValue": "median", "maxValue": "median", "showFractionHint": true, "variableReplacements": [], "useCustomName": false, "customName": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "scripts": {}, "marks": 1, "prompt": "

Find the median.

"}, {"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "minValue": "mode1", "maxValue": "mode1", "showFractionHint": true, "variableReplacements": [], "useCustomName": false, "customName": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "scripts": {}, "marks": 1, "prompt": "

Find the mode.

"}, {"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "minValue": "range", "maxValue": "range", "showFractionHint": true, "variableReplacements": [], "useCustomName": false, "customName": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "scripts": {}, "marks": 1, "prompt": "

Find the range.

"}], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

This question provides a list of data to the student. They are asked to find the mean, median, mode and range.

"}, "tags": ["mean", "measures of average and spread", "median", "mode", "range", "taxonomy"], "variables": {"a2": {"templateType": "anything", "description": "

Option 2 for the list. Only used if there is only one mode and option 1 was not used.

", "definition": "repeat(random(0..8), 20)", "name": "a2", "group": "Ungrouped variables"}, "modea1": {"templateType": "anything", "description": "", "definition": "mode(a1)", "name": "modea1", "group": "Ungrouped variables"}, "median": {"templateType": "anything", "description": "", "definition": "median(a)", "name": "median", "group": "final list"}, "a1": {"templateType": "anything", "description": "

Option 1 for the list. Only used if there is only one mode.

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

Sorted list.

", "definition": "sort(a)", "name": "a_s", "group": "final list"}, "modea2": {"templateType": "anything", "description": "", "definition": "mode(a2)", "name": "modea2", "group": "Ungrouped variables"}, "a3": {"templateType": "anything", "description": "

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

", "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 random(0..3 except 2 except 1), \n random(4..6),\n 2,\n random(1..3 except 2), \n random(7..8),\n 2,\n random(7..8),\n random(4..6), \n random(0..3 except 2), \n 2\n])", "name": "a3", "group": "Ungrouped variables"}, "mean": {"templateType": "anything", "description": "", "definition": "mean(a)", "name": "mean", "group": "final list"}, "modetimes": {"templateType": "anything", "description": "

The vector of number of times of each value in the data.

", "definition": "map(\nlen(filter(x=j,x,a)),\nj, 0..8)", "name": "modetimes", "group": "final list"}, "range": {"templateType": "anything", "description": "", "definition": "max(a) - min(a)", "name": "range", "group": "final list"}, "mode1": {"templateType": "anything", "description": "

Mode as a value.

", "definition": "mode[0]", "name": "mode1", "group": "final list"}, "mode": {"templateType": "anything", "description": "

Mode as a vector.

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

The final list.

", "definition": "if(len(modea1) = 1, a1, if(len(modea2) = 1, a2, a3))", "name": "a", "group": "final list"}}, "rulesets": {}, "functions": {}, "ungrouped_variables": ["modea1", "modea2", "a1", "a2", "a3"], "statement": "

A random sample of 20 residents from Newcastle were asked about the number of times they went to see a play at the theatre last year.

\n

Here is the list of their answers:

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

#### a)

\n

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

\n

Here, $n = 20$.

\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{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{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)}}{20} \\\\[0.5em] &= \\var{mean} \\text{.} \\end{align} \n \n #### b) \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]}, \\quad \\var{a_s[10]}, \\quad \\var{a_s[11]}, \\quad \\var{a_s[12]}, \\quad \\var{a_s[13]}, \\quad \\var{a_s[14]}, \\quad \\var{a_s[15]}, \\quad \\var{a_s[16]}, \\quad \\var{a_s[17]}, \\quad \\var{a_s[18]}, \\quad \\var{a_s[19]} \

\n

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

\n

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

\n

\n

#### c)

\n

The mode is the value that occurs the most often in the data.

\n

To find a mode, we can look at our sorted list:

\n

$\\var{a_s[0]}, \\var{a_s[1]}, \\var{a_s[2]}, \\var{a_s[3]}, \\var{a_s[4]}, \\var{a_s[5]}, \\var{a_s[6]}, \\var{a_s[7]}, \\var{a_s[8]}, \\var{a_s[9]}, \\var{a_s[10]}, \\var{a_s[11]}, \\var{a_s[12]}, \\var{a_s[13]}, \\var{a_s[14]}, \\var{a_s[15]}, \\var{a_s[16]}, \\var{a_s[17]}, \\var{a_s[18]}, \\var{a_s[19]}$.

\n

We notice that $\\var{mode1}$ occurs the most ($\\var{modetimes[mode1]}$ times) so $\\var{mode1}$ is the mode.

\n

\n

#### d)

\n

Range is the difference between the highest and the lowest value in the data.

\n

To find this, we subtract the lowest value from the highest value:

\n

\$\\var{max(a)} - \\var{min(a)} = \\var{range} \\text{.}\$

", "variablesTest": {"condition": "", "maxRuns": 100}}, {"name": "Estimate the mean and find the modal class for grouped data", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "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/"}], "metadata": {"description": "

Fill in a frequency table for grouped data, then estimate the mean and identify the modal class.

", "licence": "Creative Commons Attribution 4.0 International"}, "rulesets": {}, "type": "question", "ungrouped_variables": ["freq", "freq_midpoint", "sixty", "seventy"], "advice": "

#### a)

\n

We calculate the midpoint by finding the mean of the lower and upper bounds. For example, the midpoint for $40 \\leq a \\lt 50$ is

\n

\\\begin{align} \\displaystyle \\frac{40 + 50}{2} &= \\frac{90}{2} \\\\&= 45 \\text{.} \\end{align}\

\n

To calculate the final column, we multiply the second and the third columns:

\n

\$\\var{freq[4]} \\times 45 = \\var{45*freq[4]} \\text{.} \$

\n

Finally, when we have completed all the other values, we can calculate the total for the last column.

\n

\\\begin{align} \\text{Total} &= 5\\times\\var{freq[0]} + 15\\times\\var{freq[1]} + 25\\times\\var{freq[2]} + 35\\times\\var{freq[3]} + 45\\times\\var{freq[4]} + 55\\times\\var{freq[5]} + 65\\times\\var{freq[6]} + 75\\times\\var{freq[7]} + 85\\times\\var{freq[8]} + 95\\times\\var{freq[9]} \\\\&= \\var{5*freq[0]} + \\var{15*freq[1]} + \\var{25*freq[2]} + \\var{35*freq[3]} + \\var{45*freq[4]} + \\var{55*freq[5]} + \\var{65*freq[6]} + \\var{75*freq[7]} + \\var{85*freq[8]} + \\var{95*freq[9]} \\\\&= \\var{freq_midpoint} \\text{.} \\end{align}\

\n

The completed frequency table looks like this:

\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\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
Stage 1 grade $a$FrequencyMidpointFrequency $\\times$ Midpoint
$0 \\leq a \\lt 10$$\\var{freq[0]}$$5$$\\var{5*freq[0]} 10 \\leq a \\lt 20$$\\var{freq[1]}$$15$$\\var{15*freq[1]}$
$20 \\leq a \\lt 30$$\\var{freq[2]}$$25$$\\var{25*freq[2]} 30 \\leq a \\lt 40$$\\var{freq[3]}$$35$$\\var{35*freq[3]}$
$40 \\leq a \\lt 50$$\\var{freq[4]}$$45$$\\var{45*freq[4]} 50 \\leq a \\lt 60$$\\var{freq[5]}$$55$$\\var{55*freq[5]}$
$60 \\leq a \\lt 70$$\\var{freq[6]}$$65$$\\var{65*freq[6]} 70 \\leq a \\lt 80$$\\var{freq[7]}$$75$$\\var{75*freq[7]}$
$80 \\leq a \\lt 90$$\\var{freq[8]}$$85$$\\var{85*freq[8]} 90 \\leq a \\lt 100$$\\var{freq[9]}$$95$$\\var{95*freq[9]}$
Totals\\var{sum(freq)}\\var{freq_midpoint} \n \n #### b) \n We don't know exactly how much each student got, so we have to assume all students got the midpoint of their group. To estimate the sum of all student grades in a particular interval, we can multiply the interval's midpoint by its frequency. \n The sum of all the grades in the class is the sum of the estimates for each interval. We've already calculated this in the table above. \n So the estimate for the mean, \\bar{a}, is as follows: \n \\begin{align} \\bar{a} &\\approx \\frac{\\var{freq_midpoint}}{\\var{sum(freq)}} \\\\ &= \\var{freq_midpoint/sum(freq)} \\text{.} \\end{align} \n Rounding the mean to 2 decimal places, we get \\var{precround(freq_midpoint/sum(freq),2)}. \n #### c) \n The modal class is the interval with the highest frequency. In this case, the interval 50 \\leq a \\lt 60 is the modal class. ", "variable_groups": [], "statement": " \\var{sum(freq)} Mathematics and Statistics students have finished their first year at Newcastle University. ", "parts": [{"scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "stepsPenalty": 0, "steps": [{"scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "information", "showCorrectAnswer": true, "prompt": " The midpoint of an interval is the mean of the upper and lower bounds. ", "variableReplacements": [], "showFeedbackIcon": true, "marks": 0}], "marks": 0, "variableReplacements": [], "showFeedbackIcon": true, "prompt": " Their stage 1 grades (denoted a) have been summarised and grouped into intervals in the frequency table below. Complete the 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\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 Stage 1 grade aFrequencyMidpointFrequency \\times Midpoint 0 \\leq a \\lt 10\\var{freq[0]}[[0]][[10]]
$10 \\leq a \\lt 20$$\\var{freq[1]}[[1]][[11]] 20 \\leq a \\lt 30$$\\var{freq[2]}$[[2]][[12]]
$30 \\leq a \\lt 40$$\\var{freq[3]}[[3]][[13]] 40 \\leq a \\lt 50$$\\var{freq[4]}$[[4]][[14]]
$50 \\leq a \\lt 60$$\\var{freq[5]}[[5]][[15]] 60 \\leq a \\lt 70$$\\var{freq[6]}$[[6]][[16]]
$70 \\leq a \\lt 80$$\\var{freq[7]}[[7]][[17]] 80 \\leq a \\lt 90$$\\var{freq[8]}$[[8]][[18]]
$90 \\leq a \\lt 100$$\\var{freq[9]}[[9]][[19]] Totals\\var{sum(freq)}$$-$[[20]]

Now use the table to estimate the mean grade, $\\bar{a}$.

", "precision": "2", "showFeedbackIcon": true, "minValue": "freq_midpoint/sum(freq)", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "mustBeReduced": false, "precisionMessage": "You have not given your answer to the correct precision."}, {"shuffleChoices": false, "minMarks": 0, "showCorrectAnswer": true, "displayColumns": "5", "variableReplacements": [], "showFeedbackIcon": true, "prompt": "

From the choices below, choose the correct modal class for this data.

", "choices": ["

$30 \\leq a \\lt 40$

", "

$40 \\leq a \\lt 50$

", "

$50 \\leq a \\lt 60$

", "

$60 \\leq a \\lt 70$

", "

$70 \\leq a \\lt 80$

"], "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "1_n_2", "maxMarks": 0, "marks": 0, "distractors": ["", "", "", "", ""], "matrix": [0, 0, "2", "0", 0], "displayType": "radiogroup"}], "tags": ["estimate the mean", "grouped data", "intervals", "modal class", "taxonomy"], "preamble": {"css": "", "js": ""}, "functions": {}, "variables": {"seventy": {"description": "", "group": "Ungrouped variables", "definition": "random(35..sixty except sixty)", "name": "seventy", "templateType": "anything"}, "freq_midpoint": {"description": "", "group": "Ungrouped variables", "definition": "5*freq[0] + 15*freq[1] + 25*freq[2] + 35*freq[3] + 45*freq[4] + 55*freq[5] + 65*freq[6] + 75*freq[7] + 85*freq[8] + 95*freq[9]", "name": "freq_midpoint", "templateType": "anything"}, "freq": {"description": "\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 $0 \\leq a \\lt 10$ 0..8 $10 \\leq a \\lt 20$ 0..7 $20 \\leq a \\lt 30$ 0..4 $30 \\leq a \\lt 40$ 6..18 $40 \\leq a \\lt 50$ 20..50 $50 \\leq a \\lt 60$ 30..60 \n\n\n 60 70 $70 \\leq a \\lt 80$ 10..40 $80 \\leq a \\lt 90$ 0..6 $90 \\leq a \\lt 100$ 0..1
\n

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

Find the mean, mode and median for this data.

\n

Mean = [[0]]

\n

Mode =  [[1]]

\n

Median =  [[2]]

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

"}, "tags": ["Frequency Table", "Frequency table", "frequency table", "taxonomy"], "preamble": {"js": "", "css": ""}, "rulesets": {}, "functions": {}, "ungrouped_variables": ["a1", "modea1", "a2", "modea2", "a3", "modea3"], "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

#### 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

\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

", "variablesTest": {"condition": "", "maxRuns": "1000"}}, {"name": "Weight of a scoop in two ice cream parlours", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}], "type": "question", "tags": ["mean", "median", "mode", "range", "taxonomy"], "variablesTest": {"condition": "\n", "maxRuns": 100}, "variables": {"b6": {"templateType": "anything", "name": "b6", "description": "", "definition": "meanab - 6", "group": "B"}, "alist": {"templateType": "anything", "name": "alist", "description": "", "definition": "[a1,a2,a3,a4,a5,a6,a7,a8,a9,a10]", "group": "A"}, "a2": {"templateType": "anything", "name": "a2", "description": "", "definition": "meanab - 1 - random2", "group": "A"}, "bsort": {"templateType": "anything", "name": "bsort", "description": "", "definition": "sort(b)", "group": "B"}, "suma": {"templateType": "anything", "name": "suma", "description": "", "definition": "sum(a)", "group": "Ungrouped variables"}, "rangeb": {"templateType": "anything", "name": "rangeb", "description": "", "definition": "max(b) - min(b)", "group": "Ungrouped variables"}, "b5": {"templateType": "anything", "name": "b5", "description": "", "definition": "meanab - 8 ", "group": "B"}, "meana": {"templateType": "anything", "name": "meana", "description": "", "definition": "(a1 + a2 + a3 + a4 + a5+ a6 + a7 + a8 + a9 + a10)/10", "group": "Ungrouped variables"}, "a6": {"templateType": "anything", "name": "a6", "description": "", "definition": "meanab", "group": "A"}, "a10": {"templateType": "anything", "name": "a10", "description": "", "definition": "meanab + 2 + random2", "group": "A"}, "rangea": {"templateType": "anything", "name": "rangea", "description": "", "definition": "max(a) - min(a)", "group": "Ungrouped variables"}, "asort": {"templateType": "anything", "name": "asort", "description": "", "definition": "sort(a)", "group": "A"}, "a": {"templateType": "anything", "name": "a", "description": "", "definition": "shuffle(alist)", "group": "A"}, "modea": {"templateType": "anything", "name": "modea", "description": "", "definition": "mode(a)[0]", "group": "Ungrouped variables"}, "modeb": {"templateType": "anything", "name": "modeb", "description": "", "definition": "mode(b)[0]", "group": "Ungrouped variables"}, "b3": {"templateType": "anything", "name": "b3", "description": "", "definition": "meanab - 12", "group": "B"}, "random": {"templateType": "anything", "name": "random", "description": "", "definition": "random(2..10 #2)", "group": "B"}, "a9": {"templateType": "anything", "name": "a9", "description": "", "definition": "meanab + 1 + random2", "group": "A"}, "meanb": {"templateType": "anything", "name": "meanb", "description": "", "definition": "(b1+b2+b3+b4+b5+b6+b7+b8+b9+b10)/10", "group": "Ungrouped variables"}, "a3": {"templateType": "anything", "name": "a3", "description": "", "definition": "meanab - 2", "group": "A"}, "meanab": {"templateType": "anything", "name": "meanab", "description": "", "definition": "random(80..90)", "group": "Ungrouped variables"}, "b10": {"templateType": "anything", "name": "b10", "description": "", "definition": "meanab + 27 + random/2", "group": "B"}, "a8": {"templateType": "anything", "name": "a8", "description": "", "definition": "meanab + 1", "group": "A"}, "b1": {"templateType": "anything", "name": "b1", "description": "", "definition": "meanab - 15 - random", "group": "B"}, "b4": {"templateType": "anything", "name": "b4", "description": "", "definition": "meanab - 10", "group": "B"}, "medianb": {"templateType": "anything", "name": "medianb", "description": "", "definition": "median(b)", "group": "Ungrouped variables"}, "b7": {"templateType": "anything", "name": "b7", "description": "", "definition": "meanab - 2", "group": "B"}, "b9": {"templateType": "anything", "name": "b9", "description": "", "definition": "meanab + 27 + random/2", "group": "B"}, "a4": {"templateType": "anything", "name": "a4", "description": "", "definition": "meanab", "group": "A"}, "b8": {"templateType": "anything", "name": "b8", "description": "", "definition": "meanab + 13", "group": "B"}, "a5": {"templateType": "anything", "name": "a5", "description": "", "definition": "meanab", "group": "A"}, "random2": {"templateType": "anything", "name": "random2", "description": "", "definition": "random(1..3)", "group": "A"}, "b": {"templateType": "anything", "name": "b", "description": "", "definition": "shuffle(blist)", "group": "B"}, "b2": {"templateType": "anything", "name": "b2", "description": "", "definition": "meanab - 14", "group": "B"}, "sumb": {"templateType": "anything", "name": "sumb", "description": "", "definition": "sum(b)", "group": "Ungrouped variables"}, "a7": {"templateType": "anything", "name": "a7", "description": "", "definition": "meanab + 1", "group": "A"}, "a1": {"templateType": "anything", "name": "a1", "description": "", "definition": "meanab - 2 - random2", "group": "A"}, "mediana": {"templateType": "anything", "name": "mediana", "description": "", "definition": "median(a)", "group": "Ungrouped variables"}, "blist": {"templateType": "anything", "name": "blist", "description": "", "definition": "[b1,b2,b3,b4,b5,b6,b7,b8,b9,b10]", "group": "B"}}, "functions": {}, "statement": "

Two ice cream parlours called Sweet Heaven and Tasty Hell both sell ice cream for the same price. Alice likes both of these places equally, and has visited each place 10 times. After every visit, Alice measured the weight of her scoop, in grams, to the nearest integer. Here is the table of her values:

\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
 Sweet Heaven (g) Tasty Hell (g) $\\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{b[0]}$ $\\var{b[1]}$ $\\var{b[2]}$ $\\var{b[3]}$ $\\var{b[4]}$ $\\var{b[5]}$ $\\var{b[6]}$ $\\var{b[7]}$ $\\var{b[8]}$ $\\var{b[9]}$
\n

Using the data above, fill in the following 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
 Sweet Heaven (g) Tasty Hell (g) Mean weight [[0]] [[1]] Median weight [[2]] [[3]] Modal weight [[4]] [[5]] Range [[6]] [[7]]
\n

", "type": "gapfill"}, {"displayColumns": 0, "minMarks": 0, "type": "1_n_2", "variableReplacementStrategy": "originalfirst", "maxMarks": 0, "choices": ["

Sweet Heaven

", "

Tasty Hell

"], "showFeedbackIcon": true, "prompt": "

Now suppose Alice has two children. Which ice cream shop is it better for her to visit if she does not want her children to fight over who has more ice cream?

", "shuffleChoices": false, "matrix": ["2", "0"], "variableReplacements": [], "marks": 0, "scripts": {}, "showCorrectAnswer": true, "displayType": "radiogroup", "distractors": ["", ""]}], "ungrouped_variables": ["meanab", "meana", "modea", "mediana", "meanb", "modeb", "medianb", "rangea", "rangeb", "suma", "sumb"], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Given two distributions, calculate the measures of average and spread and make some decisions based on the results.

"}, "preamble": {"css": "", "js": ""}, "advice": "

We denote Sweet Heaven as $s$ and Tasty Hell as $t$.

\n

#### a)

\n

We are going to start with completing the column for Sweet Heaven.

\n

First, we need to find the sum of weights of all the scoops:

\n

\\\begin{align} \\sum s &= \\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{suma} \\text{.} \\end{align}\

\n

The total number of measurements $n$ is $10$.

\n

Therefore the mean is

\n

\\\begin{align} \\overline{s} &= \\frac{\\sum s}{n} \\\\[3pt]&= \\frac{\\var{suma}}{10} \\\\&= \\var{meana} \\text{.} \\end{align}\

\n

\n

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

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Sweet Heaven (g) $\\var{asort[0]}$ $\\var{asort[1]}$ $\\var{asort[2]}$ $\\var{asort[3]}$ $\\var{asort[4]}$ $\\var{asort[5]}$ $\\var{asort[6]}$ $\\var{asort[7]}$ $\\var{asort[8]}$ $\\var{asort[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{asort[4]}$ and $\\var{asort[5]}$:

\n

\\\displaystyle \\begin{align} \\frac{\\var{asort[4]} + \\var{asort[5]}}{2} &= \\frac{\\var{asort[4] + asort[5]}}{2} \\\\&= \\var{mediana} \\text{.} \\end{align}\

\n

\n

The mode is the value that occurs the most often in the data.

\n

To find a mode, we can look at our sorted list:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Sweet Heaven (g) $\\var{asort[0]}$ $\\var{asort[1]}$ $\\var{asort[2]}$ $\\var{asort[3]}$ $\\var{asort[4]}$ $\\var{asort[5]}$ $\\var{asort[6]}$ $\\var{asort[7]}$ $\\var{asort[8]}$ $\\var{asort[9]}$
\n

We notice that $\\var{modea}$ occurs the most times (3) and so $\\var{modea}$ is the mode.

\n

\n

The range is the difference between the highest and the lowest value in the data.

\n

To find this, we subtract the lowest value from the highest value:

\n

\$\\var{max(a)} - \\var{min(a)} = \\var{rangea} \\text{.}\$

\n

\n

So the first column is

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Sweet Heaven (g) Mean weight $\\var{meana}$ Median weight $\\var{mediana}$ Modal weight $\\var{modea}$ Range $\\var{rangea}$
\n

\n

Similarly for Tasty Hell,

\n

\\\begin{align} \\sum t &= \\var{b[0]} + \\var{b[1]} + \\var{b[2]} + \\var{b[3]} + \\var{b[4]} + \\var{b[5]} + \\var{b[6]} + \\var{b[7]} + \\var{b[8]} + \\var{b[9]} \\\\&= \\var{sumb} \\text{.} \\end{align}\

\n

The total number of measurements $n$ is $10$ again.

\n

Therefore the mean is

\n

\\\begin{align} \\overline{t} &= \\frac{\\sum t}{n} \\\\[3pt]&= \\frac{\\var{sumb}}{10} \\\\&= \\var{meanb} \\text{.} \\end{align}\

\n

\n

For median, we sort the list in order:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Tasty Hell (g) $\\var{bsort[0]}$ $\\var{bsort[1]}$ $\\var{bsort[2]}$ $\\var{bsort[3]}$ $\\var{bsort[4]}$ $\\var{bsort[5]}$ $\\var{bsort[6]}$ $\\var{bsort[7]}$ $\\var{bsort[8]}$ $\\var{bsort[9]}$
\n

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

\n

\\\displaystyle \\begin{align} \\frac{\\var{bsort[4]} + \\var{bsort[5]}}{2} &= \\frac{\\var{bsort[4] + bsort[5]}}{2} \\\\&= \\var{medianb} \\text{.} \\end{align}\

\n

\n

For mode, we look at our sorted list:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Tasty Hell (g) $\\var{bsort[0]}$ $\\var{bsort[1]}$ $\\var{bsort[2]}$ $\\var{bsort[3]}$ $\\var{bsort[4]}$ $\\var{bsort[5]}$ $\\var{bsort[6]}$ $\\var{bsort[7]}$ $\\var{bsort[8]}$ $\\var{bsort[9]}$
\n

We notice that $\\var{modeb}$ occurs the most times (2) and so $\\var{modeb}$ is the mode.

\n

\n

To find the range, we subtract the lowest value from the highest value:

\n

\$\\var{max(b)} - \\var{min(b)} = \\var{rangeb} \\text{.}\$

\n

\n

So the complete table is\u200b

\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
 Sweet Heaven (g) Tasty Hell (g) Mean weight $\\var{meana}$ $\\var{meanb}$ Median weight $\\var{mediana}$ $\\var{medianb}$ Modal weight $\\var{modea}$ $\\var{modeb}$ Range $\\var{rangea}$ $\\var{rangeb}$
\n

Let's look at the differences between the two ice cream parlours:

\n

The range of weight of Tasty Hell scoops ($\\var{rangeb}$) is far greater than that of Sweet Heaven scoops ($\\var{rangea}$).

\n

The mean weight for each shop is $\\var{meanab}$. This implies that the scoops are more-or-less the same in both shops. However, looking at the actual values as well as other measures, we can see this is not true, so the mean is not very reliable in this case.

\n

When we compare the medians ($\\var{mediana}$ and $\\var{medianb}$), we might assume that the scoops are generally lighter in Tasty Hell. This is partly true, but there were some much heavier scoops provided by this shop as well.

\n

Looking at modes ($\\var{modea}$ and $\\var{modeb}$) can be very misleading, because the modal weight for Tasty Hell is the maximum value at the same time, so it is not a reliable measure of average in this case.

\n

#### b)

\n

Alice wants her children's ice creams to be very similar.

\n

This is more likely to happen in the shop with a lower range of values.

\n

Comparing the ranges, the range of weight of Sweet Heaven scoops ($\\var{rangea}$) is far lower than that of Tasty Hell scoops ($\\var{rangeb}$), implying Sweet Heaven is more consistent with their scoops.

"}, {"name": "Relative Frequency ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "advice": "

The relative frequency of an outcome is the frequency of the outcome divided by the number of trials.

\n

#### a)

\n

We are told that $\\var{no_people}$ people were asked whether they preferred to buy free-range eggs or caged eggs in supermarkets and that $\\var{free_range}$ of these people said that they preferred to buy free-range eggs.

\n

To calculate the relative frequency of people who prefer buying free-range eggs we need the number of trials and the frequency of people who said that they preferred buying free-range eggs.

\n

So, the number of trials in this situation is the number of people who were asked the question, which is $\\var{no_people}$.

\n

The frequency of people who said that they preferred to buy free-range eggs is $\\var{free_range}$.

\n

Therefore, the relative frequency of people who prefer buying free-range eggs is

\n

\$\\frac{\\var{free_range}}{\\var{no_people}} = \\var{dpformat({free_range/no_people}, 2)} \\; (\\text{rounded to 2 decimal places}). \$

\n

#### b)

\n

We are told that the relative frequency of a student being taller than $150$ cm is $\\var{rel_freq}$.

\n

Here, we must use the formula for relative frequency in reverse in order to estimate the number of students in the class who are taller than $150$ cm.

\n

As we are using relative frequency to calculate this number, our answer may not be completely accurate, therefore our answer will be an estimate of the actual number.

\n

If we let $n$ denote the number of students in the class who are taller than $150$ cm and if there are $\\var{no_students}$ students in the class then

\n

\\\begin{align} \\frac{n}{\\var{no_students}} &= \\var{rel_freq}\\\\ n &= \\var{rel_freq} \\times \\var{no_students}\\\\ &= \\var{{rel_freq}*{no_students}}. \\end{align} \

\n

As $n$ represents a number of people we must round our value of $n$ to the nearest integer.

\n

So, the estimated number of students in the class who are taller than $150$ cm is $\\var{dpformat({rel_freq}*{no_students},0)}$.

\n

#### c)

\n

\n

i)

\n

Using the frequency table given in the question, we can calculate the sample size of the survey by adding together the frequencies of each of the different types of pets.

\n

So, the sample size of the survey is

\n

\$\\var{dog}+\\var{cat}+\\var{hamster}+\\var{parrot} = \\var{{dog}+{cat}+{hamster}+{parrot}}. \$

\n

ii)

\n

To calculate the relative frequency of a person having a dog as a pet, we divide the frequency of people in the survey who had a dog as a pet by the sample size of the survey.

\n

So, the relative frequency is

\n

\$\\frac{\\var{dog}}{\\var{n}} = \\var{dpformat({dog/n}, 2)} \\; (\\text{rounded to 2 decimal places}). \$

\n

", "statement": "

The relative frequency of an outcome is the frequency of the outcome divided by the number of trials.

", "variables": {"dog": {"name": "dog", "group": "Ungrouped variables", "templateType": "anything", "description": "

Frequency of dog in part c

", "definition": "random(10..50)"}, "free_range": {"name": "free_range", "group": "Ungrouped variables", "templateType": "anything", "description": "

Number of people who prefer free-range eggs in part a)

", "definition": "random(10..40)"}, "cat": {"name": "cat", "group": "Ungrouped variables", "templateType": "anything", "description": "

Frequency of cat in part c.

", "definition": "random(10..50 except dog)"}, "parrot": {"name": "parrot", "group": "Ungrouped variables", "templateType": "anything", "description": "

Frequency of guinea pig in part c.

", "definition": "random(10..50 except dog except cat except hamster)"}, "rel_freq": {"name": "rel_freq", "group": "Ungrouped variables", "templateType": "anything", "description": "

Relative frequency for part b

", "definition": "random(0.1..0.9 # 0.01)"}, "n": {"name": "n", "group": "Ungrouped variables", "templateType": "anything", "description": "

Sample size for part c

", "definition": "dog+cat+hamster+parrot"}, "no_students": {"name": "no_students", "group": "Ungrouped variables", "templateType": "anything", "description": "

Number of students in the class for part b

", "definition": "random(20..40 #10)"}, "no_people": {"name": "no_people", "group": "Ungrouped variables", "templateType": "anything", "description": "

Number of people asked in part a)

", "definition": "random(50..150 #10)"}, "hamster": {"name": "hamster", "group": "Ungrouped variables", "templateType": "anything", "description": "

Frequency of hamster in part c

", "definition": "random(10..40 except dog except cat) "}}, "tags": ["Experimental Probability", "Relative Frequency", "taxonomy"], "ungrouped_variables": ["no_people", "free_range", "no_students", "rel_freq", "dog", "cat", "hamster", "parrot", "n"], "functions": {}, "preamble": {"js": "", "css": ""}, "type": "question", "variable_groups": [], "rulesets": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "metadata": {"description": "

Calculate relative frequencies in a variety of scenarios.

", "licence": "Creative Commons Attribution 4.0 International"}, "parts": [{"notationStyles": ["plain", "en", "si-en"], "precisionPartialCredit": 0, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerStyle": "plain", "precision": "2", "scripts": {}, "maxValue": "{free_range}/{no_people}", "prompt": "

$\\var{no_people}$ people were asked whether they preferred to buy free-range eggs or caged eggs in supermarkets. $\\var{free_range}$ people said that they preferred to buy free-range eggs. What is the relative frequency of people who prefer buying free-range eggs? Give your answer as a decimal, to $2$ decimal places.

\n

", "marks": 1, "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "correctAnswerFraction": false, "minValue": "{free_range}/{no_people}", "precisionType": "dp", "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": true, "showFeedbackIcon": true, "precisionMessage": "

You must give your answer as a decimal to 2 decimal places.

"}, {"notationStyles": ["plain", "en", "si-en"], "precisionPartialCredit": 0, "strictPrecision": false, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerStyle": "plain", "precision": 0, "scripts": {}, "maxValue": "{no_students}*{rel_freq}", "prompt": "

The heights of a class of students were measured. The relative frequency of a student being taller than $150$ cm is known to be $\\var{rel_freq}$. If there are $\\var{no_students}$ students in the class, estimate the number of students who are taller than $150$ cm.

", "marks": 1, "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "correctAnswerFraction": false, "minValue": "{no_students}*{rel_freq}", "precisionType": "dp", "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": true, "showFeedbackIcon": true, "precisionMessage": "

Round your answer to the nearest integer.

"}, {"scripts": {}, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "minValue": "{dog}+{cat}+{hamster}+{parrot}", "correctAnswerFraction": false, "allowFractions": false, "correctAnswerStyle": "plain", "showFeedbackIcon": true, "scripts": {}, "maxValue": "{dog}+{cat}+{hamster}+{parrot}", "showCorrectAnswer": true, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "precisionPartialCredit": 0, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "minValue": "{dog}/({dog}+{cat}+{hamster}+{parrot})", "allowFractions": false, "correctAnswerStyle": "plain", "precisionType": "dp", "scripts": {}, "maxValue": "{dog}/({dog}+{cat}+{hamster}+{parrot})", "showCorrectAnswer": true, "precision": "2", "type": "numberentry", "showPrecisionHint": true, "marks": 1, "showFeedbackIcon": true, "precisionMessage": "

Round your answer to 2 decimal places.

"}], "type": "gapfill", "prompt": "

A survey was conducted to find out what type of pet is the most common. The results are given in the table below.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Type of Pet Frequency Dog $\\var{dog}$ Cat $\\var{cat}$ Hamster $\\var{hamster}$ Parrot \n$\\var{parrot}$\n
\n

\n

i)

\n

What was the sample size for the survey?

\n

[[0]]

\n

ii)

\n

What is the relative frequency of a person having a dog as a pet? Give your answer as a decimal, to $2$ decimal places.

\n

[[1]]

\n

", "variableReplacementStrategy": "originalfirst", "marks": 0, "variableReplacements": [], "showFeedbackIcon": true}]}, {"name": "Calculating Expected Values given a table of probabilities", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "type": "question", "tags": ["Dice", "dice", "Expected values", "Expected Values", "Experimental Probability", "experimental probability", "Experimental probability", "Probability", "probability", "relative frequency", "Relative Frequency", "taxonomy", "Theoretical Probability", "theoretical probability"], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"SW": {"templateType": "anything", "name": "SW", "description": "

Probability someone goes to see Star Wars

", "definition": "random(0.4..0.51 #0.05)", "group": "Ungrouped variables"}, "Avatar": {"templateType": "anything", "name": "Avatar", "description": "

Probability someone sees Avatar

", "definition": "random(0.2..0.31 #0.05)", "group": "Ungrouped variables"}, "NYSM": {"templateType": "anything", "name": "NYSM", "description": "

Probability someone goes to see Now you see me

", "definition": "(1-(Avatar+SW))*3/5", "group": "Ungrouped variables"}, "TIJ": {"templateType": "anything", "name": "TIJ", "description": "

Probability someone goes to see the Italian Job

", "definition": "1-(Avatar+SW+NYSM)", "group": "Ungrouped variables"}, "no_people": {"templateType": "anything", "name": "no_people", "description": "

Number of people who see a movie.

", "definition": "random(100..180 #20)", "group": "Ungrouped variables"}}, "functions": {}, "statement": "

There are four films being shown in a cinema on a particular day.

\n

The probability that a person buys a ticket to see each film, denoted $P(\\text{Film})$, is given in the table below.

\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
 Film $P(\\text{Film})$ Genre Forgotten Game $\\var{Avatar}$ Sci-Fi The Diamond Valley $\\var{SW}$ Sci-Fi School of Return $\\var{NYSM}$ Thriller The Silk's Nobody $\\var{TIJ}$ Crime
\n

$\\var{no_people}$ people each buy a ticket at the cinema to see a film of their own choosing during the day.

", "variable_groups": [], "parts": [{"correctAnswerFraction": false, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "maxValue": "{no_people}*{Avatar}", "showFeedbackIcon": true, "prompt": "

How many of these people would you expect to have bought tickets to see Forgotten Game?

", "minValue": "{no_people}*{Avatar}", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"correctAnswerFraction": false, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "maxValue": "{no_people}*({Avatar}+{SW})", "showFeedbackIcon": true, "prompt": "

How many of these people would you expect to have bought tickets to see a Sci-Fi film?

", "minValue": "{no_people}*({Avatar}+{SW})", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "ungrouped_variables": ["Avatar", "SW", "NYSM", "TIJ", "no_people"], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

This question assesses the students ability to find the expected number of times an event occurs given the probability of the event occurring for a single trial and the total number of trials.

"}, "preamble": {"css": "", "js": ""}, "advice": "

If we are given the probability of an event occurring in a single trial then we can calculate the expected number of times that this event would occur in a larger number of trials.

\n

To do this, we multiply the probability of the event occurring in a single trial by the total number of trials:

\n

\$\\text{Expected number of times an event occurs} = \\text{Probability of event} \\times \\text{Number of trials}.\$

\n

We are given the probabilities that someone buys a ticket to see each film in the table below.

\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
 Film $P(\\text{Film})$ Genre Forgotten Game $\\var{Avatar}$ Sci-Fi The Diamond Valley $\\var{SW}$ Sci-Fi School of Return $\\var{NYSM}$ Thriller The Silk's Nobody $\\var{TIJ}$ Crime
\n

We are also told that $\\var{no_people}$ people each buy a ticket at the cinema to see a film of their own choosing during this day.

\n

#### a)

\n

To calculate the expected number of people who bought tickets to see one of these films we multiply the probability that a person buys a ticket for that film by how many people bought tickets for a film at the cinema.

\n

So the expected number of people who bought tickets to see Forgotten Game is

\n

\$\\var{Avatar} \\times \\var{no_people} = \\var{{Avatar}*{no_people}}. \$

\n

#### b)

\n

We are now asked to calculate the expected number of people who bought tickets to see a Sci-Fi film.

\n

From the table above we can see that there are two films which belong to the Sci-Fi genre: Forgotten Game and The Diamond Valley.

\n

Firstly, we need to calculate the probability that a person buys a ticket to see a Sci-Fi film, which we will denote $P(\\text{Sci-Fi})$.

\n

Since the probability that a person buys a ticket to see each film is different, it would be incorrect to say that the probability that a person buys a ticket to see a Sci-Fi film is

\n

\$\\displaystyle\\frac{2}{4} = \\displaystyle\\frac{1}{2}.\$

\n

Instead we must recognise that the probability that a person buys a ticket to see a Sci-Fi film is the probability that a person buys a ticket to see either Forgotten or The Diamond Valley.

\n

Therefore to calculate this probability, we add the probabilities of a person buying a ticket to see each of these films:

\n

\\\begin{align} P(\\text{Sci-Fi}) &= P(\\text{Forgotten Game})+P(\\text{The Diamond Valley})\\\\ &= \\var{Avatar}+\\var{SW}\\\\ &= \\var{Avatar+SW}. \\end{align} \

\n

Then the expected number of people who bought tickets to see a Sci-Fi film is

\n

\$\\var{Avatar+SW} \\times \\var{no_people} = \\var{({Avatar+SW})*{no_people}}. \$

\n

"}]}], "percentPass": 0, "timing": {"allowPause": true, "timedwarning": {"action": "none", "message": ""}, "timeout": {"action": "none", "message": ""}}, "duration": 0, "showQuestionGroupNames": false, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}, {"name": "Ollie Bartlett", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3647/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}