// Numbas version: exam_results_page_options {"name": "Chi-square goodness of fit test", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "parts": [{"variableReplacementStrategy": "originalfirst", "marks": 0, "prompt": "

Enter the expected blood type frequencies:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Blood TypeOABAB
Expected frequencies[[0]][[1]][[2]][[3]]
\n

Enter the value for the appropriate test statistic: \\(\\chi^2\\) = [[4]]

\n

", "type": "gapfill", "gaps": [{"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "maxValue": "2.5*{p1}", "showFeedbackIcon": true, "minValue": "2.5*{p1}", "variableReplacements": [], "allowFractions": false}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "maxValue": "2.5*{p2}", "showFeedbackIcon": true, "minValue": "2.5*{p2}", "variableReplacements": [], "allowFractions": false}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "maxValue": "2.5*{p3}", "showFeedbackIcon": true, "minValue": "2.5*{p3}", "variableReplacements": [], "allowFractions": false}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "maxValue": "2.5*{p4}", "showFeedbackIcon": true, "minValue": "2.5*{p4}", "variableReplacements": [], "allowFractions": false}, {"variableReplacementStrategy": "originalfirst", "allowFractions": false, "marks": "2", "precision": "2", "showPrecisionHint": true, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReducedPC": 0, "strictPrecision": false, "notationStyles": ["plain", "en", "si-en"], "precisionPartialCredit": 0, "scripts": {}, "type": "numberentry", "precisionType": "dp", "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "minValue": "test_statistic", "maxValue": "test_statistic", "variableReplacements": [], "mustBeReduced": false}], "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}}, {"choices": ["

Reject the Null hypothesis that the island community share the same blood type proportions in their population as the people in the general population.

", "

Reject the Null Hypothesis at the 5% significance level but accept the Null Hypothesis at the 2% significance level and conclude that the island community share the same blood type proportions in their population as the people in the general population.

", "

Reject the Null Hypothesis at the 10% significance level but accept the Null Hypothesis at the 5% significance level and conclude that the island community share the same blood type proportions in their population as the people in the general population.

", "

Accept the Null Hypothesis at the 10% significance level and conclude that the island community share the same blood type proportions in their population as the people in the general population.

"], "maxMarks": "3", "marks": 0, "shuffleChoices": false, "variableReplacementStrategy": "originalfirst", "prompt": "

Having compared your test statistic with the table values for a two-tailed \\(\\chi^2\\)-test-test, select one of the following answers that best describes your conclusion.

", "displayColumns": "1", "showCorrectAnswer": true, "minMarks": "3", "displayType": "radiogroup", "type": "1_n_2", "matrix": "decision_matrix", "showFeedbackIcon": true, "variableReplacements": [{"variable": "", "part": "p0", "must_go_first": false}], "scripts": {}}], "rulesets": {}, "tags": [], "ungrouped_variables": ["test_statistic", "Chi_95", "scenario", "decision_matrix", "Chi_98", "Chi_90", "n2", "n3", "n1", "n4", "p1", "p2", "p3", "p4", "total", "e1", "e2", "e3", "e4", "k", "n"], "statement": "

The proportion of blood types O, A, B, AB in the general population of a particular country are known to be in the ratio \\(\\var{p1}:\\var{p2}:\\var{p3}:\\var{p4}\\) respectively.

\n

A research team, tested the residents of a small island community in the country and obtained the following data.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Blood TypeOABAB
Observed Frequency\\(\\simplify{{n1}}\\)\\(\\simplify{{n2}}\\)\\(\\simplify{{n3}}\\)\\(\\simplify{{n4}}\\)
\n


Test the hypothesis that the island community share the same blood type proportions in their population as the people in the general population.

\n

