Hello all,
Some time ago, I wrote a code for power analysis for t-test, based on Rick's book on Simulations with SAS, and following a bug Rick published this code instead (here in the forum - the code is incomplete, I didn't want to publish it all although Rick already did):
/********************************************************************
Effect of Sample Size on the Power of the t Test
*******************************************************************/
%let NumSamples = 1000; /* number of samples */
data PowerSizeSim(drop=i Delta);
call streaminit(321);
Delta = 3; /* true difference between means */
do N = 5, 7, 8, 10, 12, 15, 20;/* sample size */
do SampleID = 1 to &NumSamples;
do i = 1 to N;
c = 1; x1 = rand("Normal", 0, 2); output;
c = 2; x1 = rand("Normal", Delta, 2); output;
end;
end;
end;
run;
/* 2. Compute statistics */
%ODSOff
proc ttest data=PowerSizeSim;
by N SampleID;
class c;
var x1;
ods output ttests=TTests(where=(method="Pooled"));
run;
%ODSOn
/* 3. Construct indicator var for obs that reject H0 */
data ResultsSize;
set TTests;
RejectH0 = (Probt <= 0.05);
run;
proc freq data=ResultsSize noprint;
by N;
tables RejectH0 / out=SimPower(where=(RejectH0=1));
run;
Now I want to make a change, and I am not sure how to.
Instead of t-test, I want multiple tests. For example, the classic case: Clinical trial with 2 doses and a placebo, i.e., 2 comparisons (T1 vs. P and T2 vs. P). I want to use PROC MULTTEST with the Hochberg adjustment for the p values, and I define success to be when at least one dose is significantly different than the placebo (more precisely the outcome variable X is different) . For simplicity we can assume equal variances. How would you change the syntax to to that ?
I think (not sure) that the inner procedure I need is:
ods output pValues = PV;
proc MULTTEST data = testdata hochberg pvals;
class Group;
test mean(X);
contrast 'T1 vs. P' -1 1 0;
contrast 'T2 vs. P' -1 0 1;
run;
It already creates a dataset with p values. So I need an assistant just in integrating it all.
Thank you in advance !