SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

SIEVE PLOT

Name:
    SIEVE PLOT (LET)
Type:
    Graphics Command
Purpose:
    Generate a sieve plot for a two-way contingency table.
Description:
    Given two discrete variables where variable one has r possible values and variable two has c possible values, we can generate a cross-tabulation of these two variables. This results in a two-way, or RxC contingency table.

    We can define the following values for the contingency table:

      r = the number of rows in the contingency table
      c = the number of columns in the contingency table
      nij = the observed frequency of the ith row and jth column
      mij = the expected frequency of the ith row and jth column
      ni+ = the observed frequency for the ith row
      n+j = the observed frequency for the jth row
      n++ = the total sample size

    When the two variables are independent, then the expected frequency is:

      mij = ni+n+j/n++

    In a sieve plot, each mij is represented by a rectangle. The width of the rectangle is proportional to the total frequency in each column, n+j and the height is proportional to the total frequency in each row, ni+. The area of the rectangle is then proportional to mij.

    Each rectangle is then cross-ruled based on the observed frequency. The deviations from independence are reflected in the density of the shading. Denser shading indicates the observed frequency is greater than expected and sparse shading indicates the observed frequency is less than expected. As an additional cue, positive and negative departures from independence can be coded with different colors.

Syntax 1:
    SIEVE PLOT <y1> <y2>             <SUBSET/EXCEPT/FOR qualification>
    where <y1> is the first response variable;
                <y2> is the second response variable;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    This syntax is used for the case where you have raw data (i.e., the data has not yet been cross tabulated into a two-way table).

Syntax 2:
    SIEVE PLOT <m>             <SUBSET/EXCEPT/FOR qualification>
    where <m> is a matrix containing the two-way table;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    This syntax is used for the case where we the data have already been cross-tabulated into a two-way contingency table.

Syntax 3:
    SIEVE PLOT <n11> <n12> <n21> <n22>
    where <n11> is a parameter containing the value for row 1, column 1 of a 2x2 table;
                <n12> is a parameter containing the value for row 1, column 2 of a 2x2 table;
                <n21> is a parameter containing the value for row 2, column 1 of a 2x2 table;
                and <n22> is a parameter containing the value for row 2, column 2 of a 2x2 table.

    This syntax is used for the special case where you have a 2x2 table. In this case, you can enter the 4 values directly, although you do need to be careful that the parameters are entered in the order expected above.

Examples:
    SIEVE PLOT Y1 Y2
    SIEVE PLOT M
    SIEVE PLOT N11 N12 N21 N22
Note:
    The LINE and LINE COLOR commands can be used to set the attributes for the sieve plot.

      Setting 1 = the line style and color for the frame of the rectangles
      Setting 2 = the line style and color for the cross-ruled lines when the observed frequency is greater than the expected frequency
      Setting 3 = the line style and color for the cross-ruled lines when the observed frequency is less than the expected frequency

    Although the program example below uses the TIC MARK LABEL commands to generate row and column labels, you may need to use the LEGEND or TEXT command to obtain more accurately centered labels.

Default:
    None
Synonyms:
    None
Related Commands: References:
    Friendly (2000), "Visualizing Categorical Data", SAS Institute Inc., pp. 85-89.

    Riedwyl and Schupbach (1994), "Parquet Diagram to Plot Contingency Tables". In Faulbaum, editor, "Softstat '93: Advances In Statistical Software", pp. 293-299, Gustav Fischer, New York.

Applications:
    Graphical Analysis of Categorical Data
Implementation Date:
    2007/6
Program:
     
    . Hair and Eye Color Data from page 61 of Friendly
    read matrix m
     5  29 14 16
    15  54 14 10
    20  84 17 94
    68 119 26 7
    end of data
    .
    label case asis
    tic mark label case asis
    title case asis
    title offset 2
    .
    x3label
    title Sieve Plot
    y1label displacement 12
    y1label Eye Color
    x1label Hair Color
    tic offset units data
    xlimits 1 4
    major xtic mark number 4
    minor xtic mark number 0
    xtic mark offset 0.5 0.5
    x1tic mark label format alpha
    x1tic mark label content Black Brown Red Blond
    ylimits 1 4
    major ytic mark number 4
    minor ytic mark number 0
    ytic mark offset 0.5 0.5
    y1tic mark label format alpha
    y1tic mark label content Green Hazel Blue Brown
    y1tic mark label justification right
    .
    line solid solid dash
    line color black blue green
    .
    sieve plot m
        
    plot generated by sample program

Date created: 12/08/2008
Last updated: 12/04/2023

Please email comments on this WWW page to alan.heckert@nist.gov.