300 likes | 430 Views
Comparison of proportions 比例的比較 -Part I. Instructor: 李奕慧 yihwei@mail.tcu.edu.tw. Lecture Overview. Cross Tabulations 2 X 2 tables R XC tables Chi-square Test for Independence Chi-square Test for Trend. Cross Tabulation and Chi-square test for independence:
E N D
Comparison of proportions 比例的比較-Part I Instructor: 李奕慧 yihwei@mail.tcu.edu.tw
Lecture Overview • Cross Tabulations • 2 X 2 tables • R XC tables • Chi-square Test for Independence • Chi-square Test for Trend
Cross Tabulation and Chi-square test for independence: To Explore the Association Between Two Categorical Variables, 例:機車騎士戴安全帽與否是否與發生車禍時頭部受傷的機率有關?
Data Input Data Type : Measure Scale: 連續變數 Nominal/Ordinal: 類別變數 Value: 定義類別變數的項目, 0=“no”, 1=“yes”. Helmet.sav dataset
Under H0, Expected frequencies: E11, E12, E21, E22 E11 = 200 x P(戴安全帽) x P(頭部受傷) = 200 x (100/200) x (74/200) = 37 E12 = 200 x P(戴安全帽) x P(頭部沒受傷) = 200 x (100/200) x (126/200) = 63=100-37
大樣本用:Pearson Chi-square Test 小樣本用:Fisher’s Exact Test
Row variable: Injury Column variable: Helmet 數學上的慣例:Row *Column
SPSS Menu Analyze > Descriptive Statistics > Crosstabs
Another way to input data Data >Weight Cases Helmet2.sav dataset
當樣本數很小時,或E11, E12, E21, E22小於5 Chi-square 檢定不夠準確,必須使用 Yate’s continuity correction test, or Fisher’s exact test
Summary results: 2-test = 3.846, P-value = 0.050 Yate’s corrected 2-test = 2.345 , P-value = 0.126 Fisher’s exact test, P-value = 0.086
Table Example in Research Article Values are number of study subjects (percentage). P-value is derived from Fisher’s exact test.
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)
Test H0: proportions of each type of death certificates are identical in the two hospitals (There is no association between hospital type and death certificate status)
Expected counts under H0: independence Erc=(nr x nc)/575
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 H0 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.
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, • H0: p1=p2=…=pc versus • Ha: p1<p2<…<pc (an increasing trend) or Ha:p1>p2>…>pc (a decreasing trend)
Examples for chi-square test for trend H0: P65-69=P70-74=P75+ Ha: P65-69>P70-74>P75+ or P65-69<P70-74<P75+ MI之後,抽煙病人接受戒煙諮商的比例,隨著年齡增加有下降的趨勢
Exercise Am J Public Health. 2004 Oct;94(10):1768-74
Categorical data: depression= (yes or no) • H0: proportion of subjects with depression in women = proportion of subjects with depression in men • H0: pf = pm • Ha: proportion of subjects with depression in women is different from proportion of subjects with depression in men • Ha: pf pm
Exercise:Comparison among age groups • H0: proportions of subjects with depression are the same among the three age groups. H0: p75-79 = p80-84 = p85+ • Ha: proportions of subjects with depression are different among the three age groups. (test for independence) • Ha: depression prevalence is increasing in older age groups. (test for trend)
Practice! Practice! Practice! Thank you !