1. Home
2. A%VARIANCE procedure

# A%VARIANCE procedure

Calculates the percentage variance and sum of squares accounted for in the strata of an ANOVA analysis (R.W. Payne).

### Options

 `PRINT` = string tokens Controls printed output (`%variance`, `%ss`); default `%var` `METHOD` = string token Which terms to take into account (`treatments`, `blocksandtreatments`); default `trea` `%VARIANCE` = pointer Saves the percentage variance accounted for `%SS` = pointer Saves the percentage sum of squares accounted for `SAVE` = `ANOVA` save structure Save structure for the analysis; by default this will be the most recent `ANOVA`

### Description

Procedure `A%VARIANCE` calculates the percentage of the variance and of the sum of squares that are accounted for in the strata of an analysis of variance performed by the `ANOVA` directive. By default, this will be the most recent `ANOVA` analysis. However, you calculate these for an earlier analysis, by using the `SAVE` option of `A%VARIANCE` to specify its save structure (saved using the `SAVE` parameter of the earlier `ANOVA` command).

By default only the treatment terms estimated in the stratum concerned are included when accounting for its variance and sum of squares. For example, suppose we have a randomized-block design with block structure `Blocks / Plots = Blocks + Blocks.Plots` and a treatment term `Treat` estimated within blocks (i.e. in the `Blocks.Plots` stratum). The default, `METHOD=treatments`, assesses only how `Treat` accounts for the `Blocks.Plots` variation. Alternatively, if you set `METHOD=blocksandtreatments`, any block terms marginal to each stratum are also included. In this example the term `Blocks` is marginal to `Blocks.Plots`, and these blocks will have been defined in order to decrease the amount of within-block variation. So we may be want to use this setting to see how effective that has been.

Output is controlled by the `PRINT` option, with settings: `%variance` prints the percentage variance accounted for, and `%ss` prints the percentage sum of squares accounted for. By default `PRINT=%variance`. Options: `PRINT`, `METHOD`, `%VARIANCE`, `%SS`, `SAVE`. Parameters: none.

### Method

The percentage variance accounted for is calculated as

100 × (total mean square – residual mean square) / total mean square

and the percentage sum of squares accounted for is similarly calculated as

100 × (total sum of squares – residual sum of squares) / total sum of squares

For both methods, the residual mean squares and residual sums of squares are taken from the residual lines of the relevant strata in the original analysis of variance. To account only for treatments, `A%VARIANCE` does an analysis with the original block structure but no treatments. The totals are given by the sums of squares and mean squares of the relevant strata in that analysis. To account for marginal block terms as well as treatments, `A%VARIANCE` takes the sums of squares and mean squares for each stratum from an analysis containing only that stratum. (So no other block terms will have been fitted.)

Directive: `ANOVA`.
Commands for: Analysis of variance.

### Example

```CAPTION  'A%VARIANCE example',!t('Split plot design, see the',\
'Guide to Genstat, Part 2, Section 4.2.1.'); STYLE=meta,plain
FACTOR   [NVALUES=72; LEVELS=6] Blocks
&        [LEVELS=3] Wplots
&        [LEVELS=4] Subplots
GENERATE Blocks,Wplots,Subplots
FACTOR   [LABELS=!T('0 cwt','0.2 cwt','0.4 cwt','0.6 cwt')] Nitrogen
&        [LABELS=!T(Victory,'Golden rain',Marvellous)]      Variety
VARIATE  Yield; DECIMALS=2; EXTRA=' of oats in cwt. per acre'
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 :
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 :
" Convert yields to cwt per acre."
CALCULATE  Yield=(Yield*80)/(112*4)
" Define the treatment structure: factorial effects of V and N."
TREATMENTS Variety*Nitrogen
" Subplots nested within whole-plots nested within blocks."
BLOCK      Blocks/Wplots/Subplots
ANOVA      [PRINT=means] Yield
A%VARIANCE [PRINT=%variance,%ss]
&          [METHOD=blocksandtreatments]```
Updated on February 2, 2023