Download presentation
Presentation is loading. Please wait.
Published byHarvey Williamson Modified over 9 years ago
1
1 STA 617 – Chp10 Models for matched pairs 10.4 Symmetry, Quasi-symmetry and Quasi-independence
2
2 STA 617 – Chp10 Models for matched pairs
3
3
4
4
5
5
6
6
7
7
8
8
9
9 SAS code: data migrate; input then $ now $ count symm qi; datalines; ne ne 11607 1 1 ne mw 100 2 5 ne s 366 3 5 ne w 124 4 5 mw ne 87 2 5 mw mw 13677 5 2 mw s 515 6 5 mw w 302 7 5 s ne 172 3 5 s mw 225 6 5 s s 17819 8 3 s w 270 9 5 w ne 63 4 5 w mw 176 7 5 w s 286 9 5 w w 10192 10 4 ; symm - symmetry qi - quasi indep.
10
10 STA 617 – Chp10 Models for matched pairs SAS modeling proc genmod; class then now; model count =then now / dist=poi link=log; run; /*independence DF=(4-1)+(4-1)=6, residual DF=9 */ proc genmod; class symm; model count = symm / dist=poi link=log; * symmetry DF=4-1+4*(4-1)/2=9, residual DF=6 ; proc genmod; class then now qi; model count = then now qi / dist=poi link=log; * quasi indep DF=(4-1)+(4-1)+(5-1)=10, residual DF=5 ; proc genmod; class then now symm; model count = symm then now / dist=poi link=log; *quasi symmetry DF=(4-1+4*(4-1)/2)+(4-1)=12, residual DF=3 ;
11
11 STA 617 – Chp10 Models for matched pairs Symmetry model – predicted values data
12
12 STA 617 – Chp10 Models for matched pairs Quasi Indep. model – predicted values data
13
13 STA 617 – Chp10 Models for matched pairs
14
14 STA 617 – Chp10 Models for matched pairs Quasi Symmetry model data
15
15 STA 617 – Chp10 Models for matched pairs Quasi symmetry
16
16 STA 617 – Chp10 Models for matched pairs
17
17 STA 617 – Chp10 Models for matched pairs
18
18 STA 617 – Chp10 Models for matched pairs
19
19 STA 617 – Chp10 Models for matched pairs
20
20 STA 617 – Chp10 Models for matched pairs
21
21 STA 617 – Chp10 Models for matched pairs 10.4.7 Premarital and extramarital sex example revisited symm qi - quasi indep.
22
22 STA 617 – Chp10 Models for matched pairs proc genmod data=sex; class symm; model count = symm / dist=poi link=log; * symmetry; proc genmod data=sex; class extramar premar symm; model count = symm extramar premar / dist=poi link=log; *QS; proc genmod data=sex; class symm; model count = symm extramar premar / dist=poi link=log; * ordinal QS; proc genmod data=sex; class extramar premar qi; model count = extramar premar qi / dist=poi link=log; * quasi indep; proc genmod data=sex; class extramar premar; model count = extramar premar unif / dist=poi link=log; run;/*linear-linear association*/ proc genmod data=sex; class symm; model count = symm tao/ dist=poi link=log; * conditional symmetry; proc genmod data=sex; class extramar premar qi; model count = extramar premar unif qi/ dist=poi link=log; *quasi uniform association; run; G 2 =402.2 DF=6 G 2 =1.36 DF=3 G 2 =2.09 DF=5 G 2 =7.04 DF=5 G 2 =8.32 DF=8 G 2 =15.5 DF=5 G 2 =1.43 DF=4
23
23 STA 617 – Chp10 Models for matched pairs
24
24 STA 617 – Chp10 Models for matched pairs proc genmod data=sex; class symm; model count = symm extramar premar / dist=poi link=log; * ordinal QS;
25
25 STA 617 – Chp10 Models for matched pairs data sex1; set sex; ub_a=extramar-premar; if extramar<premar then nab=count; else nab=0; run; proc sql; create table aa as select symm, sum(count) as tcount, max(nab) as n_ab,max(ub_a) as ub_ua, count(symm) as nsumm from sex1 group by symm having nsumm=2; proc logistic data=aa; model n_ab/tcount=ub_ua/ noint; run;
26
26 STA 617 – Chp10 Models for matched pairs Data aa proc genmod data=aa; model n_ab/tcount=/dist=bin link=logit noint; run; /*equivalent to symmetry*/ proc genmod data=aa; model n_ab/tcount=/dist=bin link=logit; run; /*equivalent to conditional symmetry*/
27
27 STA 617 – Chp10 Models for matched pairs
28
28 STA 617 – Chp10 Models for matched pairs
29
29 STA 617 – Chp10 Models for matched pairs
30
30 STA 617 – Chp10 Models for matched pairs ORDINAL MODELS: proc genmod data=sex; class symm; model count = symm extramar premar / dist=poi link=log; * ordinal QS; proc genmod data=sex; class extramar premar; model count = extramar premar unif / dist=poi link=log; run;/*linear-linear association*/ proc genmod data=sex; class symm; model count = symm tao/ dist=poi link=log; * conditional symmetry; proc genmod data=sex; class extramar premar qi; model count = extramar premar unif qi/ dist=poi link=log; *quasi uniform association; run; G 2 =8.32 DF=8 G 2 =15.5 DF=5 G 2 =1.43 DF=4 G 2 =2.09 DF=5
31
31 STA 617 – Chp10 Models for matched pairs
32
32 STA 617 – Chp10 Models for matched pairs Models Summary of IXI table Define two variables, such as symm - symmetry qi - quasi indepedence
33
33 STA 617 – Chp10 Models for matched pairs proc genmod data=sex; class symm; model count = symm / dist=poi link=log; * symmetry; proc genmod data=sex; class extramar premar symm; model count = symm extramar premar / dist=poi link=log; *QS; proc genmod data=sex; class extramar premar qi; model count = extramar premar qi / dist=poi link=log; * quasi indep;
34
34 STA 617 – Chp10 Models for matched pairs proc genmod data=sex; class symm; model count = symm extramar premar / dist=poi link=log; * ordinal QS; proc genmod data=sex; class extramar premar; model count = extramar premar unif / dist=poi link=log; run; /*linear-linear association*/ proc genmod data=sex; class extramar premar qi; model count = extramar premar unif qi/ dist=poi link=log; *quasi uniform association; run;
35
35 STA 617 – Chp10 Models for matched pairs proc genmod data=sex; class symm; model count = symm tao/ dist=poi link=log; * conditional symmetry; Note: symm - symmetry
36
36 STA 617 – Chp10 Models for matched pairs Symmetry, Ordinal Quasi-symmetry, conditional symmetry Logistic form
37
37 STA 617 – Chp10 Models for matched pairs data sex1; set sex; ub_a=extramar-premar; if extramar<premar then nab=count; else nab=0; run; proc sql; create table aa as select symm, sum(count) as tcount, max(nab) as n_ab,max(ub_a) as ub_ua, count(symm) as nsumm from sex1 group by symm having nsumm=2; proc logistic data=aa; model n_ab/tcount=ub_ua/ noint; run; /* ordinal QS */ proc genmod data=aa; model n_ab/tcount=/dist=bin link=logit; run; /*conditional symmetry*/ proc genmod data=aa; model n_ab/tcount=/dist=bin link=logit noint; run; /*equivalent to symmetry*/
38
38 STA 617 – Chp10 Models for matched pairs Log-linear model form
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.