testing hypothesis with two proportions and chi-square testing
TRANSCRIPT
![Page 1: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/1.jpg)
Testing hypothesis with two proportions and Chi-square testing
![Page 2: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/2.jpg)
Hypothesis 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: p1p2
Test statistic:
Where
1 2
1 2
ˆ ˆ
1 1ˆ ˆ(1 )C C
p p
p pn n
1 2
1 2
ˆCX X
pn n
![Page 3: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/3.jpg)
Calculations
22
2
90ˆ 0.25714
350
Xp
n
InsectsRUs
InsectsBGone
p-value=0.00515
1 2
1 2
ˆ ˆ
1 1ˆ ˆ(1 )C C
p p
p pn n
1 2
1 2
ˆCX X
pn n
11
1
50ˆ 0.166667
300
Xp
n
50 90 140ˆ 0.21538
350 300 650Cp
0.1667 0.25712.79719
1 10.2153(1 0.2153)
300 350
![Page 4: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/4.jpg)
Contingency Table Can also view this as a contingency table
Type of InsecticideInsectsRUs InsectsBGone
Killed 50 90Not killed 250 260
TOTAL 300 350
![Page 5: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/5.jpg)
Chi-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
Insecticide
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Killed Not Killed
InsectRUs
InsectBGone
![Page 6: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/6.jpg)
Expected Values for Chi Square Expected value =
(row total)*(column total)/N
InsectsRUs
InsectsBGone TOTAL
Killed 50 90 140
Not Killed 250 260 510
TOTAL 300 350 650Column Totals
Row Totals
N
![Page 7: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/7.jpg)
InsectsRUs InsectsBGone TOTAL
Killed 50 90 140
Not Killed 250 260 510
TOTAL 300 350 650
InsectsRUs InsectsBGone TOTAL
Killed =140*300/650 =140*350/650 140
Not Killed =510*300/650 =350*510/650 510
TOTAL 300 350 650
Calculating Expected Values
![Page 8: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/8.jpg)
Calculated expected values
InsectsRUs InsectsBGone TOTAL
Killed 64.61538 75.38462 140
Not Killed 235.38462 274.61538 510
TOTAL 300 350 650
22 (observed-expected)
expectedX Now calculate the Chi –square statistic
2 2 2 22 (50 64.61538) (90 75.38462) (250 235.38462) (260 274.61538)
64.61538 75.38462 235.38462 274.61538X
=7.824768 , degrees of freedom = 1
p-value = 0.00515
![Page 9: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/9.jpg)
Comments 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.
![Page 10: Testing hypothesis with two proportions and Chi-square testing](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f305503460f94c4b326/html5/thumbnails/10.jpg)
Goodness 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.25*100=25).
2 2 2 2 22 (observed-expected) (18 25) (22 25) (39 25) (21 25)
expected 25 25 25 25X
=10.8, degrees of freedom=3
P-value=0.012858