Visualizing Categorical Data: catplot
$Version: 1.4 (9 Nov 2000)
Michael Friendly
York University
Plots for logit models fit by PROC CATMOD
The catplot macro is designed to plot observed and/or predicted
values for logit models fit by the CATMOD procedure. The macro uses
the output data set produced with the OUT= option on the RESPONSE
statement. This data set normally contains both logit values
(_type_='FUNCTION') and probability values (_type_='PROB'). Either
set may be plotted, as specified by the TYPE= parameter.
The horizontal variable may be character (XC=) or numeric (X=).
A separate curve is drawn for each value of the CLASS= variable,
connecting predicted values, with optional standard error bars,
and separate plots are drawn for each value of the BYVAR= variable.
Usage
The catplot macro is called with keyword parameters. The arguments
may be listed within parentheses in any order, separated by commas.
For example:
proc catmod;
direct husinc;
response / out=logits;
model labour = husinc children;
%catplot(data=logits, x=husinc, y=_pred_, class=labor, byvar=children);
Parameters
- DATA=
- The name of the SAS dataset to be plotted, which must be
an output data set from PROC CATMOD. If DATA= is not
specified, the most recently created data set is used.
- X=
- Name of a numeric factor variable to be used as the horizontal
variable in plots. Use the XC= parameter to specify a
character variable. You must specify either the X= or XC=
variable.
- XC=
- Name of a character factor variable used as the horizontal
variable in plots.
- Y=
- Name of the ordinate variable. Y=_PRED_ plots the predicted
value; Y=_OBS_ plots the observed value.
- CLASS=
- The name of a factor variable, used to define separate curves
which are plotted for each level of this variable.
- BYVAR=
- Name of one or more factor variables to be used to define
multiple panels in plots.
- BYFMT=
- Name of a SAS format used to format the value of BYVARs
for display in one panel of the plot(s).
- TYPE=
- The type of oobservations to be plotted. TYPE=FUNCTION (the
default) gives plots of the logit value; TYPE=PROB gives
plots of the probability value.
- Z=
- Standard error multiple for confidence intervals around
predicted values, e.g., Z=1.96 gives 95% CI. To suppress error
bars, use Z=0. The default is Z=1, giving 67% CI.
- CLFMT=
- Name of a SAS format used to format the value the CLASS=
variable for display in each panel of the plot(s).
- CLSIDE=
- Specifies whether the values of the CLASS= variable should
be labelled by annotation in the plot or by a legend. If
CLSIDE=LEFT or CLSIDE=FIRST, CLASS= values are written at the
left side of each curve. If CLSIDE=RIGHT or CLSIDE=LAST,
CLASS= values are written at the right side of each curve.
If CLSIDE=NONE, CLASS= values appear in the legend.
- XFMT=
- Name of a SAS format used to format the values of the
horizontal variable.
- ANNO=
- Name of an additional input annotate data set
- SYMBOLS=
- List of SAS/GRAPH symbols for the levels of the CLASS= variable.
There should be as many symbols as there are distinct values of
the CLASS=variable.
- COLORS=
- List of SAS/GRAPH colors for the levels
of the CLASS= variable. There should be as many colors as there
are distinct values of the CLASS= variable.
- LINES=
- List of SAS/GRAPH line styles for the
levels of the CLASS= variable. There should be as many lines as
there are distinct values of the CLASS= variable.
- HAXIS=
- Axis statement for custom horizontal axis, e.g., HAXIS=AXIS2
- VAXIS=
- Axis statement for custom response axis, e.g., VAXIS=AXIS1. If no axis statement is defined, the program uses
AXIS1 LABEL=(a=90).
- LEGEND=
- Legend statement for custom CLASS legend, e.g., LEGEND=LEGEND1
Example
[None yet]
See also
inflogis Influence plot for logistic regression models
pscale Construct annotations for a probability scale