Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Comparison of proportions 比例的比較 -Part I Instructor: 李奕慧

Similar presentations


Presentation on theme: "1 Comparison of proportions 比例的比較 -Part I Instructor: 李奕慧"— Presentation transcript:

1 1 Comparison of proportions 比例的比較 -Part I Instructor: 李奕慧

2 Lecture Overview Cross Tabulations 2 X 2 tables R XC tables Chi-square Test for Independence Chi-square Test for Trend

3 3 Cross Tabulation and Chi-square test for independence: To Explore the Association Between Two Categorical Variables, 例:機車騎士戴安全帽與否是否與發生車禍時頭部 受傷的機率有關? 頭部受傷 戴安全帽 是 否合計 是 否 合計

4 4 Data Type : Measure Scale: 連續變數 Nominal/Ordinal: 類別變數 Value: 定義類別變數的項目, 0=“no”, 1=“yes”. Data Input Helmet.sav dataset

5 5 頭部受傷 戴安全帽 是 否合計 是 O 11 =12O 21 =6274 否 O 12 =88O 22 =38126 合計 Observed frequencies: O 11, O 12, O 21, O 22

6 6 Under H 0, Expected frequencies: E 11, E 12, E 21, E 22 E 11 = 200 x P( 戴安全帽 ) x P( 頭部受傷 ) = 200 x (100/200) x (74/200) = 37 E 12 = 200 x P( 戴安全帽 ) x P( 頭部沒受傷 ) = 200 x (100/200) x (126/200) = 63=100-37

7 7 頭部受傷 戴安全帽 是 否合計 是 E 11 =37E 21 =3774 否 E 12 =63E 22 =63126 合計 Expected frequencies: E 11, E 12, E 21, E 22

8 8 Chi-square test (  2 -test) for independence

9 9

10 10 Chi-Square Tests Valuedf Asymp. Sig. (2-sided) Exact Sig. (2- sided) Exact Sig. (1- sided) Pearson Chi-Square a Continuity Correction b Likelihood Ratio Fisher's Exact Test.000 Linear-by-Linear Association N of Valid Cases200 a. 0 cells (.0%) have expected count less than 5. The minimum expected count is b. Computed only for a 2x2 table 大樣本用: Pearson Chi-square Test 小樣本用: Fisher’s Exact Test

11 11 injury * helmet Crosstabulation Count helmet Total noyes injuryno yes Total Row variable: Injury Column variable: Helmet 數學上的慣例: Row *Column

12 12 SPSS Menu Analyze > Descriptive Statistics > Crosstabs

13 13 Another way to input data Data >Weight Cases Helmet2.sav dataset

14 14 當樣本數很小時,或 E 11, E 12, E 21, E 22 小於 5 Chi-square 檢定不夠準確,必須使用 Yate’s continuity correction test, or Fisher’s exact test 頭部受傷 戴安全帽 是 否合計 是 O 11 =1O 21 =67 否 O 12 =13 O 22 =1023 合計

15 15 Summary results:  2 -test = 3.846, P-value = Yate’s corrected  2 -test = 2.345, P-value = Fisher’s exact test, P-value = 頭部受傷 戴安全帽 是 否合計 是 167 否 合計

16 16 injury * helmet Crosstabulation helmet Total noyes injurynoCount % within helmet62.5%92.9%76.7% yesCount617 % within helmet37.5%7.1%23.3% TotalCount % within helmet100.0% Helmet (n=14) No Helmet (n=16)P-value Head injury1 (7)6 (38)0.086 Values are number of study subjects (percentage). P-value is derived from Fisher’s exact test. Table Example in Research Article

17 17 Chi-Square Tests Valuedf Asymp. Sig. (2-sided) Exact Sig. (2- sided) Exact Sig. (1- sided) Pearson Chi-Square3.846 a Continuity Correction b Likelihood Ratio Fisher's Exact Test Linear-by-Linear Association N of Valid Cases30 a. 2 cells (50.0%) have expected count less than 5. The minimum expected count is b. Computed only for a 2x2 table Helmet3.sav

