Title: Testing%20hypothesis%20with%20two%20proportions%20and%20Chi-square%20testing
1Testing hypothesis with two proportions and
Chi-square testing
2Hypothesis testing for homogeneity of proportions
- We wish to compare the effects of two different
insecticides. The first insectide, InsectsRUs,
was applied to 300 insects and 50 of them died.
The second insecticide, InsectsBGone, was applied
to 350 insects and 90 died. Test to see if there
is a significant difference in the proportion of
insects killed.
- Hypothesis of interest
- H0 p1 p2 versus HA p1?p2
- Test statistic
- Where
3Calculations
- InsectsRUs
- InsectsBGone
- p-value0.00515
4Contingency Table
- Can also view this as a contingency table
- Type of Insecticide
- InsectsRUs InsectsBGone
- Killed 50 90
- Not killed 250 260
- TOTAL 300 350
-
5Chi-square
- Chi-square testing can be used to test if the
distribution is the same in each group (i.e.
insecticides) - Need to find Expected values
6Expected Values for Chi Square
- Expected value
- (row total)(column total)/N
Insects RUs InsectsBGone TOTAL
Killed 50 90 140
Not Killed 250 260 510
TOTAL 300 350 650
Row Totals
Column Totals
N
7InsectsRUs InsectsBGone TOTAL
Killed 50 90 140
Not Killed 250 260 510
TOTAL 300 350 650
Calculating Expected Values
InsectsRUs InsectsBGone TOTAL
Killed 140300/650 140350/650 140
Not Killed 510300/650 350510/650 510
TOTAL 300 350 650
8Calculated expected values
InsectsRUs InsectsBGone TOTAL
Killed 64.61538 75.38462 140
Not Killed 235.38462 274.61538 510
TOTAL 300 350 650
Now calculate the Chi square statistic
7.824768 , degrees of freedom 1 p-value
0.00515
9Comments on the Chi-square Test
- The test of H0 no association versus HA there
is an association between two categorical
variables is computationally the same as testing
if the conditional distributions are the same
(this can be extended to more than two
populations). - The degrees of freedom for a chi-square test is
(r-1)(c-1), where r rows and c columns. - Be cautious when expected frequencies are lower
than 5. - The chi-square test can also be used to test for
goodness-of-fit.
10Goodness of fit
- Test to see if percent of longleaf pine is evenly
distributed across the four quadrants (example
from Moore, McCabe, and Craig). - Quad1 Quad2 Quad3 Quad4
- Count 18 22 39 21
- There are a total of 100 trees, so we would
expect ¼ of 100 to be in each quadrant (where
expected value 0.2510025).
10.8, degrees of freedom3 P-value0.012858