Consider the following data generating process:
Then add this error generating process:
Small random errors generating variation in observed values
\[\chi^2 = \sum\frac{\displaystyle(O_i-E_i)^2}{E_i}\]
Are births evenly spread across the week?
Day of the Week | Births |
---|---|
Sunday | 33 |
Monday | 41 |
Tuesday | 63 |
Wednesday | 63 |
Thursday | 47 |
Friday | 56 |
Saturday | 47 |
Day of the Week | Births | Expectation |
---|---|---|
Sunday | 33 | 50 |
Monday | 41 | 50 |
Tuesday | 63 | 50 |
Wednesday | 63 | 50 |
Thursday | 47 | 50 |
Friday | 56 | 50 |
Saturday | 47 | 50 |
\(\chi^2\) = 15.24 with 6 DF
p = 0.01847
Eizaguirre lab
Heavily Infected | Lightly Infected | Uninfected | |
---|---|---|---|
Eaten by Birds | 37 | 10 | 1 |
Not Eaten by Birds | 9 | 35 | 49 |
p(eaten AND uninfected) = p(eaten) x p(infected)
Eaten by Birds Not Eaten by Birds
48 93
Heavily Infected Lightly Infected Uninfected
46 45 50
\[\chi^2 = \sum_{row=1}^{r}\sum_{col = 1}^{c}\frac{\displaystyle(O_{r,c}-E_{r,c})^2}{E_{r,c}}\]
df = (r-1)(c-1)
Pearson's Chi-squared test
data: ctab
X-squared = 69.756, df = 2, p-value = 7.124e-16
Given that the goal is to detect deviations from expectations given normal error, this test has a few assumptions:
If you violate assumptions: