ffold Fourfold displays of 2 x 2 x K tables ffold

Visualizing Categorical Data: ffold

$Version: 1.1
Michael Friendly
York University

The FFOLD macro produces fourfold displays for one or more 2 x 2 tables. Each 2x2 table may be standardized so that the marginal frequencies of either, or both variables are equated, while preserving the odds ratio. The collection of fourfold displays may be arranged on one or more pages, each of which has DOWN= rows, and ACROSS= columns.


Usage

The FFOLD macro is defined with keyword parameters. The arguments may be listed within parentheses in any order, separated by commas. For example:

  %ffold(data=toxaemia, var=Hyper Urea, by=Smoke Class);

Parameters

DATA=
Name of the input dataset, which must represent a 2 x 2 x K x ... contingency table in frequency form (one observation per cell, with a COUNT= variable giving the cell frequency. [Default: DATA=_LAST_]

VAR=
Names of two two-level factor variables defining the 2 x 2 tables. The variables may be character or numeric. The order in which the VAR= variables (and BY=, if any) are listed determines their order in the displays.

BY=
Name(s) of BY variables, determining the panels of the plot. If there are two or more BY= variables, the panels are produced so that the last BY= variable varies most rapidly.

COUNT=
Name of the frequency variable in the input data set. [Default: COUNT=COUNT]

STD=
Specifies how to standardize the 2 x 2 table(s). STD='MARG' standardizes each 2x2 table to equal margins, keeping the odds ratio fixed (see CONFIG). STD='MAX' standardizes each table to a maximum cell frequency of 100, equating the maximum frequency across all 2 x 2 tables. STD='MAXALL' standardizes all tables to max(f[i,j,k])=100. STD='TOTAL' standardizes to the maximum total over all tables.

CONFIG=
Specifies the margins to standardize when STD=MARG. CONFIG=1 2 equates both margins. CONFIG=1 equates the margins for the first VAR= variable. CONFIG=2 equates the second VAR= variable.

DOWN=
The number of rows of panels down each page.

ACROSS=
The number of columns of panels across each page.

ORDER=
Specifies whether the panels are displayed down the columns (ORDER=DOWN) or across the rows (ORDER=ACROSS) [Default: ORDER=DOWN]

SANGLE=
Angle for labels at the left and right sides. [Default: SANGLE=90]

SHADE=
Shading levels for residuals, determined by the magnitude of the Z-value corresponding to the log odds ratio in a given 2x2 table. [Default: SHADE=2 4]

ALPHA=
Error rate for confidence rings on odds ratios; 0 to suppress

COLORS=
Colors for + and - residuals [Default: COLORS=BLUE RED]

FILL=
Fill type for + and - residuals [Default: FILL=HLS HLS]

HTEXT=
Height of text labels [Default: HTEXT=1.5]

FONT=
Font for text labels [Default: FONT=HWPSL009 for PS, otherwise, SWISS]

PTITLE=
Panel title for plot(s), a character string, which may include &V to list the name(s) of the panel BY= variables, and &L to list the value(s) of those variables in the current panel.

FRAME=
Line style for panel frame. Use FRAME=0 to suppress.

OUTSTAT=
Name of an output data set, containing the odds ratio (OR), log odds ratio (LOGOR), std. error (SELOGOR), Z value, and PRZ, for each 2x2 table.

Example

Plot the data for admission to graduate school at Berkeley, first by Department, then collapsing over department. The table macro is used for two different purposes: First to recode the table variables using user-defined formats, then to sum over department.
%include catdata(berkeley);

%table(data=berkeley, 
   var=Admit Gender Dept, 
   weight=freq,
   char=Y,
   format=admit admit. gender $sex. dept dept.,
   order=data, out=berkeley);

%ffold(data=berkeley, 
   var=Admit Gender, 
   by=Dept, 
   down=2, across=3, order=across, 
   htext=2);

%table(data=berkeley, out=berk2, 
   var=Admit Gender,     /* omit dept to sum over it */
   weight=count,
   order=data);

%ffold(data=berk2, var=Admit Gender);
The following graphs are produced:

See also

fourfold Fourfold display for 2 x 2 x k tables
mosaic Macro interface for mosaic displays
mosaics SAS/IML programs for mosaic displays
mosmat Macro interface for mosaic matrices
panels Macro to display a set of plots in rectangular panels
sieve Sieve diagrams for two-way tables
table Construct a grouped frequency table, with recoding