// Numbas version: exam_results_page_options {"name": "Chi-square test: contingency tables", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Chi-square test: contingency tables", "functions": {}, "advice": "

\$$H_0:\$$ Sporting activity and age profile are independent of one another.

\n

\$$H_1:\$$ Sporting activity and age profile are not independent of one another.

\n

\n

The observed values are given below.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 \$$12\\le age<15\$$ \$$15\\le age<18\$$ \$$18\\le age<21\$$ Row Sum Very Active {n11} {n12} {n13} \$$\\simplify{{n11}+{n12}+{n13}}\$$ Active {n21} {n22} {n23} \$$\\simplify{{n21}+{n22}+{n23}}\$$ Inactive {n31} {n32} {n33} \$$\\simplify{{n31}+{n32}+{n33}}\$$ Column Sum \$$\\simplify{{n11}+{n21}+{n31}}\$$ \$$\\simplify{{n12}+{n22}+{n32}}\$$ \$$\\simplify{{n13}+{n23}+{n33}}\$$
\n

\n

The expected values can be calculated using the formula:

\n

\$$e_{i,j}=\\frac{(sum\\,of\\,row\\,i)*(sum\\,of\\,column\\,j)}{Overall\\,total\\,sum}\$$

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 \$$12\\le age<15\$$ \$$15\\le age<18\$$ \$$18\\le age<21\$$ Very Active {e11} {e12} {e13} Active {e21} {e22} {e23} Inactive {e31} {e32} {e33}
\n

The formula for the t-statistic:

\n

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

\n

\$$\\chi^2=\\frac{(\\var{n11}-\\var{e11})^2}{\\var{e11}}+\\frac{(\\var{n12}-\\var{e12})^2}{\\var{e12}}+\\frac{(\\var{n13}-\\var{e13})^2}{\\var{e13}}+\\frac{(\\var{n21}-\\var{e21})^2}{\\var{e21}}+\\frac{(\\var{n22}-\\var{e22})^2}{\\var{e22}}+\\frac{(\\var{n23}-\\var{e23})^2}{\\var{e23}}+\\frac{(\\var{n31}-\\var{e31})^2}{\\var{e31}}+\\frac{(\\var{n32}-\\var{e32})^2}{\\var{e32}}+\\frac{(\\var{n33}-\\var{e33})^2}{\\var{e33}}\$$

\n

\$$\\chi^2=\\var{test_statistic}\$$

\n

The \$$\\chi^2\$$ table values will be for a two-tailed test having \$$(r-1)*(c-1)=2*2=4\$$ degrees of freedom. We only need to consider the upper value.

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

