# Chi-squared test : probability

I am trying to solve an exercise where I applied the chi-squared test.

I have already calculated the test statistic and the degrees of freedom.

At the question: "For how many degrees of freedom is the test statistic proved of significance?" we have to compute the degrees of freedom, right?

An other question is the following: "With which realization probability is this or an even greater effect to be expected when the null hypothesis is valid?"

I haven't really understood what I am supposed to do here? Could you give me a hint?

I assume this is a chi-squared goodness-of-fit test for data in $k$ categories (treated by the test as nominal). The test statistic is $$Q = \sum_{i=1}^k \frac{(X_i = E_i)^2}{E_i},$$ where the $X_i$ are the observed counts in the categories and the $E_i$ are the expected counts (unrounded), computed from the model being fit.

Small values of $Q$ represent relative good fit to the model and large values represent bad fit. So you will reject the null hypothesis that the data match the model for sufficiently large values of $Q.$

Provided that the $E_i$ are all above 5 (some authors say most are above 3), $Q$ is approximately distributed as $\mathsf{Chisq}(\nu),$ where the number of degrees of freedom is $\nu = k - 1.$ However, if the model is given only generically, and you have to estimate $r$ parameters in order to find the $E_i,$ then $\nu = k - r = 1.$

I believe the second part of the question is asking for the critical value of the test. That is, the value $c$ such that $Q > c$ leads to rejection at a specified significance level. Knowing the significance level and $\nu,$ you can get the value $c$ appropriate for a particular test from printed tables of the chi-squared distribution or by using software.

In R statistical software, the critical value for a test at the 5% level with $\nu = 5$ is $c = 11.07.$ Here is the computation from R statistical software, perhaps you can compare it with a printed table.

qchisq(.95, 5)
## 11.0705

• We have the table i.stack.imgur.com/L1Yob.png and all the $E_i$ are over $5$. I haven't erally understood why $\nu=k-r=1$. Could you explain it to me? – Mary Star Feb 14 '17 at 18:40
• For the second part: The significance level is not given. To we suppose that it is $5\%$ ? Which $\nu$ do we take? – Mary Star Feb 14 '17 at 18:42
• There are many kinds of chi-sq tests. Your question was vague, so I guessed the most common one--with one categorical variable. Hence "I assume this is a chi-squared goodness-of-fit test for data in $k$ categories." You have a 'contingency table' with two categorical variables. Presumably you are testing whether 'religious preference' and 'political party vote' are indep. cat. variables. If so, you are using row and column totals along with the assumption of independence to find the $E_{ij}.$ DF are $\nu = (r-1)(c-1) = (3-1)(3-1) = 4.$ // In general, if signif. level not specified, use 5%. – BruceET Feb 14 '17 at 19:35
• The critical value for a chi-squared test with 4 DF at level 5% is found in R as qchisq(.95, 4) which returns 9.487729. If the chi-squared statistic exceeds this value then reject the null hypothesis of independence. – BruceET Feb 14 '17 at 19:55
• I get chisq statistic = 118.885. Maybe it's asking for a P-value. "x%" is not really specific. I agree it's unclear. And maybe translation from German to English is not helping. – BruceET Feb 14 '17 at 20:01