rpower | Retrospective power analysis for univariate GLMs | rpower |
The program reads the OUTSTAT= data set constructed in a PROC GLM step. For each effect tested, the program calculates the nominal power of the test, if the sample means were population values. For specified alpha and power values, the required sample size to achieve that power is also determined.
For proper power analysis and sample size planning, you should consider the size of differences among groups which are meaningful to detect in terms of the research questions.
proc glm data= outstat=STATS; class classvars; model depvars = independents / SS3; * use SSn option; contrast 'name' effect {coefficients};For each dependent variable, and for every effect tested on the MODEL statement or in a CONTRAST statement, observations in the OUTSTAT= dataset will be produced. If you do not specify an SSn option on the MODEL statement, GLM will produce both Type I (SS1) and Type III (SS3) sum of squares. The rpower macro calculates the power for each of these.
Then invoke the rpower macro, supplying the OUTSTAT= dataset as the data= parameter to rpower
%rpower; %rpower(data=STATS, ..., )There are no required parameters.
power=.70 to .9 by .1 power=%str(.7, .8, .85) power=%str(.5, .70 to .9 by .1)
data learning; do grade = 5,12; do words = 'low ', 'high'; do feedback = 'Control', 'Pos', 'Neg'; input mean @@; output; end; end; end; lines; 8.8 8.0 7.6 8.0 4.4 3.8 9.0 8.4 8.0 7.8 7.4 7.2 ; %stat2dat(data=learning, class=grade words feedback, out=raw, mean=mean, n=5, MSE=1.75, depvar=recall);The GLM step tests all effects up to the 3-way interaction, plus a contrast of the FEEDBACK variable. The OUTSTAT= dataset is read by the rpower macro:
proc glm data=raw outstat=stats; class feedback words grade; model recall = feedback|words|grade / ss3; contrast 'Cont:+,-' feedback -2 1 1; freq freq; %include macros(rpower); *-- or include in an autocall library; %rpower(data=stats);The output from the rpower macro:
F Nominal Adj. Non- SOURCE _NAME_ _TYPE_ DF Value power power Centrality FEEDBACK RECALL SS3 2 9.61 0.975 0.950 19.22 WORDS RECALL SS3 1 29.87 1.000 0.999 29.87 FEEDBACK*WORDS RECALL SS3 2 1.61 0.324 0.134 3.22 GRADE RECALL SS3 1 12.34 0.931 0.897 12.34 FEEDBACK*GRADE RECALL SS3 2 3.11 0.573 0.390 6.23 WORDS*GRADE RECALL SS3 1 6.44 0.701 0.606 6.44 FEEDBACK*WORDS*GRADE RECALL SS3 2 2.47 0.472 0.280 4.93 Cont:+,- RECALL CONTRAST 1 18.30 0.987 0.979 18.30 Adj_Non- Req'd Total Req'd SOURCE _NAME_ Centrality N N power ALPHA FEEDBACK RECALL 16.42 2.2 7.5 0.9 0.05 WORDS RECALL 27.62 1.9 3.6 0.9 0.05 FEEDBACK*WORDS RECALL 1.08 12.7 447.4 0.9 0.05 GRADE RECALL 10.83 2.4 7.0 0.9 0.05 FEEDBACK*GRADE RECALL 3.97 4.4 44.3 0.9 0.05 WORDS*GRADE RECALL 5.17 3.4 15.8 0.9 0.05 FEEDBACK*WORDS*GRADE RECALL 2.73 5.8 82.8 0.9 0.05 Cont:+,- RECALL 16.54 2.2 5.0 0.9 0.05