// Numbas version: finer_feedback_settings {"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": [{"tags": [], "functions": {}, "variables": {"pooled_p": {"group": "Ungrouped variables", "description": "", "definition": "precround(({prop1}+{prop2})/({n1}+{n2}),2)", "name": "pooled_p", "templateType": "anything"}, "Z90": {"group": "Ungrouped variables", "description": "", "definition": "1.28", "name": "Z90", "templateType": "number"}, "n1": {"group": "Ungrouped variables", "description": "", "definition": "random(360..450#10)", "name": "n1", "templateType": "randrange"}, "prop2": {"group": "Ungrouped variables", "description": "", "definition": "random(120..180#5)", "name": "prop2", "templateType": "randrange"}, "Z99": {"group": "Ungrouped variables", "description": "", "definition": "2.33", "name": "Z99", "templateType": "number"}, "prop1": {"group": "Ungrouped variables", "description": "", "definition": "random(100..125#1)", "name": "prop1", "templateType": "randrange"}, "Z95": {"group": "Ungrouped variables", "description": "", "definition": "1.65", "name": "Z95", "templateType": "number"}, "n2": {"group": "Ungrouped variables", "description": "", "definition": "random(360..520#10)", "name": "n2", "templateType": "randrange"}, "p1": {"group": "Ungrouped variables", "description": "", "definition": "precround({prop1}/{n1},2)", "name": "p1", "templateType": "anything"}, "test_statistic": {"group": "Ungrouped variables", "description": "", "definition": "precround((p1-p2)/sqrt(pooled_p*(1-pooled_p)*(1/{n1}+1/{n2})),2)", "name": "test_statistic", "templateType": "anything"}, "scenario": {"group": "Ungrouped variables", "description": "", "definition": "sum(map(abs(test_statistic)Enter the value of the pooled proportion: \\(p=\\) [[1]]

\n

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

\n

", "type": "gapfill", "gaps": [{"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": "1", "precisionType": "dp", "precision": "2", "allowFractions": false, "showPrecisionHint": true, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReducedPC": 0, "strictPrecision": false, "notationStyles": ["plain", "en", "si-en"], "precisionPartialCredit": 0, "type": "numberentry", "maxValue": "test_statistic", "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "minValue": "test_statistic", "variableReplacements": [{"variable": "sample_mean_2", "part": "p0", "must_go_first": true}, {"variable": "sample_stdev_2", "part": "p0", "must_go_first": true}], "mustBeReduced": false}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "precisionType": "dp", "precision": "2", "allowFractions": false, "showPrecisionHint": true, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReducedPC": 0, "strictPrecision": false, "notationStyles": ["plain", "en", "si-en"], "precisionPartialCredit": 0, "type": "numberentry", "maxValue": "{pooled_p}", "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "minValue": "{pooled_p}", "variableReplacements": [], "mustBeReduced": false}], "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}}, {"variableReplacementStrategy": "originalfirst", "maxMarks": "2", "marks": 0, "shuffleChoices": false, "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.

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

", "showCorrectAnswer": true, "displayColumns": "1", "minMarks": "2", "displayType": "radiogroup", "type": "1_n_2", "matrix": "decision_matrix", "showFeedbackIcon": true, "variableReplacements": [{"variable": "test_statistic", "part": "p0g0", "must_go_first": false}], "scripts": {}}], "preamble": {"css": "", "js": ""}, "metadata": {"licence": "Creative Commons Attribution-NonCommercial 4.0 International", "description": ""}, "advice": "

\\(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\\)             \\(-2.33\\)

\n

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

", "type": "question", "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

", "variablesTest": {"condition": "", "maxRuns": 100}, "rulesets": {}, "extensions": ["stats"], "name": "Two sample Z-test on proportions", "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}