", "functions": {}, "preamble": {"css": "", "js": ""}, "metadata": {"licence": "Creative Commons Attribution-NonCommercial 4.0 International", "description": ""}, "type": "question", "variables": {"k": {"group": "Ungrouped variables", "description": "", "definition": "random(0..20#10)", "name": "k", "templateType": "randrange"}, "p1": {"group": "Ungrouped variables", "description": "", "definition": "random(45..55#1)", "name": "p1", "templateType": "randrange"}, "e4": {"group": "Ungrouped variables", "description": "", "definition": "2.5*{p4}", "name": "e4", "templateType": "anything"}, "e2": {"group": "Ungrouped variables", "description": "", "definition": "2.5*{p2}", "name": "e2", "templateType": "anything"}, "p2": {"group": "Ungrouped variables", "description": "", "definition": "random(28..36#1)", "name": "p2", "templateType": "randrange"}, "n1": {"group": "Ungrouped variables", "description": "", "definition": "random(120..140#1)", "name": "n1", "templateType": "randrange"}, "p3": {"group": "Ungrouped variables", "description": "", "definition": "random(4..8#1)", "name": "p3", "templateType": "randrange"}, "Chi_95": {"group": "Ungrouped variables", "description": "", "definition": "9.348", "name": "Chi_95", "templateType": "number"}, "n4": {"group": "Ungrouped variables", "description": "", "definition": "250-{n1}-{n2}-{n3}+{k}", "name": "n4", "templateType": "anything"}, "n2": {"group": "Ungrouped variables", "description": "", "definition": "random(70..93#1)", "name": "n2", "templateType": "randrange"}, "e3": {"group": "Ungrouped variables", "description": "", "definition": "2.5*{p3}", "name": "e3", "templateType": "anything"}, "total": {"group": "Ungrouped variables", "description": "", "definition": "{n1}+{n2}+{n3}+{n4}", "name": "total", "templateType": "anything"}, "test_statistic": {"group": "Ungrouped variables", "description": "", "definition": "precround(((n1-2.5*p1)^2/(2.5*p1)+(n2-2.5*p2)^2/(2.5*p2)+(n3-2.5*p3)^2/(2.5*p3)+(n4-2.5*p4)^2/(2.5*p4)),2)", "name": "test_statistic", "templateType": "anything"}, "p4": {"group": "Ungrouped variables", "description": "", "definition": "100-{p1}-{p2}-{p3}", "name": "p4", "templateType": "anything"}, "Chi_98": {"group": "Ungrouped variables", "description": "", "definition": "11.345", "name": "Chi_98", "templateType": "number"}, "Chi_90": {"group": "Ungrouped variables", "description": "", "definition": "7.815", "name": "Chi_90", "templateType": "number"}, "n3": {"group": "Ungrouped variables", "description": "", "definition": "{n}+{k}/2", "name": "n3", "templateType": "anything"}, "scenario": {"group": "Ungrouped variables", "description": "", "definition": "sum(map(abs(test_statistic)\\(H_0:\\) The island community share the same blood type proportions in their population as the people in the general population.

\n

\\(H_1:\\) The island community do not share the same blood type proportions in their population as the people in the general population.

\n

\n

The population of the island \\(=\\) the total number of observations \\(=\\var{n1}+\\var{n2}+\\var{n3}+\\var{n4}=\\simplify{{n1}+{n2}+{n3}+{n4}}\\)

\n

\\(\\var{p1}\\)% of the population have type O we therefore expect \\(\\left(\\frac{\\var{p1}}{100}\\right)*(\\var{total})=\\var{e1}\\) people to have type O.

\n

\\(\\var{p2}\\)% of the population have type A we therefore expect \\(\\left(\\frac{\\var{p2}}{100}\\right)*(\\var{total})=\\var{e2}\\) people to have type A.

\n

\\(\\var{p3}\\)% of the population have type B we therefore expect \\(\\left(\\frac{\\var{p3}}{100}\\right)*(\\var{total})=\\var{e3}\\) people to have type B.

\n

\\(\\var{p4}\\)% of the population have type O we therefore expect \\(\\left(\\frac{\\var{p4}}{100}\\right)*(\\var{total})=\\var{e4}\\) people to have type AB.

\n

\n

The formula for the t-statistic:  

\n

\\(\\chi^2=\\sum{\\frac{(obs-exp)^2}{exp}}\\)

\n

\\(\\chi^2=\\frac{(\\var{n1}-\\var{e1})^2}{\\var{e1}}+\\frac{(\\var{n2}-\\var{e2})^2}{\\var{e2}}+\\frac{(\\var{n3}-\\var{e3})^2}{\\var{e3}}+\\frac{(\\var{n4}-\\var{e4})^2}{\\var{e4}}=\\var{test_statistic}\\)

\n

We only need to consider the upper value.

\n

The \\(\\chi^2\\)-table values will be for a two-tailed test and will have \\(4-1=3\\) degrees of freedom. We only need to consider the upper value, looking this up gives:

\n

\\(\\begin{array}{r|rrrr}&0.10&0.05&0.02\\\\\\hline3&\\var{Chi_90}&\\var{Chi_95}&\\var{Chi_98}\\end{array}\\)

\n

Compare the test statistic with the \\(\\chi^2\\)-table values and choose your conclusion.

", "extensions": ["stats"], "name": "Chi-square goodness of fit test", "variablesTest": {"condition": "", "maxRuns": 100}, "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/"}]}