1. Home
  2. APOWER procedure

APOWER procedure

Calculates the power (probability of detection) for terms in an analysis of variance (R.W. Payne).


PRINT = string token Prints the power (power); default powe
TERM = formula Treatment term to be assessed in the analysis
TREATMENTSTRUCTURE = formula Treatment structure of the design; determined automatically from an ANOVA save structure if TREATMENTSTRUCTURE is unset or if SAVE is set
BLOCKSTRUCTURE = formula Block structure of the design; determined automatically from an ANOVA save structure if BLOCKSTRUCTURE is unset or if SAVE is set
FACTORIAL = scalar Limit on the number of factors in treatment terms; default 3
PROBABILITY = scalar Significance level at which the response is required to be detected (assuming a one-sided test); default 0.05
TMETHOD = string token Type of test to be made (onesided, twosided, equivalence, noninferiority, fratio); default ones
XCONTRASTS = variate X-variate defining a contrast to be detected
CONTRASTTYPE = string token Type of contrast (regression, comparison) default rege
SAVE = asave ANOVA save structure to provide the information about the design


RESPONSE = scalars, variates or tables Size of the difference or contrast between the effects of TERM that is to be detected, or (for TMETHOD=fratio) pattern of effects or means to be detected
RMS = scalars Anticipated residual mean square corresponding to TERM; can be omitted if a SAVE structure is available
POWER = scalars or variates Power (i.e. probability of detection) for RESPONSE


When assessing an experimental design, it can be useful to know how likely a treatment response of a specified size may be detected. This probability of detection, known as the power of the design with respect to the response of interest, helps to determine whether the experiment is sufficiently large or accurate to achieve its purpose.

The treatment term to test is specified using the TERM option of APOWER, and the difference that you want to detect between its effects is given by the RESPONSE parameter. As an alternative to detecting a difference between treatment effects, you can ask to detect a contrast. However, here the treatment term must be a main effect (that is, TERM must involve just one factor). The XCONTRASTS option then species a variate containing the coefficients defining the contrast, and the CONTRASTTYPE option indicates whether this is a regression contrast (as specified by the REG function) or a comparison (as specified by COMPARISON).

The PROBABILITY option specifies the significance level that you will be using in the analysis to detect the treatment difference or contrast; the default is 0.05, i.e. 5%. By default, APOWER assumes that a one-sided t-test is to be used, but you can set option TMETHOD=twosided to take a two-sided t-test instead.

Other settings of TMETHOD enable you to test for equivalence or for non-inferiority. With equivalence (TMETHOD=equivalence), RESPONSE defines a threshold below which the treatments can be assumed to be equivalent. If the treatments have effects e1 and e2, the null hypothesis that the treatments are not equivalent is that either

(e1e2) ≤ –RESPONSE


(e1e2) ≥ RESPONSE

with the alternative hypothesis that they are equivalent, i.e.


(For further details see the Method information for procedure ASAMPLESIZE.) With non-inferiority (TMETHOD=noninferiority), RESPONSE again specifies the threshold for the effect of one treatment to be superior to another. So, for example, to demonstrate non-inferiority of treatment 1 compared to treatment 2, the null hypothesis becomes

(e1e2) ≥ –RESPONSE

which represents a simple one-sided t-test.

You can also set TMETHOD=fratio, to assess the power of the F test in the analysis of variance table to detect a pattern of effects for TERM. You can specify the pattern by setting RESPONSE to a table containing the anticipated effects or means. Alternatively, you can set it to a y-variate containing, in each unit, the value of the effect or mean for the treatment (or treatment combination) to be applied to that unit of the design.

To determine the power, you need to define the design and specify the anticipated residual mean square for the stratum where the treatment term is estimated. This is most easily obtained by taking the analysis of a design with similar units and the same block and treatment structures as those that are to be used in the new design. To do this, you should analyse the earlier set of data with the ANOVA directive in the usual way. First define the strata (or error terms) for the design using the BLOCKSTRUCTURE directive, and the treatment model to be fitted using the TREATMENTSTRUCTURE directive. Then analyse the y-variate using the ANOVA directive. Provided you do not give any other ANOVA commands in the interim, APOWER will pick up the information automatically from the save information held within Genstat about the most recent ANOVA analysis. Alternatively, you can save the information explicitly in an ANOVA save structure, using the SAVE parameter of ANOVA, and then use this same save structure as the setting of the SAVE option of APOWER.

