// Numbas version: finer_feedback_settings {"name": "Probability sample mean is within d of the population mean", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"thismany1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "generateprobs[1]", "name": "thismany1", "description": ""}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(prob1 > 0.95,[1,0,0,0], prob2>0.95,[0,1,0,0],prob3>0.95,[0,0,1,0],[0,0,0,1])", "name": "mm", "description": ""}, "message": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(prob1>=0.95, \"We take a sample of size \"+ thismany1+ \" as the probability in this case is $\\\\ge 0.95.$\",\nprob2>=0.95, \"We take a sample of size \"+ thismany2+ \" as the probability in this case is $\\\\ge 0.95.$\", \nprob3>=0.95, \"We take a sample of size \"+ thismany3+ \" as the probability in this case is $\\\\ge 0.95$.\",\n \"None of the probabilities is $\\\\ge 0.95$ so we need to take a larger sample.\")", "name": "message", "description": ""}, "popstdev": {"templateType": "anything", "group": "Ungrouped variables", "definition": "generateprobs[0]", "name": "popstdev", "description": ""}, "prob3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-2*normalcdf(-thismany3^0.5*thismuch/popstdev,0,1),3)", "name": "prob3", "description": ""}, "thismany3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "generateprobs[3]", "name": "thismany3", "description": ""}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-2*normalcdf(-thismany1^0.5*thismuch/popstdev,0,1),3)", "name": "prob1", "description": ""}, "these": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('petrol stations')", "name": "these", "description": ""}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('price')", "name": "this", "description": ""}, "thismuch": {"templateType": "anything", "group": "Ungrouped variables", "definition": "generateprobs[5]", "name": "thismuch", "description": ""}, "thismany2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "generateprobs[2]", "name": "thismany2", "description": ""}, "prob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-2*normalcdf(-thismany2^0.5*thismuch/popstdev,0,1),3)", "name": "prob2", "description": ""}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'pounds'", "name": "units", "description": ""}, "popmean": {"templateType": "anything", "group": "Ungrouped variables", "definition": "generateprobs[4]", "name": "popmean", "description": ""}, "that": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('unleaded petrol in the UK per litre in 2013')", "name": "that", "description": ""}, "generateprobs": {"templateType": "anything", "group": "Ungrouped variables", "definition": "satisfy(\n [popstdev,thismany1,thismany2,thismany3,popmean,thismuch],\n [random(0.08..0.12#0.02),random(15..30#5),random(40..55#5),random(80..100#10),\n random(1.25..1.35#0.01),random(0.02..0.06)],\n [precround(1-2*normalcdf(-thismany1^0.5*thismuch/popstdev,0,1),3)<>0.95,\n precround(1-2*normalcdf(-thismany2^0.5*thismuch/popstdev,0,1),3)<>0.95,\n precround(1-2*normalcdf(-thismany3^0.5*thismuch/popstdev,0,1),3)<>0.95],\n 1000\n )\n \n \n ", "name": "generateprobs", "description": ""}}, "ungrouped_variables": ["these", "generateprobs", "that", "this", "popstdev", "thismany2", "mm", "thismany1", "thismany3", "units", "popmean", "message", "thismuch", "prob2", "prob3", "prob1"], "rulesets": {}, "name": "Probability sample mean is within d of the population mean", "functions": {}, "showQuestionGroupNames": false, "parts": [{"showCorrectAnswer": true, "correctAnswerFraction": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "prob1+0.001", "minValue": "prob1-0.001", "prompt": "

What is the probability that the mean {this} taken from a sample of $\\var{thismany1}$ {these} is within $\\var{thismuch}$ {units} of the population mean?

\n

Input the probability to 3 decimal places.

", "marks": 1}, {"showCorrectAnswer": true, "correctAnswerFraction": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "prob2+0.001", "minValue": "prob2-0.001", "prompt": "

What is the probability that the mean {this} taken from a sample of $\\var{thismany2}$ {these} is within $\\var{thismuch}$ {units} of the population mean?

\n

Input the probability to 3 decimal places.

", "marks": 1}, {"showCorrectAnswer": true, "correctAnswerFraction": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "maxValue": "prob3+0.001", "minValue": "prob3-0.001", "prompt": "

