1 Modeling Ordinal Associations Section 9.4 Roanna Gee
2 National Opinion Survey 1991 General Social Survey Opinions were asked about a man and a woman having sexual relations before marriage. Always Wrong Almost Always Wrong Only Sometimes Not Wrong At All Opinions were also asked whether methods of birth control should be available to teenagers between the ages of 14 and 16. Strongly Disagree Disagree Agree Strongly Agree
3 Opinions on Premarital Sex and Teenage Birth Control Premarital Sex i (row) Teenage Birth Control j (column) ij i Strongly DisagreeDisagreeAgreeStrongly Agree Always Wrong 81 (42.4) 7.6 (80.9) 68 (51.2) 3.1 (67.6) 60 (86.4) -4.1 (69.4) 38 (67.0) -4.8 (29.1) 247 Almost Always Wrong 24 (16.0) 2.3 (20.8) 26 (19.3) 1.8 (23.1) 29 (32.5) -0.8 (31.5) 14 (25.2) -2.8 (17.6) 93 Wrong Only Sometimes 18 (30.1) -2.7 (24.4) 41 (36.3) 1.0 (36.1) 74 (61.2) 2.2 (65.7) 42 (47.4) (48.8) 175 Not Wrong at All 36 (70.6) -6.1 (33.0) 57 (85.2) -4.6 (65.1) 161 (143.8) 2.4 (157.4) 157 (111.4) 6.8 (155.5) 411 ij j
4 log ij = + i + j Independence Model XY ij =Expected count =Mean log cell count i =Adjustment for Row i j =Adjustment for Column j X Y Degrees of Freedom = (r – 1)(c – 1)
5 Sample Calculation of ij log † 23 = log (row total) + log(column total) – log(table total) = log 93 + log 324 – log 926 ≈ 3.48 so 23 ≈ exp(3.48) ≈ 32.5 or † log means natural logarithm 23 can be calculated as (93)(324)/(926) ≈ 32.5 P(A B) n = P(A) P(B) n = (93/926)(324/926)(926)
6 Calculate and i is the mean of the logs of the expected all the cell counts. = (log log log 111.4)/16 = i is the adjustment to for row i—its mean less . 2 = (log log log log 25.2)/4 – = j is the adjustment to for column j. 3 = X X Y X Y
7 Degrees of Freedom There are 4 rows and 4 columns giving us a total of 16 cells and therefore 16 degrees of freedom. For each parameter we add to the model, we lose one degree of freedom. We lose one degree for . We lose 3 degrees for the i ’s. (Since i = 0, 4 = – 1 – 2 – 3.) We also lose 3 degrees for the j ’s. X X X X XX Y = 16 – 1 – 3 – 3 = 9 = rc – 1 – (r – 1) – (c – 1) = (r – 1)(c – 1)
8 Data and Independence Model Premarital Sex i (row) Teenage Birth Control j (column) ij i Strongly DisagreeDisagreeAgreeStrongly Agree Always Wrong 81 (42.4) 68 (51.2) 60 (86.4) 38 (67.0) 247 Almost Always Wrong 24 (16.0) 26 (19.3) 29 (32.5) 14 (25.2) 93 Wrong Only Sometimes 18 (30.1) 41 (36.3) 74 (61.2) 42 (47.4) 175 Not Wrong at All 36 (70.6) 57 (85.2) 161 (143.8) 157 (111.4) 411 ij j
9 Pearson Residuals = -0.8 A standardized Pearson residual that exceeds 2 or 3 in absolute value indicates a lack of fit.
10 Data and Pearson Residuals Premarital Sex i (row) Teenage Birth Control j (column) ij i Strongly DisagreeDisagreeAgreeStrongly Agree Always Wrong Almost Always Wrong Wrong Only Sometimes Not Wrong at All ij j
11 SAS Code Independence Model data sex; input premar birth u v count linlin = u*v ; datalines; ; proc genmod; class premar birth; model count = premar birth / dist=poi link=log; run;
12 SAS Output Independence Model Criteria For Assessing Goodness Of Fit Criterion DF Value Value/DF Deviance Scaled Deviance Pearson Chi-Square Scaled Pearson X Log Likelihood Algorithm converged. Analysis Of Parameter Estimates Standard Wald 95% Confidence Chi- Parameter DF Estimate Error Limits Square Pr > ChiSq Intercept <.0001 premar <.0001 premar <.0001 premar <.0001 premar birth <.0001 birth birth birth Scale
13 Flat Plane
14 log ij = + i + j + ij Saturated Model: X Y ij =Adjustment for Cell ij XY Degrees of Freedom = 0 XY 23 = log n 23 – – 2 – 3 = log 29 – – ) –.3692 = XY X Y
15 log ij = + i + j + u i v j :linear-by linear association u i :row scores v j :column scores Linear-by-Linear Model XY The Linear-by-Linear model adds a parameter so we lose a degree of freedom: = (r – 1)(c – 1) – 1 = 8
16 SAS Code Linear-by-Linear Model data sex; input premar birth u v count linlin = u*v ; datalines; ; proc genmod; class premar birth; model count = premar birth linlin / dist=poi link=log; run;
17 SAS Output Linear by Linear Model Criteria For Assessing Goodness Of Fit Criterion DF Value Value/DF Deviance Scaled Deviance Pearson Chi-Square Scaled Pearson X Log Likelihood Algorithm converged. Analysis Of Parameter Estimates Standard Wald 95% Confidence Chi- Parameter DF Estimate Error Limits Square Pr > ChiSq Intercept premar <.0001 premar premar premar birth <.0001 birth <.0001 birth <.0001 birth linlin <.0001 Scale
18 Sample Calculation in the Linear-by-Linear Model log 23 = u 2 v 3 = (2)(3) = 23 = exp(3.4511) = 31.5 X Y 18
19 Data and Linear-by-Linear Model Premarital Sex i (row) Teenage Birth Control j (column) ij i Strongly DisagreeDisagreeAgreeStrongly Agree Always Wrong 81 (80.9) 68 (67.6) 60 (69.4) 38 (29.1) 247 Almost Always Wrong 24 (20.8) 26 (23.1) 29 (31.5) 14 (17.6) 93 Wrong Only Sometimes 18 (24.4) 41 (36.1) 74 (65.7) 42 (48.8) 175 Not Wrong at All 36 (33.0) 57 (65.1) 161 (157.4) 157 (155.5) 411 ij j
20 Constant Odds Ratio by Uniform Association Model
21 Odds Ratio and Example:
22 Saddle Movie