1. Home
  2. ASAMPLESIZE procedure

ASAMPLESIZE procedure

Finds the replication to detect a treatment effect or contrast (R.W. Payne & P. Brain).

Options

PRINT = string tokens Prints the replication or produces a printed summary of the power etc for the various amounts of replication (power, replication); default powe, repl
TERM = formula Treatment term to be assessed in the analysis
REPLICATES = factor Factor identifying the replication in the design
MINREPLICATION = scalar Minimum number of replicates to try; default 2
MAXREPLICATION = scalar Maximum feasible number of replicates; default * i.e. no limit
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
COMPONENTS = variate or scalar Variate of variance components of all the terms in the block structure or, if TERM is estimated in the final stratum of the design, scalar containing only the variance component of the final stratum itself; determined automatically (if possible) from an ANOVA save structure if unset
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
POWER = scalar The required power (i.e. probability of detection) of the test; default 0.9
TMETHOD = string token Type of test to be made (onesided, twosided, equivalence, noninferiority, fratio); default ones
XCONTRASTS = variate X-variate defining a 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

Parameters

RESPONSE = scalars Size of the difference or contrast between TERM effects that is to be detected
NREPLICATES = scalars Number of replicates required to detect RESPONSE

Description

When designing an experiment, it is often possible to vary the replication of the treatments. For example, in a randomized block design you can adjust the number of blocks, or in a design with no blocking structure you can choose how many units to allocate to each of the treatments.

To decide how many replicates to include, you need to specify the size of difference between treatment effects that you would like the design to be able to detect. The treatment term of interest is specified using the TERM option of ASAMPLESIZE, 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, but here the treatment term must be a main effect (that is, TERM must involve just one factor). The XCONTRASTS option then specifies 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 future analysis to detect the treatment difference (default 0.05, i.e. 5%). The POWER option specifies the probability with which you want the experiment to be able to detect the difference (that is, the power of the test); by default this is 0.9 i.e. 90%. In the language of hypothesis testing, PROBABILITY specifies the type I error rate, and POWER specifies one minus the type II error rate. By default, ASAMPLESIZE assumes a one-sided t-test is to be used, but you can set option TMETHOD=twosided to take a two-sided t-test instead. Alternatively, if you set TMETHOD=fratio, ASAMPLESIZE takes RESPONSE as the maximum difference between the effects of TERM, and uses

an F-test.

Other settings of TMETHOD enable you to test for equivalence or for non-inferiority. With equivalence (TMETHOD=equivalence), RESPONSE provides 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

or

(e1e2) ≥ RESPONSE

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

RESPONSE < (e1e2) < RESPONSE

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, in fact, represents a simple one-sided t-test).

To determine the replication, ASAMPLESIZE needs to know the about the structure of the design, and the likely amount of variability. 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. Provided you do not give any other ANOVA commands in the interim, ASAMPLESIZE will pick up the information automatically from the save information held within Genstat about that 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 ASAMPLESIZE.

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 for any convenient number of replicates. (It does not matter how many replicates you choose, as the form of the design should be the same in every replicate.) Then use the TREATMENTSTRUCTURE and BLOCKSTRUCTURE options of ASAMPLESIZE to define the treatment model and the block model, and the COMPONENTS option to specify the variance components of the strata. Note: if TERM is estimated in the bottom (or final) stratum of the design, COMPONENTS can be set to a scalar to specify only the variance component of this stratum – which is then equal to its residual mean square.

There is also the compromise possibility that you can take the information about the design and the block and treatment model from an ANOVA save structure (generated for example by the analysis of an artificial data set), but use the COMPONENTS option to specify different variance components from those 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. Treatment terms containing more than that number are deleted.

Finally, you must set the REPLICATES option to the factor in the block formula whose number of levels is to be increased or decreased to change the replication of the treatments. You can set the MINREPLICATION option to indicate the minimum number of replicates to try; by default this is 2. You can use the MAXREPLICATION option to define a maximum feasible number of replicates; by default this is no limit. The number of replicates that is required can be saved using the NREPLICATES parameter.

The PRINT option controls the printed output, with settings:

    power prints a table summarising the situation for a range of numbers of replicates (defined by MINREPLICATION and MAXREPLICATION if set, otherwise set automatically to a range covering the required number of replicates) – the table contains the residual degrees of freedom, the residual mean square, the standard error of difference (sed), RESPONSE divided by the sed, the t-value for a difference of RESPONSE, and the detection probability (i.e. power) at the level defined by the PROBABILITY option;
    replication prints the required replication.

