1. Home
  2. VGRAPH procedure

VGRAPH procedure

Plots tables of means from REML (R.W. Payne).

Options

GRAPHICS = string token Type of graph (highresolution, lineprinter); default high
METHOD = string token What to plot (points, means, linesandpoints, onlylines, data, barchart, splines); default poin when XFACTOR is a factor, and only when it is a variate
XFREPRESENTATION = string token How to label the x-axis (levels, labels); default labe uses the XFACTOR labels, if available
PSE = string token What to plot to represent variation when points are plotted at the means (differences, lsd, means, allmeans); default diff
LSDLEVEL = scalar Significance level (%) to use for approximate 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
KEYMETHOD = string token What to use for the key descriptions when there are GROUPS (labels, namesandlabels); default name
PLOTTITLEMETHOD = string token What to use for the titles of the plots when there are TRELLISGROUPS (labels, namesandlabels); default name
PAGTITLEMETHOD = string token What to use for the titles of the pages when there are PAGEGROUPS (labels, namesandlabels); default name
USEAXES = string token Which aspects of the current axis definitions of window 1 to use (none, limits, marks, mpositions, mlower%, mupper%, nsubticks,); default none
SAVE = REML save structure Save structure to provide the table of means; default uses the save structure from the most recent REML

Parameters

XFACTOR = factors or variates Provides the x-values for each plot; by default this is chosen automatically
GROUPS = factors or pointers Factor or factors identifying groups 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; default uses the existing levels if XFACTOR is a factor, and the minimum and maximum values if it is a variate
TITLE = texts Title for the graph; default is to define a title automatically if GROUPS is set, or to have none if it is unset
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

VGRAPH plots tables of predicted means from REML. In its simplest form, the behaviour of VGRAPH depends on the model. If the fixed model contains only main effects, it plots the means for the first factor in the fixed model. Otherwise, it looks for the first fixed 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 REML. However, you can plot means from an earlier analysis, by using the SAVE option of VGRAPH to specify its save structure (saved using the SAVE parameter of the REML command that performed the analysis). VGRAPH uses the VPREDICT directive with default option settings to obtain the means. This should give the same means as those printed by REML or VDISPLAY. If you want to use VPREDICT with other option settings, you can plot these using the DTABLE procedure.

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

The METHOD option controls how the predicted means are plotted in high-resolution graphics, with settings:

    points to plot a point at each mean;
    means synonym of points;
    linesandpoints to plot points and join them by lines;
    onlylines to draw lines between the means;
    data to draw lines between the means, and then also plot the original data values;
    barchart to plot the means as a barchart;
    splines to plot points at the means together with a smooth spline to show the trend over each group of means; 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 default is to plot points when XFACTOR is a factor, and onlylines when it is a variate. Only points are available in line-printer graphics.

The PSE option specifies the type of error bar to be plotted, when points are plotted for the means, with settings:

    differences average standard error of difference;
    lsd average approximate least significant difference (calculated using the VLSD procedure);
    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 approximate 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 can define a factor against whose levels the means are plotted. It can also specify a variate, and VPREDICT then sets up a factor automatically, to classify the table, with levels at the values specified by the NEWXLEVELS parameter. 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

VGRAPH [METHOD=line] XFACTOR=A; GROUPS=B

VGRAPH will produce plot 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

