1 sta 617 – chp10 models for matched pairs 10.4 symmetry, quasi-symmetry and quasi-independence
Post on 17-Jan-2016
217 Views
Preview:
TRANSCRIPT
1STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
10.4 Symmetry, Quasi-symmetry and Quasi-independence
2STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
3STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
4STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
5STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
6STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
7STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
8STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
9STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
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.
10STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
SAS modelingproc 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 ;
11STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
Symmetry model – predicted values
data
12STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
Quasi Indep. model – predicted values
data
13STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
14STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
Quasi Symmetry model
data
15STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
Quasi symmetry
16STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
17STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
18STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
19STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
20STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
21STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
10.4.7 Premarital and extramarital sex example revisited
symm
qi - quasi indep.
22STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairsproc 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;
G2=402.2 DF=6
G2=1.36 DF=3
G2=2.09 DF=5
G2=7.04 DF=5
G2=8.32 DF=8
G2=15.5 DF=5
G2=1.43 DF=4
23STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
24STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
proc genmod data=sex; class symm;
model count = symm extramar premar / dist=poi link=log; * ordinal QS;
25STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels 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;
26STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels 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*/
27STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
28STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
29STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
30STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels 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;
G2=8.32 DF=8
G2=15.5 DF=5
G2=1.43 DF=4
G2=2.09 DF=5
31STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
32STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
Models Summary of IXI table
Define two variables, such as
symm - symmetry
qi - quasi indepedence
33STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels 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;
34STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels 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;
35STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
proc genmod data=sex; class symm;
model count = symm tao/ dist=poi link=log; * conditional symmetry;
Note:
symm - symmetry
36STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
Symmetry, Ordinal Quasi-symmetry, conditional symmetry
Logistic form
37STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairsdata 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*/
38STA 617 – Chp10 STA 617 – Chp10 Models for matched pairsModels for matched pairs
Log-linear model form
top related