// Numbas version: exam_results_page_options {"name": "Relative Frequency ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"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": {}, "name": "Relative Frequency ", "preamble": {"js": "", "css": ""}, "extensions": [], "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 PetFrequency
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}], "contributors": [{"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}]}]}], "contributors": [{"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}]}