VGRAPH [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,

VGRAPH [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

VGRAPH [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 REML 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 LSDs can be included.

The NEWXLEVELS parameter allows different levels to be supplied for an XFACTOR factor, if its existing levels are unsuitable. If the factor has labels, these are used to label the x-axis unless you set option XFREPRESENTATION=levels. When XFACTOR is a variate, NEWXLEVELS can specify the values where the predictions are to be made. By default, they are made at its minimum and maximum values.

Note that the values predicted by VPREDICT, for an XFACTOR variate, will not include any spline effects, nor can it take account of any relationships between different variates in the model. (For example, the model may include a variate and its square.) To take account of relationships like these, you should use VPREDICT directly, specifying the linked variables with the PARALLEL parameter. Save the table of predictions, and then plot it using DTABLE.

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 VGRAPH 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 VGRAPH, in a variate with a value for each group, using the PENS parameter.

The YTRANSFORM option allows you to 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.

When there is more than one GROUPS factor, the KEYMETHOD controls whether to use the factor names with their labels (or levels for factors with no labels) or just the labels (or levels) in the key descriptions. The default is to use the names and the labels (or levels). Similarly, the PLOTTITLEMETHOD specifies what to use for the titles of the plots when there is more then one TRELLISGROUPS factor, and the PAGETITLEMETHOD specifies what to use for the titles of the plots when there is more then one PAGEGROUPS factor. You can set KEYMETHOD=* to have no key at all.

The USEAXES option allows you to control various aspects of the axes. First you need to use the XAXIS and YAXIS directives to define them for window 1. Then specify which of the aspects of the axes in window 1 are to be used by DTABLE, by specifying USEAXES with the following settings:

limits y- and x-axis limits (LOWER and UPPER parameters);
marks location and labelling of the tick marks (MARKS, LABELS, LDIRECTION, LROTATION, DECIMALS, DREPRESENTATION, and VREPRESENTATION parameters);
mpositions positions of the tick marks (MPOSITION parameter); 
mlower% how large a margin to set between the lowest x and y values and the lower values of their axes, expressed as a percentage of the range of their values, if not set explicitly by the axis limits (MLOWER% parameter);
mupper% how large a margin to set between the highest x and y values and the upper values of their axes, expressed as a percentage of the range of their values, if not set explicitly by the axis limits (MUPPER% parameter); and
nsubticks number of subticks per interval (NSUBTICKS parameter).

 By default none are used.

Options: GRAPHICS, METHOD, XFREPRESENTATION, PSE, LSDLEVEL, DFSPLINE, YTRANSFORM, PENYTRANSFORM, KEYMETHOD, PLOTTITLEMETHOD, PAGETITLEMETHOD, USEAXES, SAVE.
Parameters: XFACTOR, GROUPS, TRELLISGROUPS, PAGEGROUPS, NEWXLEVELS, TITLE, YTITLE, XTITLE, PENS.

See also

Procedures: VDEFFECTS, AGRAPH, DTABLE, RGRAPH, RDESTIMATES.
Commands for: REML analysis of linear mixed models.

Example

CAPTION 'VGRAPH example','Guide Part 2, Example 5.3.5a'; STYLE=meta,plain
FACTOR  [NVALUES=322; LEVELS=27] Dam
&       [LEVELS=18] Pup
FACTOR  [LEVELS=2; LABELS=!T('M','F')] Sex
FACTOR  [LEVELS=3; LABELS=!T('C','Low','High')] Dose
VARIATE [NVALUES=322] Littersize,Weight
READ    Dose,Sex,Littersize,Dam,Pup,Weight;\ 
        FREPRESENTATION=2(labels),4(levels)
   C M 12  1  1 6.60    C M 12  1  2 7.40    C M 12  1  3 7.15
   C M 12  1  4 7.24    C M 12  1  5 7.10    C M 12  1  6 6.04
   C M 12  1  7 6.98    C M 12  1  8 7.05    C F 12  1  9 6.95
   C F 12  1 10 6.29    C F 12  1 11 6.77    C F 12  1 12 6.57
   C M 14  2  1 6.37    C M 14  2  2 6.37    C M 14  2  3 6.90
   C M 14  2  4 6.34    C M 14  2  5 6.50    C M 14  2  6 6.10
   C M 14  2  7 6.44    C M 14  2  8 6.94    C M 14  2  9 6.41
   C F 14  2 10 5.92    C F 14  2 11 6.04    C F 14  2 12 5.82
   C F 14  2 13 6.04    C F 14  2 14 5.96    C M  4  3  1 7.50
   C M  4  3  2 7.08    C F  4  3  3 7.57    C F  4  3  4 7.27
   C M 14  4  1 6.25    C M 14  4  2 6.93    C M 14  4  3 6.80
   C M 14  4  4 6.69    C M 14  4  5 6.28    C M 14  4  6 6.27
   C M 14  4  7 6.27    C M 14  4  8 6.47    C F 14  4  9 6.29
   C F 14  4 10 5.98    C F 14  4 11 6.32    C F 14  4 12 6.28
   C F 14  4 13 5.65    C F 14  4 14 5.57    C M 13  5  1 7.96
   C M 13  5  2 6.84    C M 13  5  3 7.00    C M 13  5  4 8.10
   C M 13  5  5 6.52    C M 13  5  6 7.23    C M 13  5  7 6.10
   C M 13  5  8 7.31    C F 13  5  9 7.16    C F 13  5 10 7.09
   C F 13  5 11 7.14    C F 13  5 12 5.02    C F 13  5 13 6.04
   C M  9  6  1 8.26    C M  9  6  2 7.73    C M  9  6  3 8.33
   C M  9  6  4 6.14    C M  9  6  5 7.75    C M  9  6  6 6.96
   C F  9  6  7 7.26    C F  9  6  8 6.58    C F  9  6  9 3.68
   C M 18  7  1 6.29    C M 18  7  2 6.32    C M 18  7  3 6.28
   C M 18  7  4 6.24    C M 18  7  5 6.78    C M 18  7  6 6.63
   C M 18  7  7 6.27    C M 18  7  8 6.29    C M 18  7  9 6.06
   C F 18  7 10 6.16    C F 18  7 11 5.96    C F 18  7 12 6.26
   C F 18  7 13 5.83    C F 18  7 14 6.11    C F 18  7 15 6.45
   C F 18  7 16 6.25    C F 18  7 17 6.31    C F 18  7 18 5.74
   C M 17  8  1 6.04    C M 17  8  2 5.84    C M 17  8  3 6.77
   C M 17  8  4 5.59    C M 17  8  5 5.52    C M 17  8  6 6.42
   C M 17  8  7 5.97    C M 17  8  8 6.34    C F 17  8  9 6.23
   C F 17  8 10 5.95    C F 17  8 11 6.16    C F 17  8 12 6.19
   C F 17  8 13 5.32    C F 17  8 14 5.00    C F 17  8 15 6.30
   C F 17  8 16 5.00    C F 17  8 17 5.56    C M 17  9  1 5.37
   C M 17  9  2 5.58    C M 17  9  3 5.51    C M 17  9  4 5.19
   C M 17  9  5 5.34    C M 17  9  6 5.77    C M 17  9  7 5.17
   C M 17  9  8 4.57    C M 17  9  9 5.39    C M 17  9 10 5.62
   C M 17  9 11 5.40    C M 17  9 12 5.77    C M 17  9 13 5.24
   C F 17  9 14 5.37    C F 17  9 15 5.33    C F 17  9 16 5.44
   C F 17  9 17 5.14    C M 13 10  1 7.30    C M 13 10  2 6.60
   C M 13 10  3 6.58    C M 13 10  4 6.68    C M 13 10  5 6.46
   C M 13 10  6 6.38    C F 13 10  7 6.44    C F 13 10  8 6.67
   C F 13 10  9 6.43    C F 13 10 10 6.53    C F 13 10 11 5.92
   C F 13 10 12 6.52    C F 13 10 13 6.44
 Low M 16 11  1 6.65  Low M 16 11  2 5.78  Low M 16 11  3 6.23
 Low M 16 11  4 5.70  Low M 16 11  5 5.73  Low M 16 11  6 6.10
 Low M 16 11  7 5.55  Low M 16 11  8 5.71  Low M 16 11  9 5.81
 Low M 16 11 10 6.10  Low F 16 11 11 5.54  Low F 16 11 12 5.72
 Low F 16 11 13 5.50  Low F 16 11 14 5.64  Low F 16 11 15 5.42
 Low F 16 11 16 5.42  Low F  2 12  1 6.89  Low F  2 12  2 7.73
 Low M 12 13  1 5.83  Low M 12 13  2 5.97  Low M 12 13  3 6.39
 Low M 12 13  4 5.69  Low M 12 13  5 5.69  Low M 12 13  6 5.97
 Low M 12 13  7 6.04  Low M 12 13  8 5.46  Low F 12 13  9 6.09
 Low F 12 13 10 5.39  Low F 12 13 11 5.89  Low F 12 13 12 5.14
 Low M 15 14  1 5.92  Low M 15 14  2 5.75  Low M 15 14  3 6.22
 Low M 15 14  4 5.96  Low M 15 14  5 5.59  Low M 15 14  6 5.79
 Low M 15 14  7 6.23  Low M 15 14  8 5.88  Low M 15 14  9 6.02
 Low F 15 14 10 5.66  Low F 15 14 11 5.76  Low F 15 14 12 5.73
 Low F 15 14 13 5.33  Low F 15 14 14 5.58  Low F 15 14 15 5.88
 Low M 13 15  1 6.00  Low M 13 15  2 6.11  Low M 13 15  3 6.40
 Low M 13 15  4 6.06  Low M 13 15  5 6.39  Low M 13 15  6 6.09
 Low M 13 15  7 6.32  Low F 13 15  8 5.96  Low F 13 15  9 6.32
 Low F 13 15 10 5.83  Low F 13 15 11 5.97  Low F 13 15 12 5.87
 Low F 13 15 13 5.67  Low M 13 16  1 6.43  Low M 13 16  2 6.13
 Low M 13 16  3 5.87  Low F 13 16  4 6.09  Low F 13 16  5 5.63
 Low F 13 16  6 5.84  Low F 13 16  7 6.20  Low F 13 16  8 6.42
 Low F 13 16  9 5.90  Low F 13 16 10 5.62  Low F 13 16 11 6.23
 Low F 13 16 12 5.85  Low F 13 16 13 5.89  Low M 14 17  1 5.81
 Low M 14 17  2 5.44  Low M 14 17  3 5.65  Low M 14 17  4 5.25
 Low M 14 17  5 5.45  Low M 14 17  6 5.32  Low M 14 17  7 5.89
 Low F 14 17  8 5.63  Low F 14 17  9 5.12  Low F 14 17 10 5.65
 Low F 14 17 11 5.29  Low F 14 17 12 5.13  Low F 14 17 13 5.60
 Low F 14 17 14 5.08  Low M 15 18  1 6.77  Low M 15 18  2 7.13
 Low M 15 18  3 6.85  Low F 15 18  4 6.49  Low F 15 18  5 6.09
 Low F 15 18  6 6.09  Low F 15 18  7 5.99  Low F 15 18  8 6.01
 Low F 15 18  9 6.11  Low F 15 18 10 6.15  Low F 15 18 11 4.75
 Low F 15 18 12 5.69  Low F 15 18 13 6.19  Low F 15 18 14 5.72
 Low F 15 18 15 6.14  Low M 10 19  1 6.72  Low M 10 19  2 6.34
 Low M 10 19  3 6.48  Low M 10 19  4 5.74  Low F 10 19  5 6.11
 Low F 10 19  6 5.71  Low F 10 19  7 6.41  Low F 10 19  8 6.21
 Low F 10 19  9 6.11  Low F 10 19 10 5.81  Low M 16 20  1 5.90
 Low M 16 20  2 6.22  Low M 16 20  3 6.67  Low M 16 20  4 6.23
 Low M 16 20  5 6.24  Low M 16 20  6 6.26  Low M 16 20  7 6.38
 Low M 16 20  8 6.05  Low M 16 20  9 5.89  Low M 16 20 10 6.29
 Low F 16 20 11 6.12  Low F 16 20 12 5.40  Low F 16 20 13 5.50
 Low F 16 20 14 5.46  Low F 16 20 15 5.97  Low F 16 20 16 6.11
High M 14 21  1 5.09 High M 14 21  2 5.57 High M 14 21  3 5.69
High M 14 21  4 5.50 High M 14 21  5 5.45 High M 14 21  6 5.24
High M 14 21  7 5.36 High M 14 21  8 5.26 High M 14 21  9 5.36
High M 14 21 10 5.01 High M 14 21 11 5.03 High F 14 21 12 5.23
High F 14 21 13 5.13 High F 14 21 14 4.48 High M 10 22  1 5.30
High M 10 22  2 5.40 High M 10 22  3 5.55 High M 10 22  4 6.02
High M 10 22  5 5.27 High F 10 22  6 5.19 High F 10 22  7 5.42
High F 10 22  8 5.40 High F 10 22  9 5.12 High F 10 22 10 5.40
High M  3 23  1 7.70 High F  3 23  2 7.68 High F  3 23  3 6.33
High M 12 24  1 6.28 High M 12 24  2 5.74 High M 12 24  3 6.29
High F 12 24  4 5.68 High F 12 24  5 5.76 High F 12 24  6 6.03
High F 12 24  7 5.30 High F 12 24  8 5.55 High F 12 24  9 6.53
High F 12 24 10 5.76 High F 12 24 11 5.77 High F 12 24 12 5.49
High M  8 25  1 6.50 High M  8 25  2 7.10 High M  8 25  3 7.00
High M  8 25  4 7.00 High M  8 25  5 5.85 High F  8 25  6 6.10
High F  8 25  7 6.63 High F  8 25  8 6.33 High M  9 26  1 7.00
High M  9 26  2 6.15 High F  9 26  3 6.22 High F  9 26  4 6.20
High F  9 26  5 5.76 High F  9 26  6 6.21 High F  9 26  7 6.42
High F  9 26  8 6.42 High F  9 26  9 6.30 High M  9 27  1 5.64
High M  9 27  2 6.06 High M  9 27  3 6.56 High M  9 27  4 6.29
High M  9 27  5 5.69 High M  9 27  6 6.36 High F  9 27  7 5.93
High F  9 27  8 5.74 High F  9 27  9 5.74 :
VCOMPONENTS [FIXED=Littersize+Dose*Sex] RANDOM=Dam/Pup
REML        Weight
VGRAPH      [METHOD=lines] Dose; GROUPS=Sex
Updated on February 7, 2023

Was this article helpful?