/* /* Chapter 3 ++++++++++++++++++++++++++++++++++++++++++++ page 39 Program 3.1 */ data d1; infile 'c:\book\RepeatedMeasure\experimentRat.dat' missover; input id group week y; run; /* type=cs */ proc mixed data = d1 method=reml covtest; class id group week/ref=first ; model y = group week group*week / s cl ddfm=sat ; repeated / type = cs subject = id r rcorr ; estimate 'mean CFB ' group*week 1 1 1 -3 -1 -1 -1 3 / divisor=3 cl alpha=0.05 ; run ; /* type=ar(1) */ proc mixed data = d1 method=reml covtest; class id group week/ref=first ; model y = group week group*week / s cl ddfm=sat ; repeated / type = ar(1) subject = id r rcorr ; estimate 'mean CFB ' group*week 1 1 1 -3 -1 -1 -1 3 / divisor=3 cl alpha=0.05 ; run ; /* type=toep */ proc mixed data = d1 method=reml covtest; class id group week/ref=first ; model y = group week group*week / s cl ddfm=sat ; repeated / type = toep subject = id r rcorr ; estimate 'mean CFB ' group*week 1 1 1 -3 -1 -1 -1 3 / divisor=3 cl alpha=0.05 ; run ; /* type=un */ proc mixed data = d1 method=reml covtest; class id group week/ref=first ; model y = group week group*week / s cl ddfm=sat ; repeated / type = un subject = id r rcorr ; estimate 'mean CFB ' group*week 1 1 1 -3 -1 -1 -1 3 / divisor=3 cl alpha=0.05 ; run ; /* ++++++++++++++++++++++++++++++++++++++++++++ page 45 Program 3.2 */ data d1; infile 'c:\book\RepeatedMeasure\experimentRat.dat' missover; input id group week y; run; /* type=cs */ proc mixed data = d1 method=reml covtest; class id group week/ref=first ; model y = group week group*week / s cl ddfm=sat ; repeated / type = cs subject = id r rcorr group=group ; estimate 'mean CFB ' group*week 1 1 1 -3 -1 -1 -1 3 / divisor=3 cl alpha=0.05 ; run ; /* type=un */ proc mixed data = d1 method=reml covtest; class id group week/ref=first ; model y = group week group*week / s cl ddfm=sat ; repeated / type = un subject = id r rcorr group=group ; estimate 'mean CFB ' group*week 1 1 1 -3 -1 -1 -1 3 / divisor=3 cl alpha=0.05 ; run ; /* ++++++++++++++++++++++++++++++++++++++++++++ page 49 Program 3.3 (the case with Model Cd) */ data d3; infile 'c:\book\RepeatedMeasure\experimentRatPre.dat' missover; input id group week y ybase; cfb=y-ybase; run; /* Model Ad */ proc mixed data = d3 method=reml covtest; class id group week ; model cfb = group week group*week / s ddfm=sat ; repeated / type = un subject = id r rcorr ; estimate 'CFB at week 1' group -1 1 group*week -1 0 0 1 0 0 / divisor=1 cl alpha=0.05; estimate 'CFB at week 2' group -1 1 group*week 0 -1 0 0 1 0 / divisor=1 cl alpha=0.05; estimate 'CFB at week 3' group -1 1 group*week 0 0 -1 0 0 1 / divisor=1 cl alpha=0.05; estimate 'mean CFB ' group -3 3 group*week -1 -1 -1 1 1 1 / divisor=3 cl alpha=0.05; run ; /* Model Bd */ proc mixed data = d3 method=reml covtest; class id group week ; model cfb = ybase group week group*week / s ddfm=sat ; repeated / type = un subject = id r rcorr ; estimate 'CFB at week 1' group -1 1 group*week -1 0 0 1 0 0 / divisor=1 cl alpha=0.05; estimate 'CFB at week 2' group -1 1 group*week 0 -1 0 0 1 0 / divisor=1 cl alpha=0.05; estimate 'CFB at week 3' group -1 1 group*week 0 0 -1 0 0 1 / divisor=1 cl alpha=0.05; estimate 'mean CFB ' group -3 3 group*week -1 -1 -1 1 1 1 / divisor=3 cl alpha=0.05; run ; /* Model Cd */ proc mixed data = d3 method=reml covtest; class id group week ; model cfb = ybase ybase*week group week group*week / s ddfm=sat ; repeated / type = un subject = id r rcorr ; estimate 'CFB at week 1' group -1 1 group*week -1 0 0 1 0 0 / divisor=1 cl alpha=0.05; estimate 'CFB at week 2' group -1 1 group*week 0 -1 0 0 1 0 / divisor=1 cl alpha=0.05; estimate 'CFB at week 3' group -1 1 group*week 0 0 -1 0 0 1 / divisor=1 cl alpha=0.05; estimate 'mean CFB ' group -3 3 group*week -1 -1 -1 1 1 1 / divisor=3 cl alpha=0.05; run ; /* ML estimation of the Model Cd, for example, for comparison of three models Ad, Bd and Cd */ proc mixed data = d3 method=ml covtest; class id group week ; model cfb = ybase ybase*week group week group*week / s ddfm=sat ; repeated / type = un subject = id r rcorr ; estimate 'CFB at week 1' group -1 1 group*week -1 0 0 1 0 0 / divisor=1 cl alpha=0.05; estimate 'CFB at week 2' group -1 1 group*week 0 -1 0 0 1 0 / divisor=1 cl alpha=0.05; estimate 'CFB at week 3' group -1 1 group*week 0 0 -1 0 0 1 / divisor=1 cl alpha=0.05; estimate 'mean CFB ' group -3 3 group*week -1 -1 -1 1 1 1 / divisor=3 cl alpha=0.05; run ;