By default both are printed.

For example, the following program would determine the number of blocks required to detect a treatment difference of 3 in a randomized block design with an anticipated residual mean square of 2.5 in the final stratum Block.Plot (i.e. within blocks); there is a single treatment factor Treat with 3 levels. We first use AGHIERARCHICAL to define the design for one replicate (or block), and then call ASAMPLESIZE to discover how many blocks are actually needed.

AGHIERARCHICAL [PRINT=*; ANALYSE=no; SEED=-1] Block,Plot;\

               TREATMENTFACTORS=*,Treat; LEVELS=1,3

ASAMPLESIZE [PRINT=power,rep; TERM=Treat;\

               REPLICATES=Block; TREATMENTSTRUCTURE=Treat;\

               BLOCKSTRUCTURE=Block/Plot; COMPONENT=2.5]\

               1; NREPLICATES=Nrep

As another example, suppose we wish to have a split-plot design, with block structure Rep/Wplot/Subplot. The factor Variety with 3 levels is applied to whole plots (and is thus estimated in the Rep.Wplot stratum) and the factor Nitrogen with 4 levels is applied to the sub-plots (and is thus estimated in the Rep.Wplot.Subplot stratum). The variance components for Rep, Rep.Wplot and Rep.Wplot.Subplot are anticipated to be 6, 3 and 5 respectively, and we wish to detect varietal differences of 3. Again we first define a split-plot with a single replicate, and then use ASAMPLESIZE to find out how many reps we need.

AGHIERARCHICAL [PRINT=*; ANALYSE=no; SEED=-1]\

               Rep,Wplot,Subplot;\

               TREATMENTFACTORS=*,Variety,Nitrogen;\

               LEVELS=1,3,4

ASAMPLESIZE [PRINT=power,rep; TERM=Variety;\

               REPLICATES=Rep;\

               TREATMENTSTRUCTURE=Variety*Nitrogen;\

               BLOCKSTRUCTURE=Rep/Wplot/Subplot;\

               COMPONENTS=!(6,3,5)] 3; NREPLICATES=Nrep

Options: PRINT, TERM, REPLICATES, MINREPLICATION, MAXREPLICATION, TREATMENTSTRUCTURE, BLOCKSTRUCTURE, COMPONENTS, FACTORIAL, PROBABILITY, POWER, TMETHOD, XCONTRASTS, CONTRASTTYPE, SAVE.

Parameters: RESPONSE, NREPLICATES.

Method

The standard error of difference between two treatment effects is

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

where s2 is the stratum variance 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))

ASAMPLESIZE assumes that the treatment effects have equal replication, and also that all the effects (or residuals) of each block term have equal replication.

The stratum variance can be calculated as the variance component of the stratum S where the treatment term is estimated multiplied by the replication of its effects (residuals), plus the variance component of each stratum to which the stratum S is marginal, again multiplied by the replication of its effects (residuals). See for example Payne & Tobias (1992).

Comparing the null hypothesis that the treatments are not equivalent, i.e.

(m1m2) ≤ –d

or

(m1m2) ≥ d

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

d < (m1m2) < d

defines an intersection-union test, in which each component of the null hypothesis must be rejected separately. Here this implies performing two one-sided t-tests (this is known as a TOST procedure). If the significance level for the full test is to be α, each t-test must have significance level α (see Berger & Hsu 1996). To obtain a detection probability (or power) of (1 – β), each of the t-tests must have detection probabilities of (1 – β/2).

To demonstrate non-inferiority of treatment 1 compared to treatment 2, the null hypothesis is

(m1m2) ≥ –d

This is equivalent to a one-sided t-test.

For the F-test, it is assumed that one effect will be -0.5 × RESPONSE, another will be 0.5 × RESPONSE, and the others will be zero. This gives the smallest sum of squares for any table of effects with a maximum pair-wise difference of RESPONSE, which represents the most difficult case that needs to be detected.

References

Berger, M.L. & Hsu, J.C. (1996). Bioequivalence trials, intersection-union tests and equivalence confidence sets. Statistical Science, 11, 283-319.