If you do not have a suitable earlier set of data, you should set up the design factors to contain the values required to define the units of the design. Then use the BLOCKSTRUCTURE and TREATMENTSTRUCTURE options of APOWER to define the strata and the treatment model, and the RMS option to specify the anticipated residual mean square for the stratum where TERM is estimated. There is also the compromise possibility that you can take the information about the design, the strata and treatment model from an ANOVA save structure (generated for example by the analysis of an artificial data set), but use the RMS parameter to specify a different residual mean square from the one in the analysis in the save structure. The treatment terms to be included are controlled by the FACTORIAL option; this sets a limit (by default 3) on the number of factors in a treatment term: terms containing more than that number are deleted.

The POWER parameter can save the power. This is printed by default, but you can set option PRINT=* to stop this.




The standard error of difference between two treatment effects is

√( s2 × 2 / (r × e))

where s2 is the residual mean square of the stratum where the treatment term is estimated, e is the efficiency factor, and r is the replication of each effect. For a regression contrast the standard error is

√( s2 × 2 / (r × sdiv × e))

where sdiv is the sum of squares of the XCONTRASTS variate, and for a comparison contrast the standard error is

√( s2 × sdiv / (r × e))

APOWER assumes that the treatment effects have equal replication. Unequal replication can be studied by defining a comparison between the effects. For example, to allow for a control level with two replicates, you could assume that the first two levels are for the control, and then study comparisons between their mean and the other levels.

See also

Directive: ANOVA.


Commands for: Analysis of variance, Design of experiments.


CAPTION  'APOWER example',!t('Split plot design',\
         '(Yates,F: The Design and Analysis of Factorial Experiments,',\
         'Commonwealth Bureau of Soils, Tech. Comm. 35, p.74)');\
&        [LEVELS=3] Wplot
&        [LEVELS=4] Subplot
GENERATE Block,Wplot,Subplot
FACTOR   [NVAL=72; LABELS=!T('0 cwt','0.2 cwt','0.4 cwt','0.6 cwt')] Nitrogen
&        [NVAL=72; LABELS=!T(Victory,'Golden rain',Marvellous)]      Variety
READ     [SERIAL=yes] Nitrogen,Variety
 4 3 2 1 1 2 4 3 1 2 3 4 3 1 2 4 4 1 2 3 2 1 3 4
 2 3 4 1 4 2 3 1 1 4 2 3 3 4 1 2 1 3 4 2 2 3 4 1
 4 1 3 2 3 4 1 2 3 4 2 1 3 1 4 2 4 3 1 2 1 2 3 4 :
 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 1 1 1 1 2 2 2 2
 2 2 2 2 3 3 3 3 1 1 1 1 3 3 3 3 2 2 2 2 1 1 1 1
 2 2 2 2 1 1 1 1 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 :
READ     Yield
156 118 140 105 111 130 174 157 117 114 161 141
104  70  89 117 122  74  89  81 103  64 132 133
108 126 149  70 144 124 121  96  61 100  91  97
109  99  63  70  80  94 126  82  90 100 116  62
 96  60  89 102 112  86  68  64 132 124 129  89
118  53 113  74 104  86  89  82  97  99 119 121 :
MATRIX   [ROWS=!t('Victory & Golden rain versus Marvellous'); COLUMNS=3;\
         VALUES=1,1,-2] Vcomp
VARIATE  [VALUES=0,0.2...0.6] Nreg
BLOCKSTRUCTURE Block/Wplot/Subplot
ANOVA    [PRINT=aov,contrasts,means; FPROBABILITY=yes] Yield; SAVE=savesp
APOWER   [PRINT=power; TERM=Variety] 25; RMS=600
APOWER   [PRINT=power; TERM=Nitrogen] 15; RMS=200

APOWER   [PRINT=power; TERM=Variety; XCONTRASTS=!(#Vcomp);\
         CONTRASTTYPE=comparison] 30
APOWER   [PRINT=power; TERM=Nitrogen; XCONTRASTS=Nreg;\
         CONTRASTTYPE=regression] 20
Updated on March 8, 2019

Was this article helpful?