mpower Retrospective power analysis for multivariate GLMs mpower

SAS Macro Programs: mpower

$Version: 1.0 (17 Nov 2003)
Michael Friendly
York University

The mpower macro ( [download] get

Retrospective power analysis for multivariate GLMs

The mpower macro performs retrospective power analysis for a multivariate PROC GLM analysis. This treats the sample means as if they were population means, determines an effect size, and calculates the power for specified effects.

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.


To interpret the results of retrospective power analysis properly, you need to understand that the power and sample size values computed are direct functions of the sample p-values for effects in the analysis. Small p-values (large effects) imply large power and vice versa.

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.


The macro uses SAS/IML to extract the SSCP matrices for hypothesis (H) and error (E) from the OUTSTAT= dataset. The test statistics (Wilks' Lambda, Pillai Trace Criterion, etc.) are functions of the latent roots of HE-1, and each of these is converted to an (approximately) equivalent F-statistic.

Power is then calculated from the equivalent F-statistic.


First run a PROC GLM analysis of your data using the OUTSTAT= option to create a dataset containing summary statistics:
proc glm data=  outstat=STATS;                                
	class  classvars;                                          
	model  depvars = independents / SS3 nouni;  * use SSn option;
	contrast 'name' effect {coefficients};
	manova h=effects;                     
For every effect tested on the MODEL statement or in a CONTRAST statement, observations in the OUTSTAT= dataset will be produced containing the hypothesis SSCP matrix. 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 mpower macro calculates the power for each of these.

Then invoke the mpower macro, supplying the OUTSTAT= dataset as the data= parameter to mpower

   %mpower(data=STATS, ..., )
You must supply a value for the YVAR= parameter to specify the dependent variables in the dataset. The arguments may be listed within parentheses in any order, separated by commas. For example:
%mpower(data=STATS, yvar=depvars)
%mpower(data=STATS, yvar=depvars, alpha=.01, tests=WILKS ROY)


Default values are shown after the name of each parameter.
List of dependent varriables
OUTSTAT= data set from GLM. If not specified, the most recently created dataset is used.
The name of the output dataset. If not specified, the new dataset is named according to the DATAn convention.
Error rate for each test.
Specify any one or more of these multivariate tests for which power is computed.


This example examines data on tests of 4 brands of dogfood. For each animal, the AMOUNT eaten, and the time to START eating is records as a multivariate response.
%include data(dogfood);
title 'Retrospective Power Analysis: OneWay MANOVA Design';
proc glm order=data outstat=stats;
   class formula;
   model start amount  =  formula / ss3 nouni;
   contrast 'Ours vs. Theirs'     formula 1  1 -1 -1;
*  contrast 'Old - New'           formula 1 -1  0  0;
*  contrast 'Major vs. Alps'      formula 0  0  1 -1;
   manova h=formula;
Power analysis for the effect of FORMULA and the contrast 'Ours vs. Theirs' is carried out by the mpower macro:
%include macros(mpower);        *-- or include in an autocall library;
title2 'Multivariate power';
%mpower(data=stats, yvar=start amount);
The results include:
               Retrospective Power Analysis: OneWay MANOVA Design           
                               Multivariate power

                                     EFFECT              ALPHA
                  Power analysis for FORMULA SS3          0.05

                    Value        F    df1   df2     Eta##2 Non-Cent.     Power

 Wilks' Lambda      0.319    2.827      6    22     0.4353      8.48    0.4352
 Pillai's Trace     0.702    2.162      6    24     0.3509    6.4869    0.3414
 Lawley Trace       2.071    3.452      6    20     0.5088    10.357    0.5135
 Roy's max. Root    2.040    8.158      3    12      0.671    24.475    0.9529

                             EFFECT                              ALPHA
          Power analysis for Ours vs. Theirs CONTRAST             0.05

                    Value        F    df1   df2     Eta##2 Non-Cent.     Power

 Wilks' Lambda      0.375    9.178      2    11     0.6253    9.1778    0.6509
 Pillai's Trace     0.625    9.178      2    11     0.6253    9.1778    0.6509
 Lawley Trace       1.669    9.178      2    11     0.6253    9.1778    0.6509
 Roy's max. Root    1.669    9.178      2    11     0.6253    9.1778    0.6509

See also

canplot Canonical discriminant structure plot
fpower Power computations for ANOVA designs
rpower Retrospective power analysis for univariate GLMs