halfnorm Half normal plot for generalized linear models halfnorm

Visualizing Categorical Data: halfnorm

$Version: 1.1 (9 Nov 2000)
Michael Friendly
York University

The halfnorm macro ( [download] get halfnorm.sas)

Half normal plot for generalized linear models

The HALFNORM macro plots the ordered absolute values of residuals from a generalized linear model against expected values of normal order statistics. A simulated envelope, correponding to an approximate 95% confidence interval, is added to the plot to aid assessment of whether the distribution of residuals corresponds to a good-fitting model.

Usage

The HALFNORM macro is called with keyword parameters. The RESP= and MODEL= parameters are required. The arguments may be listed within parentheses in any order, separated by commas. For example:

  %halfnorm(resp=count, class=sex response, model=sex|year|response@2);

Parameters

DATA=
Specifies the name of the input data set to be analyzed. The default is the last data set created.
Y=
RESP=
Specifies the name of the response variable to be analyzed
TRIALS=
The name of a trials variable, for DIST=BIN, with the data in events/trials form.
MODEL=
Specifies the model formula, the right-had-side of the MODEL statement. You can use the | and @ shorthands.
CLASS=
Names of any class variables in the model
DIST=
Error distribution. The default is DIST=NORMAL.
LINK=
Link function. The default is LINK=IDENTITY.
OFFSET=
The name(s) of any offset variables in the model.
FREQ=
The name of a frequency variable, when the data are in grouped form.
ID=
The name of a character variable used as an observation identifier in the plot...
OUT=
Specifies the name of the output data set. The output data set contains the input variables, absolute residuals (_ARES_), half-normal expected value (_Z_), Default: _RES_.
LABEL=
Specifies whether and how to label observations in the plot. LABEL=ALL means that all observations are labelled with the ID= variable value; LABEL=NONE means that no observations are labelled; LABEL=ABOVE means that observations above the mean of the simulations are labelled; LABEL=TOP n means that the highest n observations are labelled.
SEED=
Specifies the seed for the random number generators. SEED=0 (the default) uses the time-of-day as the seeed, so a different set of simulated observations is drawn each time the program is run.
RES=
The type of residual to plot. Possible values are: STRESCHI (adjusted Pearson residual), STRESDEV (adjusted deviance residual),

Example

%include vcd(halfnorm);        *-- or include in an autocall library;

%halfnorm();

See also

meanplot
panels
scatmat
stat2dat