/****************************************/
/* Import EG Toxicity Study Data */
/****************************************/
Proc IMPORT out=EG datafile= "C:\Users\Jenn\Documents\Mixed Models\Pregnant Mice EG Study\EG.xlsx"
DBMS=xlsx REPLACE; run;
title 'Preview EG Toxicity Data';
PROC PRINT data = EG (obs=10);
run;
/**************************************************************/
/* MODEL1: Marginal Model (GEE): Fetal Weight at Term */
/**************************************************************/
Proc IMPORT out=EG datafile= "C:\Users\Jenn\Documents\Mixed Models\Pregnant Mice EG Study\EG.xlsx"
DBMS=xlsx REPLACE; run;
PROC SORT data=EG;
by litterID dose;
run;
title 'Marginal Model (GEE) Dose as Categorical, CS covariance structure';
PROC MIXED data=EG empirical covtest;
CLASS litterID dose (ref="0");
MODEL Wgt = dose / solution DDFM=KR residual;
REPEATED / subject=dose(litterID) type=cs;
title 'Marginal Model: Dose (categorical) is Fixed; CS Covariance Structure';
ESTIMATE "low vs no dose" dose 1 0 0 -1 / cl alpha=0.01667;
ESTIMATE "med vs no dose" dose 0 1 0 -1 / cl alpha=0.01667;
ESTIMATE "high vs no dose" dose 0 0 1 -1 / cl alpha=0.01667;
LSMEANS dose / cl diff pdiff;
run;
/**********************************************************************************/
/* MODEL2: Marginal Logistic Regression Model: Probability of Malformation */
/**********************************************************************************/
Proc IMPORT out=EG datafile= "C:\Users\Jenn\Documents\Mixed Models\Pregnant Mice EG Study\EG.xlsx"
DBMS=xlsx REPLACE; run;
title 'Marginal Model: Dose is Fixed; CS Covariance Structure';
PROC GENMOD data=EG descending plots=all;
CLASS litterID dose (ref="0");
MODEL Malform = dose / dist=binomial type3;
REPEATED subject=litterID / type=cs corrw covb CORRB;
ESTIMATE "OR Low vs No Dose" dose 1 0 0 -1 / exp;
ESTIMATE "OR Med vs No Dose" dose 0 1 0 -1 / exp;
ESTIMATE "OR High vs No Dose" dose 0 0 1 -1 / exp;
ESTIMATE "OR Med vs Low Dose" dose -1 1 0 0 / exp;
ESTIMATE "OR High vs Low Dose" dose -1 0 1 0 / exp;
ESTIMATE "OR High vs Medium Dose" dose 0 -1 1 /exp;
LSMEANS dose / cl diff pdiff or;
ESTIMATE "Prob of Malform for No Dose" int 1 dose 0 0 0 1 / exp;
ESTIMATE "Prob of Malform for Low Dose" int 1 dose 1 0 0 0 / exp;
ESTIMATE "Prob of Malform for Med Dose" int 1 dose 0 1 0 0 / exp;
ESTIMATE "Prob of Malform for High Dose" int 1 dose 0 0 1 0 / exp;
OUTPUT out=new3 P=PRED L=LOWER U=UPPER;
run;
symbol1 i = join v=circle l=32 c = black;
symbol2 i = join v=star l=32 c = black;
symbol3 i = join v=star l=32 c = black;
PROC GPLOT data=new3;
PLOT PRED*dose LOWER*dose UPPER*dose / overlay;
title 'Estimated Logistic Curve from our Marginal Model';
run;