addvar Added variable plots for logistic regression addvar

Visualizing Categorical Data: addvar

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

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

Added variable plots for logistic regression

The ADDVAR macro produces added variable plots (TYPE=AVP) for the effect of adding a variable to a logistic regression model, or a constructed variable plot (TYPE=CVP) for the effect of transforming a variable.

For a model with a binary response, Y, and predictors in the list X, an added variable plot may be constructed for a new predictor, Z, by plotting the residuals of Y given X against the residuals of Z given X. A linear relation in this plot indicates that Z should be included in the model, but observations with extreme Z-residuals would be highly influential in this decision. A line fitted to this plot should have an intercept approximately zero, and a slope approximating the coefficient of Z in the full model.

The constructed variable plot is designed to detect nonlinear dependence of Y on one of the X variables, say X[j]. It is an added variable plot for the constructed variable, Z = X[j] log X[j].

Method

Usage

The addvar macro is called with keyword parameters. The X=, Y=, and Z= parameters must be specified. A TRIALS= variable may be specified if the data are in events/trials form.

The arguments may be listed within parentheses in any order, separated by commas. For example:

  %addvar(data=icu, y=Died,  x=age admit cancer uncons, z=Systolic,
     id=patient, loptions=order=data noprint);
This gives an AVP for the variable Systolic, when added to the X= variables in the model predicting Y=DIED.

Parameters

DATA=
Specifies the name of the input data set to be analyzed. [Default: DATA=_LAST_]
Y=
Specifies the name of the response variable.
TRIALS=
Name of trials variable for event/trial syntax.
X=
Specifies the names of the predictor variables in the model
Z=
Name of the added variable
ID=
Name of observation ID variable (char)
LOPTIONS=
Options for PROC LOGISTIC [Default: LOPTIONS=NOPRINT]
SMOOTH=
Lowess smoothing parameter [Default: SMOOTH=0.5]
SUBSET=
Subset of points to label [Default: SUBSET=ABS(STUDRES)>2]
OUT=
Specifies the name of the output data set [Default: OUT=_RES_]
SYMBOL=
Plotting symbol for points [Default: SYMBOL=DOT]
INTERP=
Interpolation options for points [Default: INTERP=RL CI=RED]
TYPE=
Type of plot: AVP (for an added-variable plot) or CVP (for a constructed variable plot) [Default: TYPE=AVP]
NAME=
Name of graph in graphic catalog [Default: NAME=ADDVAR]
GOUT=
Name of the graphics catalog

Example

%include vcd(addvar);        *-- or include in an autocall library;
%include data(icu);

  %addvar(data=icu, y=Died,  x=age admit cancer uncons, z=Systolic,
     id=patient, loptions=order=data noprint);

See also

partial Partial regression residual plots
inflglim Influence plots for generalized linear models
inflogis Influence plot for logistic regression models