Payne, R.W. & Tobias, R.D. (1992). General balance, combination of information and the analysis of covariance. Scandinavian Journal of Statistics, 19, 3-23.

See also

Directive: ANOVA.

Procedures: ADETECTION, APOWER, STTEST, VSAMPLESIZE.

Commands for: Design of experiments, Analysis of variance.

Example

CAPTION 'ASAMPLESIZE example',\
     !t('1) determine the number of blocks required to detect a treatment',\
        'difference of 3 in a randomized block design with anticipated',\
        'residual mean square of 2.5 in the final stratum Block.Plot;',\
        'there is a single treatment factor Treat with 3 levels.');\
        STYLE=meta,plain
AGHIERARCHICAL [PRINT=*; ANALYSE=no; SEED=-1] Block,Plot;\
               TREATMENTFACTORS=*,Treat; LEVELS=1,3
ASAMPLESIZE    [PRINT=power,rep; TERM=Treat; REPLICATES=Block;\
               TREATMENTSTRUCTURE=Treat; BLOCKSTRUCTURE=Block/Plot;\
               COMPONENT=2.5] 3; NREPLICATES=Nrep
PRINT          Nrep; DECIMALS=0
CAPTION !t('2) Suppose we have a split-plot design with block structure',\
        'Rep/Wplot/Subplot. The factor Variety with 3 levels is applied',\
        'to whole plots (and so is estimated in the Rep.Wplot stratum)',\
        'and factor Nitrogen with 4 levels is applied to the sub-plots',\
        '(and is thus estimated in the Rep.Wplot.Subplot stratum).',\
        'Variance components for Rep, Rep.Wplot and Rep.Wplot.Subplot',\
        'are anticipated to be 6, 3 and 5 respectively, and we wish to',\
        'detect varietal differences of 3.')
AGHIERARCHICAL [PRINT=*; ANALYSE=no; SEED=-1] Rep,Wplot,Subplot;\
               TREATMENTFACTORS=*,Variety,Nitrogen; LEVELS=1,3,4
ASAMPLESIZE    [PRINT=power,rep; TERM=Variety; REPLICATES=Rep;\
               TREATMENTSTRUCTURE=Variety*Nitrogen;\
               BLOCKSTRUCTURE=Rep/Wplot/Subplot; COMPONENTS=!(6,3,5)]\
               3; NREPLICATES=Nrep
PRINT          Nrep; DECIMALS=0
CAPTION !t('3) Suppose we have a split-plot design as in (2) and we wish',
        'to detect differences of 3 between the nitrogen levels.')
ASAMPLESIZE    [PRINT=power,rep; TERM=Nitrogen; REPLICATES=Rep;
               TREATMENTSTRUCTURE=Variety*Nitrogen;
               BLOCKSTRUCTURE=Rep/Wplot/Subplot; COMPONENTS=!(6,3,5)]
               3; NREPLICATES=Nrep
PRINT          Nrep; DECIMALS=0
CAPTION !t('4) Suppose we have a split-plot design as in (2) and we wish',\
        'to detect a comparison of size 3 between the mean of the',\
        'first two varieties and the third variety.')
ASAMPLESIZE    [PRINT=power,rep; TERM=Variety; REPLICATES=Rep;\
               TREATMENTSTRUCTURE=Variety*Nitrogen;\
               BLOCKSTRUCTURE=Rep/Wplot/Subplot; COMPONENTS=!(6,3,5);\
               XCONTRASTS=!(0.5,0.5,-1); CONTRASTTYPE=comparison]\
               3; NREPLICATES=Nrep
PRINT          Nrep; DECIMALS=0
CAPTION !t('5) Suppose we have a split-plot design as in (2) and we wish',\
        'to detect a regression contrast of size 5 between nitrogen',\
        'levels 0.1, 0.2, 0.3 and 0.4.')
ASAMPLESIZE    [PRINT=power,rep; TERM=Nitrogen; REPLICATES=Rep;\
               TREATMENTSTRUCTURE=Variety*Nitrogen;\
               BLOCKSTRUCTURE=Rep/Wplot/Subplot; COMPONENTS=!(6,3,5);\
               XCONTRASTS=!(0.1,0.2...0.4)] 5; NREPLICATES=Nrep
PRINT          Nrep; DECIMALS=0
Updated on March 8, 2019

Was this article helpful?