Thursday, April 8, 2010

Bioequivalence Using Proc Mixed

*****************************************************
Calculate Bioequivalence of Food Effect using Proc Mixed
**dataset has a parameter calculated for each subject
**can be cross-over or parallel study
****************************************************;

**create log data;
data logdata;
set dataset;
logparam=log(parameter);
keep Subject Parameter LOGparam fast period;
proc sort data=logdata;
by fast period subject;
run;
quit;

**ods output to data set, create mixed effect model ;
ods listing close;
ods output lsmeans=lsmeans_dataset;
ods output estimates=difflsmeans_dataset;

proc mixed data=logdata;
class fast period subject;
*class statement are categorical variables;
model LOGparam= fast;
*model statement is Y=Fixed Effects;
repeated period/subject=subject type=cs;
*means that for each period, there are repeated subjects, the covariance matrix type is compound symmetry;
lsmeans fast/pdiff cl alpha=.1;
*finds the least square means of groups in "fast", along with 90% CI;
estimate 'Fasted vs Fed' fast 1 -1/ cl alpha=0.1 E;
*estimates the difference between the groups in "fast" using 90% CI;
run;
ods output close;
ods listing;

LSM Table:



Estimates Table:



proc sql;
create table differences as
*create a table called "differences"
select referenceset.fast as reference,
referenceset.estimate as reflsm, exp(referenceset.estimate) as refgeolsm,
testset.fast as test, testset.estimate as testlsm, exp(testset.estimate) as testgeolsm,
testset.estimate-referenceset.estimate as Difference,
(calculated testgeolsm/calculated refgeolsm)*100 as Ratio
*select variables from dataset to calculate geometric least square means and ratio
from
(select * from lsmeans_dataset as referenceset where referenceset.fast='Y') inner join
(select * from lsmeans_dataset as testset where testset.fast='N')
on referenceset.effect=testset.effect
*pull individual rows from each dataset, linked by the same 'effect' variable
;
quit;

Differences Table Created using SQL:


**find 90%confidence intervals;

data CI;
set difflsmeans_dataset;
CI90_lower=100*exp(lower);
CI90_upper=100*exp(upper);
keep CI90_lower CI90_upper;
run;

***merge all data together;
data table;
merge differences ci;
run;

Final Table Output:



***Notes:
1. How does Proc Mixed compare to GLM and other statements?

No comments:

Post a Comment