Plots tables of means from `ANOVA`

(R.W. Payne).

### Options

`GRAPHICS` = string token |
Type of graph (`highresolution` , `lineprinter` ); default `high` |
---|---|

`METHOD` = string token |
What to plot (`means` , `lines` , `data` , `barchart` , `splines` ); default `mean` |

`XFREPRESENTATION` = string token |
How to label the x-axis (`levels` , `labels` ); default `labels` uses the `XFACTOR` labels, if available |

`PSE` = string token |
What to plot to represent variation (`differences` , `lsd` , `means` , `allmeans` ); default `diff` |

`LSDLEVEL` = scalar |
Significance level (%) to use for least significant differences; default 5 |

`DFSPLINE` = scalar |
Number of degrees of freedom to use when `METHOD=splines` |

`YTRANSFORM` = string tokens |
Transformed scale for additional axis marks and labels to be plotted on the right-hand side of the y-axis (`identity` , `log` , `log10` , `logit` , `probit` , `cloglog` , `square` , `exp` , `exp10` , `ilogit` , `iprobit` , `icloglog` , `root` ); default `iden` i.e. none |

`PENYTRANSFORM` = scalar |
Pen to use to plot the transformed axis marks and labels; default `*` selects a pen, and defines its properties, automatically |

`SAVE` = or `ANOVA` regression save structure |
Save structure to provide the table of means; default uses the save structure from the most recent `ANOVA` |

### Parameters

`XFACTOR` = factors |
Factor providing the x-values for each plot |
---|---|

`GROUPS` = factors or pointers |
Factor or factors identifying groups of points in each plot; by default chosen automatically |

`TRELLISGROUPS` = factors or pointers |
Factor or factors specifying the different plots of a trellis plot of a multi-way table |

`PAGEGROUPS` = factors or pointers |
Factor or factors specifying plots to be displayed on different pages |

`NEWXLEVELS` = variates |
Values to be used for `XFACTOR` instead of its existing levels |

`TITLE` = texts |
Title for the graph; default defines a title automatically |

`YTITLE` = texts |
Title for the y-axis; default is to use the identifier of the y-variate, or to have no title if this is unnamed |

`XTITLE` = texts |
Title for the x-axis; default is to use the identifier of the `XFACTOR` |

`PENS` = variates |
Defines the pen to use to plot the points and/or line for each group defined by the `GROUPS` factors |

### Description

`AGRAPH`

plots tables of means from an `ANOVA`

analysis. In its simplest form, the behaviour of `AGRAPH`

depends on the model. If the treatment model contains only main effects, it plots the means for the first factor in the model. Otherwise it looks for the first treatment term involving two factors; it then plots the means with one of these factors as the x-axis, and the second as a grouping factor with levels identified by different plotting colours and symbols. By default, the means are from the most recent `ANOVA`

. However, you can plot means from an earlier analysis, by using the `SAVE`

option of `AGRAPH`

to specify its save structure (saved using the `SAVE`

parameter of the `ANOVA`

command that performed the analysis).

Usually, each mean is represented by a point. However, with high-resolution plots, the `METHOD`

option can be set to `lines`

to draw lines between the points, or `data`

to draw just the lines and then also plot the original data values, or `barchart`

to plot the means as a barchart, or `splines`

to plot the points together with a smooth spline to show the trend over each group of points. The `DFSPLINE`

specifies the degrees of freedom for the splines; if this is not set, 2 d.f. are used when there are up to 10 points, 3 if there are 11 to 20, and 4 for 21 or more. The `GRAPHICS`

option controls whether a high-resolution or a line-printer graph is plotted; by default `GRAPHICS=high`

.

The `PSE`

option specifies the type of error bar to be plotted with the means, with settings:

`differences` |
average standard error of difference; |
---|---|

`lsd` |
average least significant difference; |

`means` |
average effective standard error for the means; |

`allmeans` |
plots plus and minus the effective standard error around every mean. |

The `LSDLEVEL`

option sets the significance level (%) to use for the least significant differences (default 5). The `allmeans`

setting is often unsuitable for plots other than barcharts when there are `GROUPS`

, as the plus/minus e.s.e. bars may overlap each other.

You can define the table of means to plot explicitly, by specifying its classifying factors using the `XFACTOR`

, `GROUPS`

, `TRELLISGROUPS`

and `PAGEGROUPS`

parameters. The `XFACTOR`

