// Numbas version: exam_results_page_options {"name": "Confidence interval - marijuana survey", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Confidence interval - marijuana survey", "tags": [], "metadata": {"description": "

This question assesses learners' ability to:

- construct a confidence interval for a proportion given corresponding summarised data;

- predict the sample size required to limit the margin of error to a given value.

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "

In a recent survey, $\\var{n}$ UK adults were asked: \"Do you think the use of marijuana should be legalized?\"

\n

$\\var{percentage}\\%$ of the respondents said it should.

", "advice": "
\n
\n
\n
\n
\n
\n

For general background, see relevant textbook sections on Confidence Intervals (e.g., Chapter 5 in OpenIntro Statistics).

\n

a) The standard error for a proportion is $SE=\\sqrt{\\frac{p(1-p)}{n}}$, with $p$ the proportion (as a number between 0 and 1, not as a percentage), and $n$ the sample size.

\n

The margin of error is $MoE=z^\\star\\times SE$, with $z^\\star$ the appropriate z-value (e.g., $z^\\star = 1.96$ for a $95\\%$ confidence level).

\n

The confidence interval is: $(p-MoE, p+MoE)$.

\n

b) To limit the MoE to $1\\%$, the sample size $n$ must satisfy this equation:

\n

$1.96\\times\\sqrt{\\frac{p(1-p)}{n}}=0.01$

\n

Solving for $n$ gives the required sample size.

\n
\n
\n
\n
\n
\n
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "random(100..999)", "description": "", "templateType": "anything", "can_override": false}, "MoE_limit": {"name": "MoE_limit", "group": "Ungrouped variables", "definition": "0.01", "description": "", "templateType": "anything", "can_override": false}, "nMin": {"name": "nMin", "group": "Ungrouped variables", "definition": "ceil((p*(1-p)/(MoE_limit/1.96)^2))", "description": "", "templateType": "anything", "can_override": false}, "CI_low": {"name": "CI_low", "group": "Ungrouped variables", "definition": "precround(100*(p-1.96*se),1)", "description": "", "templateType": "anything", "can_override": false}, "percentage": {"name": "percentage", "group": "Ungrouped variables", "definition": "random(10..90)", "description": "", "templateType": "anything", "can_override": false}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "percentage/100", "description": "", "templateType": "anything", "can_override": false}, "se": {"name": "se", "group": "Ungrouped variables", "definition": "sqrt(p*(1-p)/n)", "description": "

Standard error

", "templateType": "anything", "can_override": false}, "CI_high": {"name": "CI_high", "group": "Ungrouped variables", "definition": "precround(100*(p+1.96*se),1)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["n", "percentage", "CI_low", "se", "p", "CI_high", "nMin", "MoE_limit"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Construct a $95\\%$ confidence interval for the proportion of UK adults who think marijuana should be legalized (rounding to 1 decimal place):

\n

( [[0]]% ,  [[1]]% )

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "3", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "CI_low-1", "maxValue": "CI_low+1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "3", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "CI_high-1", "maxValue": "CI_high+1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What would be the sample size required to limit the margin of error of the $95\\%$ confidence interval to $\\var{100*MoE_limit}\\%$?

", "minValue": "nMin-5", "maxValue": "nMin+10", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Mario Orsi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/427/"}]}]}], "contributors": [{"name": "Mario Orsi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/427/"}]}