I'm doing some problems from past statistics exams and I can't figure out how to apply Pearson's chi-squared test properly. I have a feeling that I'm missing something very basic and simple, but I can't figure out what that is.
Most of the problems on the exams seem to follow a similar pattern, so here's one which I've been trying to figure out for quite a while with no success:
Following data was gathered from 1536 series of 7 coin tosses:
Number of tails: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
number of series:| 12| 78|270|456|386|252| 69| 3 |
Using $\chi^2$ test, test the hypothesis that probability of getting tails is $\frac{1}{2}$. Form the test as a distribution test with significance level of 0.05.
I've found the same problem in a book of problems and the result there is: Distribution is $B(7, \frac{1}{2})$ $\chi^2=16.96$, critical value is 14.067 and because of that, null hypothesis is dropped.
Here's my line of thinking when I was trying to do this problem:
First, we have coin tossing, so the traditional results are heads and tails. That implies binomial distribution. We have a series of 7 tosses and the probability that needs to be checked is 0.5, so I can now form the hypothesis:
$H_0=$ $X$ has distribution $B(7,\frac{1}{2})$
$H_1=$ $X$ doesn't have distribution $B(7,\frac{1}{2})$
Next, looking at the table, I see that there are 8 classes. Due to some reason I don't fully understand but I think has something to do with the type of table I have, the number of degrees of freedom for $\chi^2$ here is 8-1=7. Combining that and the significance level of 0.05 and using $\chi^2$ quantile table, I get the quantile for 95%: $\epsilon_{0.95}=14.067$, which is the critical value from the result I've found.
As far as I understand it, my next step is to calculate the test statistic $\chi^2$ and compare it to the quantile. If the statistic is lower than the quantile, we cannot drop the null hypothesis and if it's greater than the quantile, we drop the null hypothesis.
The traditional formula for $\chi^2$ test, from what I can see goes something like this: $$\chi^2=\sum_{k=0}^7\frac{(Observed_k-Expected_k)^2}{Expected_k}$$
Since I have binomial distribution, the mathematical expectation is $np=3.5$ and the variance is $np(1-p)=1.75$. The first idea I've had for applying the formula was to use the data from the number of tails
row as observed and the 3.5 as the expected value and than multiply the result by the number of series that had the observed number of tails. For the first column of the table that would give me: $12\frac{(0-3.5)^2}{3.5}=42$ and that combined with the result tells me that this is a wrong approach. I have a feeling that I may be misinterpreting the expected value somehow.
My next idea was to see if I can use some sort of approximation and see if that leads me somewhere. Unfortunately, directly applying Poisson and Normal approximation to data using n and p from $B(7,\frac{1}{2})$ is not possible, due to "rules of thumb".
After that, I tried using the number 1536 in various ways and combine that with normal approximation of binomial distribution, but I quickly realized that none of what I was doing made any sense.
So I came here to ask what and where am I misunderstanding when applying the $\chi^2$ test.