", "variables": {"e11": {"name": "e11", "templateType": "anything", "definition": "precround(250*{r1}/690,1)", "description": "", "group": "Ungrouped variables"}, "n31": {"name": "n31", "templateType": "anything", "definition": "250-{n11}-{n21}", "description": "", "group": "Ungrouped variables"}, "r2": {"name": "r2", "templateType": "anything", "definition": "{n21}+{n22}+{n23}", "description": "", "group": "Ungrouped variables"}, "Chi_90": {"name": "Chi_90", "templateType": "number", "definition": "9.488", "description": "", "group": "Ungrouped variables"}, "n13": {"name": "n13", "templateType": "randrange", "definition": "random(75..80#1)", "description": "", "group": "Ungrouped variables"}, "test_statistic": {"name": "test_statistic", "templateType": "anything", "definition": "precround(({n11}-{e11})^2/{e11}+({n12}-{e12})^2/{e12}+({n13}-{e13})^2/{e13}+({n21}-{e21})^2/{e21}+({n22}-{e22})^2/{e22}+({n23}-{e23})^2/{e23}+({n31}-{e31})^2/{e31}+({n32}-{e32})^2/{e32}+({n33}-{e33})^2/{e33},1)", "description": "", "group": "Ungrouped variables"}, "r1": {"name": "r1", "templateType": "anything", "definition": "{n11}+{n12}+{n13}", "description": "", "group": "Ungrouped variables"}, "e13": {"name": "e13", "templateType": "anything", "definition": "precround(200*{r1}/690,1)", "description": "", "group": "Ungrouped variables"}, "e31": {"name": "e31", "templateType": "anything", "definition": "precround(250*{r3}/690,1)", "description": "", "group": "Ungrouped variables"}, "n32": {"name": "n32", "templateType": "anything", "definition": "240-{n12}-{n22}", "description": "", "group": "Ungrouped variables"}, "e21": {"name": "e21", "templateType": "anything", "definition": "precround(250*{r2}/690,1)", "description": "", "group": "Ungrouped variables"}, "r3": {"name": "r3", "templateType": "anything", "definition": "{n31}+{n32}+{n33}", "description": "", "group": "Ungrouped variables"}, "Chi_98": {"name": "Chi_98", "templateType": "number", "definition": "13.28", "description": "", "group": "Ungrouped variables"}, "e22": {"name": "e22", "templateType": "anything", "definition": "precround(240*{r2}/690,1)", "description": "", "group": "Ungrouped variables"}, "n11": {"name": "n11", "templateType": "randrange", "definition": "random(120..130#1)", "description": "", "group": "Ungrouped variables"}, "n22": {"name": "n22", "templateType": "randrange", "definition": "random(112..130#1)", "description": "", "group": "Ungrouped variables"}, "n12": {"name": "n12", "templateType": "randrange", "definition": "random(90..99#1)", "description": "", "group": "Ungrouped variables"}, "scenario": {"name": "scenario", "templateType": "anything", "definition": "sum(map(abs(test_statistic)A social scientist was interested in the relationship between sporting activity and age.

\n

People in different age groups were asked to categorise their involvement in sports under three headings:

\n

Very Active if they were members of a sports team

\n

Active if they played sports on a regular basis but not a member of a sports team.

\n

Inactive if they rarely or never played sports.

\n

The data collected is presented below:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 \$$12\\le age<15\$$ \$$15\\le age<18\$$ \$$18\\le age<21\$$ Very Active {n11} {n12} {n13} Active {n21} {n22} {n23} Inactive {n31} {n32} {n33}
\n

\n

Test the hypothesis that Sporting activity and age profile are independent of one another.

\n

", "extensions": ["stats"], "parts": [{"prompt": "

Enter the expected frequencies correct to one decimal place:

\n

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 \$$12\\le age<15\$$ \$$15\\le age<18\$$ \$$18\\le age<21\$$ Very Active [[0]] [[1]] [[2]] Active [[3]] [[4]] [[5]] Inactive [[6]] [[7]] [[8]]
\n

Enter the value for the appropriate test statistic: \$$\\chi^2\$$ = [[9]]

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

", "marks": 0, "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "scripts": {}, "minMarks": "3", "type": "1_n_2", "choices": ["

Reject the Null hypothesis that sporting activity and age profile are independent of one another.

", "

Reject the Null Hypothesis at the 5% significance level but accept the Null Hypothesis at the 2% significance level and conclude that sporting activity and age profile are independent of one another.

", "

Reject the Null Hypothesis at the 10% significance level but accept the Null Hypothesis at the 5% significance level and conclude that sporting activity and age profile are independent of one another.

", "

Accept the Null Hypothesis at the 10% significance level and conclude that sporting activity and age profile are independent of one another.

"], "showFeedbackIcon": true, "displayColumns": "1", "matrix": "decision_matrix", "showCorrectAnswer": true, "shuffleChoices": false, "variableReplacements": [{"part": "p0", "must_go_first": false, "variable": ""}]}], "ungrouped_variables": ["test_statistic", "Chi_95", "scenario", "decision_matrix", "Chi_98", "Chi_90", "n11", "n12", "n13", "n21", "n31", "n23", "n22", "n32", "n33", "r1", "r2", "r3", "e11", "e21", "e31", "e12", "e22", "e32", "e13", "e23", "e33"], "variable_groups": [], "type": "question", "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/"}]}