1. ## contingency tables

I would really appreciate help on this. Thankyou

A random survey of 100 students (60 boys/40 girls) asked each student to select the most preferred form of recreational activity from 5 choices. Test whether the choice is independent of the gender of the respondent. Approximate the p-value of the test. Would we reject at $\alpha=0.05$?

Recreational Choice
Baseball (Total=8): Male=5, Female=3
Swimming (Total=10): Male=9, Female=1
Running (Total=27): Male=12, Female=15
Tennis (Total=25): Male=13, Female=12

Thankyou!!

2. Instead of typing this up I did a search because I knew it had to be somewhere in the literature.
It took a dozen links for me to go with
http://homepage.smc.edu/mcgraw_colle...lc%20Notes.pdf

3. Our null hypothesis is that preference is independent of gender.

If preference is indeed independent of gender, we would expect, for example, $\frac {30}{100}* 60 = 18$ men to prefer basektball and $\frac {30}{100} *40 = 12$ women to prefer basketball.

EDIT: $q = \frac {(21-18)^{2}}{18} + \frac{(9-12)^{2}}{12} + \frac{(5-4.8)^{2}}{4.8} + \frac {(3-3.2)^{2}}{3.2} + \frac{(9-6)^{2}}{6} + \frac{(1-4)^{2}}{4} +$ $+ \frac{(12-16.2)^{2}}{16.2} +$ $\frac{(15-10.8)^{2}}{10.8} + \frac{(13-15)^{2}} {15} + \frac{(12-10)^{2}}{10}$

Calculate q.

Q follows a $\chi^{2}$-distribution with (2-1)(5-1) = 4 degrees of freedom (one less than the number of rows times one less than the number of columns)

The p-value for this test is $P(\chi^{2}_{4} \ge q)$.

This is the smallest significance level at which the null hypothesis can be rejected. So if this value is less than 0.05, then there is enough evidence to reject the null hypothesis.

4. You can calculate the exact p-value via...
Free p-Value Calculator for the Chi-Square Test

5. I got q=8.309722222 and with 4 degrees of freedom, the calculator gave me 0.038262. This would mean I could reject the null hypothesis. Is there a formula or chart to find the p-value? I'm curious how that number came about. Thanks

6. Originally Posted by chrissy72
I got q=8.309722222 and with 4 degrees of freedom, the calculator gave me 0.038262. This would mean I could reject the null hypothesis. Is there a formula or chart to find the p-value? I'm curious how that number came about. Thanks
Are you sure you typed in the correct number? For your calculated q I get 0.080870.

According to the following table, the value is somewhere between 0.05 and 0.10.

Table: Chi-Square Probabilities

7. To calculate the value yourself, you have to solve the following integral (which is not too bad in this particular case):

$\frac {1}{2^{4/2} \Gamma (4/2)} \int^{\infty}_{8.30972} x^{4/2 -1}e^{-x/2} \ dx$ $= \frac {1}{4 \Gamma (2)} \int^{\infty}_{8.30972} xe^{-x/2} \ dx$

$= \frac {1}{4} \int^{\infty}_{8.30972} xe^{-x/2} \ dx \ (\text{since} \ \Gamma{2} = \Gamma (1+1) = 1 \Gamma(1) = 1*1 = 1 )$

$= \frac{\text{-}xe^{-x/2}}{2} \Big|^{\infty}_{8.30972} + \frac{1}{2}\int^{\infty}_{8.30972} e^{-x/2} \ dx \ (\text{ integration by parts} )$

$= \frac {\text{-}xe^{-x/2}}{2} - e^{-x/2} \Big|^{\infty}_{8.30972}$

$0 - \Big(\frac{\text{-}(8.30972)e^{-8.30972/2}}{2} - e^{-8.30972/2} \Big) \approx 0.08087$

8. Thank you for helping! I typed in 8.30972 as the chi square value and 4 degrees of freedom into the calculator provided by matheagle. Thank you for the formula. I have to do a question very similar to this and don't want to get it all wrong. If your answer is correct (which I'm sure it is), then the null hypothesis that gender that preference is independent of gender is NOT rejected?

9. Originally Posted by chrissy72
Thank you for helping! I typed in 8.30972 as the chi square value and 4 degrees of freedom into the calculator provided by matheagle. Thank you for the formula. I have to do a question very similar to this and don't want to get it all wrong. If your answer is correct (which I'm sure it is), then the null hypothesis that gender that preference is independent of gender is NOT rejected?
When I type those values into that calculator that matheagle provided, I get 0.080870.

10. And you usually don't want to calculate a p-value by integration because the integral is often very difficult. That's why there are tables.

11. You are totally right. I am so sorry. I must have written down the incorrect number. I am getting myself so confused. I have papers everywhere! Thank for everything.

12. since it is over 0.05, it fails to reject the null hypothesis. does this 0.05 just come from $\alpha=0.05$?

13. Originally Posted by chrissy72
since it is over 0.05, it fails to reject the null hypothesis. does this 0.05 just come from $\alpha=0.05$?
yes, there is NOT enough evidence to reject the null hypothesis at the $\alpha =0.05$ significance level