SAS Macro Programs for Statistical Graphics: CONTOUR
$Version: 2.4 (30 Jan 2004)
Michael Friendly
York University
The CONTOUR macro plots a bivariate scatterplot with a bivariate
data ellipse for one or more groups. This macro has now been superceded
by the ELLIPSES macro.
Parameters
- DATA=_LAST_
- Name of the input data set
- X=
- Name of the X variable
- Y=
- Name of the Y variable
- GROUP=
- Group variable. If a GROUP= variable is
specified, one ellipse is produced for each
value of this variable in the data set. If no
GROUP= variable is specified, a single ellipse
is drawn for the entire sample. The GROUP=
variable may be character or numeric.
- PVALUE=.5
- Confidence coefficient(s) ( 1 - alpha )
. This is the proportion of data from a
bivariate normal distribution contained within
the ellipse. Several values may be specified
in a list (e.g., PVALUE=.5 .9), in which case
one ellipse is generated for each value.
- STD=STDERR
- Error bar metric. STD=STDERR gives error
bars equal to each mean +- one
standard error ( s / sqrt n ) for both
variables. STD=STD gives error bars whose
length is one standard deviation for both
variables.
- POINTS=40
- The number of points on each contour.
- ALL=NO
- Specifies whether the contour for the total
sample should be drawn in addition to those for
each group. If there is no GROUP= variable,
ALL=YES just draws the ellipse twice.
- OUT=CONTOUR
- Name of the output Annotate data set used
to draw the ellipses, error bars and group
labels.
- PLOT=YES
- If YES, the macro plots the data together
with the generated ellipses. Otherwise, only
the output Annotate data set is generated.
- I=NONE
- SYMBOL statement interpolate option for
drawing points. Use I=RL to include the
regression line as well.
- NAME=CONTOUR
- The name assigned to the graph(s) in the
graphic catalog.
- COLORS=RED GREEN BLUE BLACK PURPLE YELLOW BROWN ORANGE
- List of colors to use for each of the
groups. If there are g groups,
specify g colors if ALL=NO, and g
+ 1 colors if ALL=YES. COLORS(i) is used
for group i.
- SYMBOLS=+ SQUARE STAR - PLUS : $ =
- List of symbols, separated by spaces, to
use for plotting points in each of the groups.
SYMBOLS(i) is used for group i.
Missing data
Observations with missing values on either the X or Y variable are
not plotted and do not enter the computations of the data ellipse.
Usage Notes
When using the CONTOUR macro with the SAS System for Personal
Computers, it may be neccessary to add the option WORKSIZE=100 to
the PROC IML statement.
When displaying output from the macro on a terminal, it may be
necessary to specify CBACK=WHITE in a GOPTIONS statement.
Example
%include data(auto) ;
%contour(data=auto,
x=price, y=weight, group=origin,
pvalue=.5);