proc import datafile='F:\consulting\dich.csv' out=dich dbms=csv replace; run;
/* McNemar test */
proc freq data=dich;
by group;
table before*after / agree;
run;
proc sql;
create table dich2 as
select group, id, before="TRUE" as before, after="TRUE" as after
from dich
;quit;
/* Logistic Regression */
proc sql;
create table logist as
select group, after-before as diff
from dich2
;quit;
proc logistic data=logist (where=(diff ne 0));
by group;
model diff=;
run;
proc logistic data=logist (where=(diff ne 0));
class group;
model diff=group;
run;
/* Generalized Mixed Models */
proc sql;
create table dich3 as
select group, id, 0 as period, before as y from dich2 union
select group, id, 1 as period, after as y from dich2
;quit;
proc glimmix data=dich3;
by group;
class group id period;
model y = period / link=logit dist=binomial;
random id;
run;
proc glimmix data=dich3;
class group id period;
model y = period | group / link=logit dist=binomial;
random id;
run;
Sunday, November 22, 2009
Subscribe to:
Posts (Atom)