What is the probability that the mean {this} taken from a sample of $\\var{thismany3}$ {these} is within $\\var{thismuch}$ {units} of the population mean?

\n

Input the probability to 3 decimal places.

", "marks": 1}, {"displayType": "radiogroup", "choices": ["

{thismany1}

", "

{thismany2}

", "

{thismany3}

", "

Increase the sample size

"], "displayColumns": 0, "prompt": "

Given the probabilities you have found, what sample size would you recommend to have at least a $0.95$ probability that the sample mean is within $\\var{thismuch}$ {units} of the population mean?

", "distractors": ["", "", "", ""], "shuffleChoices": false, "scripts": {}, "maxMarks": 0, "type": "1_n_2", "minMarks": 0, "showCorrectAnswer": true, "matrix": "mm", "marks": 0}], "statement": "

The population mean of the {this} of {that} is $\\var{popmean}$ {units} with population standard deviation $\\var{popstdev}$ {units}.

\n

Find the following probabilities.

\n

Input all probabilities to 3 decimal places.

\n

", "tags": ["ACE2013", "checked2015", "mean", "mean ", "normal distribution", "Normal distribution", "Probability", "probability", "sampling", "satisfy", "standard deviation", "statistics", "z score"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

There are variables set up to set up different scenarios. Present one is price of unleaded petrol in the UK.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given data on population mean and population standard deviation and three sampling sizes, calculate the probabilities that the sample means are within a specified distance from the population mean.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

a)

\n

Let $M$ be the mean price of the sample

\n

Converting to $N(0,1)$ we see that we require the probability that if $\\displaystyle Z=\\frac{|M-\\var{popmean}|}{\\frac{\\var{popstdev}}{\\sqrt{\\var{thismany1}}}}$ then we require the probability that \\[\\frac{-\\var{thismuch}}{\\frac{\\var{popstdev}}{\\sqrt{\\var{thismany1}}}} \\lt Z \\lt \\frac{\\var{thismuch}}{\\frac{\\var{popstdev}}{\\sqrt{\\var{thismany1}}}} \\implies \\var{-thismany1^0.5*thismuch/popstdev}\\lt Z \\lt \\var{thismany1^0.5*thismuch/popstdev}\\].

\n

The probability that $Z \\lt \\var{-thismany1^0.5*thismuch/popstdev}$ is $p=\\var{normalcdf(-thismany1^0.5*thismuch/popstdev,0,1)}$.

\n

Hence the probability we want is $P_1=1-2p=\\var{prob1}$ to 3 decimal places.

\n

b)

\n

Similarly we have for sample size $\\var{thismany2}$ we want the probability that:

\n

\\[\\frac{-\\var{thismuch}}{\\frac{\\var{popstdev}}{\\sqrt{\\var{thismany2}}}} \\lt Z \\lt \\frac{\\var{thismuch}}{\\frac{\\var{popstdev}}{\\sqrt{\\var{thismany2}}}} \\implies \\var{-thismany2^0.5*thismuch/popstdev}\\lt Z \\lt \\var{thismany2^0.5*thismuch/popstdev}\\].

\n

The probability that $Z \\lt \\var{-thismany2^0.5*thismuch/popstdev}$ is $p=\\var{normalcdf(-thismany2^0.5*thismuch/popstdev,0,1)}$.

\n

Hence the probability we want is $P_2=1-2p=\\var{prob2}$ to 3 decimal places.

\n

c)

\n

For sample size $\\var{thismany3}$ we want the probability that:

\n

\\[\\frac{-\\var{thismuch}}{\\frac{\\var{popstdev}}{\\sqrt{\\var{thismany3}}}} \\lt Z \\lt \\frac{\\var{thismuch}}{\\frac{\\var{popstdev}}{\\sqrt{\\var{thismany3}}}} \\implies \\var{-thismany3^0.5*thismuch/popstdev}\\lt Z \\lt \\var{thismany3^0.5*thismuch/popstdev}\\].

\n

The probability that $Z \\lt \\var{-thismany3^0.5*thismuch/popstdev}$ is $p=\\var{normalcdf(-thismany3^0.5*thismuch/popstdev,0,1)}$.

\n

Hence the probability we want is $P_3=1-2p=\\var{prob3}$ to 3 decimal places.

\n

d) {message}

", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}