18 R x C Tables Row variable with r levels Column variable with c levels Test for the independence between Row and Column variables Using Chi-square test with df=(r-1)x(c-1)

19 Test H 0 : proportions of each type of death certificates are identical in the two hospitals (There is no association between hospital type and death certificate status) Hospital Death Certificate Status Total Confirmed accurate Inaccurate No change Incorrect recording A (row %) 157 (68.6%) 18 (7.9%) 54 (23.6%) 229 B (row %) 268 (77.5%) 44 (12.7%) 34 (9.8%) 346 Total

20 Hospital Death Certificate Status Total Confirmed accurate Inaccurate No change Incorrect recording A B Total Expected counts under H 0 : independence E rc =(n r x n c )/575

21 Chi-square test for no association (independence) between Hospital type and death certificate status with df=(2-1)(3-1)=2, P<0.001 Reject H 0 and conclude that there is an association between hospital type and death certificate status. It appears (from data) that Hospital A contains a larger proportion of death certificates that are incorrect and required recoding than Hospital B.

22 22 Hosiptal * Accuracy Crosstabulation Accuracy Total accurate minor inaccuracy major inaccuracy HosiptalA Count % within Hosiptal 68.6%7.9%23.6% 100.0% B Count % within Hosiptal 77.5%12.7%9.8% 100.0% TotalCount % within Hosiptal73.9%10.8%15.3%100.0% Chi-Square Tests Valuedf Asymp. Sig. (2-sided)Exact Sig. (2-sided)Exact Sig. (1-sided)Point Probability Pearson Chi-Square a Likelihood Ratio Fisher's Exact Test Linear-by-Linear Association b N of Valid Cases575 a. 0 cells (.0%) have expected count less than 5. The minimum expected count is b. The standardized statistic is Hospital.sav

23 23 Chi-square test for trend If one or both variables are ordinal, then chi-square test for trend is appropriate. Chi-square test for trend also known as Mantel-Haenszel test for trend. In R x 2 Tables, H 0 : p 1 =p 2 =…=p c versus H a : p 1

p 2 >…>p c (a decreasing trend)

24 24 Examples for chi-square test for trend H0: P =P =P 75+ Ha: P >P >P 75+ or P


25 25 agegp * counseled Crosstabulation counseled Total noyes agegp 65-69Count % within agegp55.4%44.6%100.0% 70-74Count % within agegp58.0%42.0%100.0% >=75Count % within agegp65.0%35.0%100.0% TotalCount % within agegp58.9%41.1%100.0% Chi-Square Tests Valuedf Asymp. Sig. (2- sided) Pearson Chi-Square a Likelihood Ratio Linear-by-Linear Association N of Valid Cases16743 a. 0 cells (.0%) have expected count less than 5. The minimum expected count is Smoking.sav

26 26 Am J Public Health Oct;94(10): Exercise

27 27 Categorical data: depression= (yes or no) H 0 : proportion of subjects with depression in women = proportion of subjects with depression in men H 0 : p f = p m H a : proportion of subjects with depression in women is different from proportion of subjects with depression in men H a : p f  p m

28 28 sex * depression Crosstabulation depression noyesTotal sexmaleCount % within sex93.3%6.7%100.0% femaleCount % within sex91.2%8.8%100.0% TotalCount % within sex92.0%8.0%100.0% Chi-Square Tests Valuedf Asymp. Sig. (2-sided) Exact Sig. (2-sided) Exact Sig. (1-sided) Pearson Chi-Square a Continuity Correction b Likelihood Ratio Fisher's Exact Test.000 Linear-by-Linear Association N of Valid Cases13349 a. 0 cells (.0%) have expected count less than 5. The minimum expected count is b. Computed only for a 2x2 table Depression.sav

29 29 Exercise: Comparison among age groups H 0 : proportions of subjects with depression are the same among the three age groups. H 0 : p = p = p 85+ H a : proportions of subjects with depression are different among the three age groups. (test for independence) H a : depression prevalence is increasing in older age groups. (test for trend)

30 30 Practice! Practice! Practice! Thank you !


Download ppt "1 Comparison of proportions 比例的比較 -Part I Instructor: 李奕慧"

Similar presentations


Ads by Google