// Numbas version: exam_results_page_options {"name": "Two sample Z-test on proportions", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Two sample Z-test on proportions", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "

In 1990, of \$$\\var{n1}\$$ men between the ages of 20 and 34 years old, \$$\\var{prop1}\$$ were found to be overweight.

\n

Whereas, in 2010, of \$$\\var{n2}\$$ men between the ages of 20 and 34 years old, \$$\\var{prop2}\$$ were found to be overweight.

\n

Does the data provide sufficient evidence to conclude that for men between the ages of 20 and 34 years old, a higher percentage were overweight in 2010 than twenty years earlier?

\n

\n

\$$H_0:\$$  \$$p_1=p_2\$$.

\n

\$$H_1:\$$ \$$p_1 \\le p_2\$$.

\n

\n

Given a sample of size \$$n\$$ recall:

\n

the formula for the sample proportion:    \$$\\overline{p}=\\frac{{x}}{n}\$$ where \$$x\$$ is the number of observations

\n

\$$p_1=\\frac{\\var{prop1}}{\\var{n1}}\$$         \$$p_2=\\frac{\\var{prop2}}{\\var{n2}}\$$

\n

the pooled proportion \$$\\hat{p}=\\frac{x_1+x_2}{n_1+n_2}=\\frac{\\var{prop1}+\\var{prop2}}{\\var{n1}+\\var{n2}}=\\var{pooled_p}\$$

\n

the formula for the Z-statistic:   \$$Z=\\frac{{p_1}-{p_2}}{\\sqrt{{\\hat{p}(1-\\hat{p})}(\\frac{1}{n_1}+\\frac{1}{n_2})}}\$$

\n

\$$Z=\\frac{\\var{p1}-\\var{p2}}{\\sqrt{{(\\var{pooled_p})(\\simplify{1-{pooled_p}})(\\frac{1}{\\var{n1}}+\\frac{1}{\\var{n2}})}}}=\\var{test_statistic}\$$

\n

The Z-table values for a one-tailed test are given below.

\n

significance              10%                    5%                   1%

\n

limits                \$$-1.28\$$             \$$-1.65\$$             \$$-1.96\$$

\n

Compare the test statistic with the Z-table values and choose your conclusion.

", "rulesets": {}, "extensions": ["stats"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"p2": {"name": "p2", "group": "Ungrouped variables", "definition": "precround({prop2}/{n2},2)", "description": "", "templateType": "anything", "can_override": false}, "prop2": {"name": "prop2", "group": "Ungrouped variables", "definition": "random(120 .. 150#5)", "description": "", "templateType": "randrange", "can_override": false}, "pooled_p": {"name": "pooled_p", "group": "Ungrouped variables", "definition": "precround(({prop1}+{prop2})/({n1}+{n2}),2)", "description": "", "templateType": "anything", "can_override": false}, "prop1": {"name": "prop1", "group": "Ungrouped variables", "definition": "random(100 .. 125#1)", "description": "", "templateType": "randrange", "can_override": false}, "test_statistic": {"name": "test_statistic", "group": "Ungrouped variables", "definition": "precround((p1-p2)/sqrt(pooled_p*(1-pooled_p)*(1/{n1}+1/{n2})),2)", "description": "", "templateType": "anything", "can_override": false}, "n1": {"name": "n1", "group": "Ungrouped variables", "definition": "random(360 .. 400#10)", "description": "", "templateType": "randrange", "can_override": true}, "Z90": {"name": "Z90", "group": "Ungrouped variables", "definition": "1.28", "description": "", "templateType": "number", "can_override": false}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "precround({prop1}/{n1},2)", "description": "", "templateType": "anything", "can_override": false}, "n2": {"name": "n2", "group": "Ungrouped variables", "definition": "random(420 .. 470#10)", "description": "", "templateType": "randrange", "can_override": false}, "Z95": {"name": "Z95", "group": "Ungrouped variables", "definition": "1.65", "description": "", "templateType": "number", "can_override": false}, "atvalue": {"name": "atvalue", "group": "Ungrouped variables", "definition": "abs(test_statistic)", "description": "", "templateType": "anything", "can_override": false}, "Z99": {"name": "Z99", "group": "Ungrouped variables", "definition": "1.96", "description": "", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "if(atvalue>=Z99,[1,0,0,0],if(atvalue>=Z95,[0,1,0,0],if(atvalue>=Z90,[0,0,1,0],[0,0,0,1])))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["Z95", "Z90", "test_statistic", "n1", "p1", "prop1", "n2", "prop2", "p2", "pooled_p", "atvalue", "Z99", "v"], "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": "

Enter the value of the pooled proportion: \$$p=\$$ [[1]]

\n

Enter the value for the appropriate test statistic: Z = [[0]]

\n

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "sample_mean_2", "part": "p0", "must_go_first": true}, {"variable": "sample_stdev_2", "part": "p0", "must_go_first": true}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "test_statistic", "maxValue": "test_statistic", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{pooled_p}", "maxValue": "{pooled_p}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "test_statistic", "part": "p0g0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Having compared your test statistic with the table values for a one-tailed Z-test, select one of the foll owing conclusions that best describes your conclusion.

", "minMarks": "2", "maxMarks": "2", "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": "1", "showCellAnswerState": true, "choices": ["

Reject the Null Hypothesis and conclude conclude that the proportion of men in 2010 that are overweight is greater than the proportion of men in 1990 that were overweight.

", "

Reject the Null Hypothesis at the 5% significance level but accept the Null Hypothesis at the 1% significance level and conclude that there is no significant difference between the proportion of men that are overweight in 2010 and the proportion of men that were overweight in 1990.

", "

Reject the Null Hypothesis at the 10% significance level but accept the Null Hypothesis at the 5% significance level and conclude that there is no significant difference between the proportion of men that are overweight in 2010 and the proportion of men that were overweight in 1990.

", "

Accept the Null Hypothesis at the 10% significance level and conclude that there is no significant difference between the proportion of men that are overweight in 2010 and the proportion of men that were overweight in 1990.

"], "matrix": "v"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}]}