parameter defines the factor against whose levels the means are plotted. With a multi-way table, there will be a plot of means against the `XFACTOR`

levels for every combination of levels of the factors specified by the `GROUPS`

, `TRELLISGROUPS`

and `PAGEGROUPS`

parameters. The `GROUPS`

parameter specifies factors whose levels are to be included in a single window of the graph. So, for example, if you specify

`AGRAPH [METHOD=line] XFACTOR=A; GROUPS=B`

`AGRAPH`

will produce a plot of the means in a single window with factor `A`

on the x-axis, and a line for each level of the factor `B`

. You can set `GROUPS`

to a pointer to specify several factors to define groups. For example

`POINTER [VALUES=B,C] Groupfactors`

`AGRAPH [METHOD=line] XFACTOR=A; GROUPS=Groupfactors`

to plot a line for every combination of the levels of factors `B`

and `C`

. Similarly, the `TRELLISGROUPS`

option can specify one or more factors to define a trellis plot. For example,

`AGRAPH [METHOD=line] XFACTOR=A; GROUPS=B; TRELLISGROUPS=C`

will produce a plot for each level of `C`

, in a trellis arrangement; each plot will again have factor `A`

on the x-axis, and a line for each level of the factor `B`

. Likewise, the `PAGEGROUPS`

parameter can specify factors whose combinations of levels are to be plotted on different pages. So

`AGRAPH [METHOD=line] XFACTOR=A; GROUPS=B; PAGEGROUPS=C`

will produce a plot for each level of `C`

, but now on separate pages. Multi-way tables can plotted even if the corresponding model term was not in the `ANOVA`

analysis. For example you can plot a two-way table even if the analysis contained only the main effects of the two factors; however, the lines will then all be parallel and no standard errors or LSDs can be included.

The `NEWXLEVELS`

parameter enables different levels to be supplied for `XFACTOR`

if the existing levels are unsuitable. If `XFACTOR`

has labels, these are used to label the x-axis unless you set option `XFREPRESENTATION=levels`

.

The `TITLE`

, `YTITLE`

and `XTITLE`

parameters can supply titles for the graph, the y-axis and the x-axis, respectively. The symbols, colours and line styles that are used in a high-resolution plot are usually set up by `AGRAPH`

automatically. If you want to control these yourself, you should use the `PEN`

directive to define a pen with your preferred symbol, colour and line style, for each of the groups defined by combinations of the `GROUPS`

factors. The pen numbers should then be supplied to `AGRAPH`

, in a variate with a value for each group, using the `PENS`

parameter.

The `YTRANSFORM`

option lets you include additional axis markings, transformed onto another scale, on the right-hand side of the y-axis. Suppose, for example, suppose you have analysed a variate of percentages that have been transformed to logits. You might then set `YTRANSFORM=ilogit`

(the inverse-logit transformation) to include markings in percentages alongside the logits. The settings are the same as those of the `TRANSFORM`

parameter of `AXIS`

(which is used to add the markings). You can control the colours of the transformed marks and labels, by defining a pen with the required properties, and specifying it with the `PENYTRANSFORM`

option. Otherwise, the default is to plot them in blue.

For compatibility with previous releases, `AGRAPH`

lets you plot predicted means from an analysis by the `AUNBALANCED`

procedure (which uses the Genstat regression commands). However, procedure `AUGRAPH`

(new in Release 13) is now recommended instead. Also, in Release 13, a new procedure `DTABLE`

was included to plot a user-supplied table. Previously this could be done using the `MEANS`

parameter of `AGRAPH`

, which has now been withdrawn.

Options: `GRAPHICS`

, `METHOD`

, `XFREPRESENTATION`

, `PSE`

, `LSDLEVEL`

, `DFSPLINE`

, `YTRANSFORM`

, `PENYTRANSFORM`

, `SAVE`

.

Parameters: `XFACTOR`

, `GROUPS`

, `TRELLISGROUPS`

, `PAGEGROUPS`

, `NEWXLEVELS`

, `TITLE`

, `YTITLE`

, `XTITLE`

, `PENS`

.

### See also

Directive: `ANOVA`

.

Procedures: `APLOT`

, `AUGRAPH`

, `RGRAPH`

, `VGRAPH`

.

Commands for: Analysis of variance.

### Example

CAPTION 'AGRAPH 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' READ [SERIAL=yes] Nitrogen,Variety,Yield 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 AGRAPH