Section 13.5: Power Analysis for Repeated Measurements Power analysis for repeated measurements is a tricky and confusing issue to take on. However, from what appears in the 2nd edition of SAS for MIXED MODELS (Chapter 12) and a few other references, you can now easily estimate of power for a "within subjects" design of 3, 4, or any reasonable number of time points. The following concepts can also be extended to add in a between subjects grouping factor or other within factors, as will be demonstrated in other pages on this site. The key concept is to understand what a within subjects covariance matrix does and how is it computed from the sources of variation. With 3 time points, a compound symmetry structure (type=cs) is a reasonable starting point, although one would certainly want to try an ar(1) structure for equally spaced time points or even an unstructured, covariance matrix (type=un) if no prior info is available. With a CS structure, you have two sources of variation which drive the correlation matrix, namely subject: == .5 residual: == .9 Each individual observation is: y_ij = mu + subj_i + e_ij, 1=1... N_subjects, j=1,2,3 Assuming these two sources of variation are independent, the variance of a single observation is: VAR(y) = 0 + .5 + .9 = 1.4 You can simulate some correlated data for 10 subjects and analyze it with PROC MIXED to get a sense of how this works: * enter population parameters; %LET sub_var=.5; %LET res_var=.9; %LET nsb=10; %LET seed=1928; DATA tme; DROP subj_eff; DO subj = 1 to &nsb.; subj_eff = &sub_var.*rannor(&seed.); DO time=1 to 3; y = subj_eff + 1*(time=1)+ 2*(time=2)+ 2*(time=3) + &res_var. *rannor(&seed.); output; end; end; RUN; proc print NOobs n; run; ods output covparms=cvp; PROC MIXED data=tme NOitprint; CLASS time subj; MODEL y = time ; REPEATED / subject=subj type=cs rcorr r; LSMEANS time; ods output tests3=tst3; run; proc print data=cvp NOobs; FORMAT estimate 13.9; run; DATA _null_; SET cvp; IF lowcase(covparm) = 'cs' then call symput("sbj",estimate); IF lowcase(covparm) = 'residual' then call symput("res",estimate); RUN; %put &res &sbj ; /* Covariance Parameter Estimates CovParm Subject Estimate CS subj 0.094661373 Residual 1.035356225 Enter thevalues under Estimate into the PARMS statement below. Be sure to add the NOProfile and NOiter options as indicated. */ PROC MIXED data=tme NOitprint NOPROFILE ; CLASS time subj; MODEL y = time ; REPEATED / subject=subj type=cs rcorr r; PARMS (&res.) (&sbj.) / NOITER ; * enter the Estimates from Cov Par Table; LSMEANS time; ods output tests3=tst3; run; proc print data=tst3; run; /* Observe that by specifying these instructions, SAS does not calculate variances; yet you get the very same Type 3 test results and variances for LSMEANS and their associated pvalues. The above two analysis steps demonstrate how SAS works with 3 points over time from each subject, namely with regard to the sources of variation to compute a var/cov matrix. */ * To compute power, generate an exemplary dataset containing the expected means for the 3 time points for each of 10 subjects; DATA tm_mns; DO SUBJ= 1 TO &nsb.; *generate 10 subjects; DO time=1 to 3; y_mn = 1*(time=1)+ 2*(time=2)+ 2*(time=3) ; output; * no random variation needed; END; END; proc print; run; * since power calculations are based on population parameters, enter the population variances assigned to the macro variables at the beginning ; PROC MIXED data=tm_mns NOitprint NOPROFILE ; CLASS time; MODEL y_mn = time; REPEATED / subject=subj type=cs rcorr r; PARMS &res_var. &sub_var. / NOITER ; * enter the population variances; LSMEANS time; ODS OUTPUT tests3=tst3s; run; PROC PRINT DATA=tst3s; run; * compute power with Noncentrality value; DATA pwr; SET tst3s; Noncen = NumDF*Fvalue; alpha = .05; Fcrit = FINV(1-alpha, numdf, dendf, 0); power = 1- PROBF(Fcrit, NumDF, DenDF, Noncen); proc print NOobs; run; produces: Num Den Effect DF DF FValue ProbF Noncen alpha Fcrit power time 2 18 3.70 0.044958 7.40741 0.05 3.55456 0.6031