// 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": [{"name": "Chi-square goodness of fit test", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "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

", "advice": "

\\(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.

", "rulesets": {}, "extensions": ["stats"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"p4": {"name": "p4", "group": "Ungrouped variables", "definition": "100-{p1}-{p2}-{p3}", "description": "", "templateType": "anything", "can_override": false}, "n3": {"name": "n3", "group": "Ungrouped variables", "definition": "{n}+{k}/2", "description": "", "templateType": "anything", "can_override": false}, "e2": {"name": "e2", "group": "Ungrouped variables", "definition": "{p2}*(2.50+{k}/100)", "description": "", "templateType": "anything", "can_override": false}, "test_statistic": {"name": "test_statistic", "group": "Ungrouped variables", "definition": "precround(((n1-e1)^2/(e1)+(n2-e2)^2/(e2)+(n3-e3)^2/(e3)+(n4-e4)^2/(e4)),2)", "description": "", "templateType": "anything", "can_override": false}, "e1": {"name": "e1", "group": "Ungrouped variables", "definition": "{p1}*(2.50+{k}/100)", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(10 .. 14#1)", "description": "", "templateType": "randrange", "can_override": false}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "random(45 .. 55#1)", "description": "", "templateType": "randrange", "can_override": false}, "total": {"name": "total", "group": "Ungrouped variables", "definition": "{n1}+{n2}+{n3}+{n4}", "description": "", "templateType": "anything", "can_override": false}, "k": {"name": "k", "group": "Ungrouped variables", "definition": "random(0 .. 20#10)", "description": "", "templateType": "randrange", "can_override": false}, "Chi_90": {"name": "Chi_90", "group": "Ungrouped variables", "definition": "7.815", "description": "", "templateType": "number", "can_override": false}, "e4": {"name": "e4", "group": "Ungrouped variables", "definition": "{p4}*(2.50+{k}/100)", "description": "", "templateType": "anything", "can_override": false}, "n2": {"name": "n2", "group": "Ungrouped variables", "definition": "random(70 .. 93#1)", "description": "", "templateType": "randrange", "can_override": false}, "n1": {"name": "n1", "group": "Ungrouped variables", "definition": "random(120 .. 140#1)", "description": "", "templateType": "randrange", "can_override": false}, "n4": {"name": "n4", "group": "Ungrouped variables", "definition": "250-{n1}-{n2}-{n3}+{k}", "description": "", "templateType": "anything", "can_override": false}, "Chi_98": {"name": "Chi_98", "group": "Ungrouped variables", "definition": "11.345", "description": "", "templateType": "number", "can_override": false}, "e3": {"name": "e3", "group": "Ungrouped variables", "definition": "{p3}*(2.50+{k}/100)", "description": "", "templateType": "anything", "can_override": false}, "p3": {"name": "p3", "group": "Ungrouped variables", "definition": "random(4 .. 8#1)", "description": "", "templateType": "randrange", "can_override": false}, "p2": {"name": "p2", "group": "Ungrouped variables", "definition": "random(28 .. 36#1)", "description": "", "templateType": "randrange", "can_override": false}, "Chi_95": {"name": "Chi_95", "group": "Ungrouped variables", "definition": "9.348", "description": "", "templateType": "number", "can_override": false}, "atvalue": {"name": "atvalue", "group": "Ungrouped variables", "definition": "abs(test_statistic)", "description": "", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "if(atvalue>=Chi_98,[1,0,0,0],if(atvalue>=Chi_95,[0,1,0,0],if(atvalue>=Chi_90,[0,0,1,0],[0,0,0,1])))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["test_statistic", "Chi_95", "Chi_98", "n4", "Chi_90", "n3", "p1", "p2", "n2", "p3", "n1", "p4", "total", "e1", "e2", "e3", "e4", "k", "n", "atvalue", "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 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

", "gaps": [{"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": "{e1}", "maxValue": "{e1}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": 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": "{e2}", "maxValue": "{e2}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": 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": "{e3}", "maxValue": "{e3}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": 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": "{e4}", "maxValue": "{e4}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "test_statistic", "maxValue": "test_statistic", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "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": "", "part": "p0", "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 two-tailed \\(\\chi^2\\)-test-test, select one of the following answers that best describes your conclusion.

", "minMarks": "3", "maxMarks": "3", "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": "1", "showCellAnswerState": true, "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.

"], "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/"}]}