1. Home
  2. GLPLOT procedure

GLPLOT procedure

Plots residuals from a GLMM analysis (R.W. Payne).


RMETHOD = string token  Which random terms to use when calculating the residuals (final, all); default all
BACKTRANSFORM = string token Whether to plot residuals on the natural scale (calculated using back-transformed fitted values) or standardized residuals on the linear-predictor scale (link, none); default none
INDEX = variate or factor X-variable for an index plot; default !(1,2...)
OFFSET = scalar Value of offset to use when calculating the residuals; default 0
GRAPHICS = string token What type of graphics to use (lineprinter, highresolution); default high
TITLE = text Overall title for the plots; the default is to form a title displaying the identifier of the y-variate and the type of residual
GLSAVE = pointer Save structure from the GLMM analysis; default * uses the GLSAVE structure from the most recent GLMM analysis 


METHOD = string tokens Type of residual plot (fittedvalues, normal, halfnormal, histogram, absresidual, index); default fitt, norm, half, hist
PEN = scalars, variates or factors Pen(s) to use for each plot


GLPLOT provides up to four types of residual plots from a GLMM analysis. These are selected using the METHOD parameter, with settings: fitted for residuals versus fitted values, normal for a Normal plot, halfnormal for a half-Normal plot, histogram for a histogram of residuals, absresidual for a plot of the absolute values of the residuals versus the fitted values, and index for a plot against an “index” variable (specified by the INDEX option). The PEN parameter can specify the graphics pen or pens to use for each plot.

The residuals and fitted values are accessed automatically from the analysis specified by the GLSAVE option. If the GLSAVE option has not been set, they are taken from the most recent GLMM analysis.

The RMETHOD option controls which random terms are used to calculate the residuals:

all all the random effects (default), and
final only the final random term.

Note that residuals based on the final random term will not be calculated when any of the variance components are negative, as the associated negative correlations can generate very misleading patterns. GLPLOT will then generate a warning that all the residuals are missing. You should then use RMETHOD=all instead.

The BACKTRANSFORM option specifies the scale of the residuals. The default is to plot standardized residuals on the linear-predictor scale. To avoid problems with 0 and 100% observations, these are formed as the difference between the adjusted dependent variate and the fitted values on the linear predictor scale (and then standardized). Alternatively, you can set BACKTRANSFORM=link to plot (unstandardized) residuals on the natural scale.

The OFFSET option specifies the offset value to use when calculating the residuals. The default is zero.

By default, high-resolution graphics are used. Line-printer graphics can be used instead, by setting option GRAPHICS=lineprinter.

The TITLE option can supply an overall title. If this is not set, a default title is formed displaying the identifier of the y-variate and the type of residual.

Parameters: METHOD, PEN.


Residuals and fitted values effects are accessed, using GLKEEP. The plots are produced using the DRESIDUALS procedure.

Action with RESTRICT

If the y-variate in the GLMM analysis was restricted, only units included by the restriction will be used in the graphs.

See also

Commands for: Regression analysis.


CAPTION   'GLPLOT example',\
          !t('Data from an experiment on Great Knott, Rothamsted;',\
          'see West, J.S., Fitt, B.D.L., Leech, P.K., Biddulph, J.E.,',\
          'Huang, Y.-J. &, Balesdent, M.-H. (2002).',\
          'Effects of timing of ~italic{Leptosphaeria maculans}',\
          'ascospore release and fungicide regime on phoma leaf spot',\
          'and phoma stem canker development on winter oilseed rape',\
          '(~italic{Brassica napus}) in southern England.',\
          'Plant Pathology, 51, 454–463.'); STYLE=meta,plain
SPLOAD    [PRINT=*] '%data%/GtKnott2000.gsh'
GLMM      [PRINT=model,components,means,backmeans,wald;\
          DISTRIBUTION=binomial; LINK=logit; DISPERSION=*;\
          FIXED=Cultivar*Fungicide; RANDOM=Block/Wholeplot;\
          PSE=differences] LMplants; NBINOMIAL=Nplants
Updated on February 7, 2023

Was this article helpful?