📊

Guide to Creating Contingency Tables

May 10, 2025

Creating Contingency Tables using StatCrunch

Overview

  • Instruction on creating contingency tables using StatCrunch.
  • Using a toy data set named "two categorical variables" with columns var1 and var2.

Data Set Details

  • var1: Contains 10 values; 4 rows with value 'b' and 6 rows with value 'a'.
  • var2: Contains 10 values; 6 rows with value 'c' and 4 rows with value 'd'.

Creating Contingency Table

  1. Procedure:

    • Under the stat menu, select: Tables > Contingency > With Data.
    • Choose var1 as the row variable and var2 as the column variable.
    • Click on 'Compute'.
  2. Results:

    • Table displays unique values for each column in the first row and column.
    • Remaining cells show frequency for each variable pairing.
    • Includes row totals, column totals, and total number of pairs.
    • Displays results of a standard chi-square test for independence.
    • Warning for low cell counts in chi-square test results.

Customizing Contingency Table

  • Edit Options:

    • Under the options menu, choose 'Edit' to customize.
    • Under display options, select additional information to display.
    • Example: Select 'Row Percent' and click 'Compute'.
  • Resulting Table:

    • Shows that 66.6% of 'a' values are paired with 'c', and 33.3% with 'd'.
    • Shows a 50/50 split between 'c' and 'd' for 'b' values.

Hypothesis Testing

  • Chi-square Test:

    • Not suitable for small cell counts in this data.
    • Options available under 'Hypothesis Test' in the options menu.
  • Alternative Test:

    • De-select chi-squared and select Fisher's exact test for independence.
    • Additional option: StatCrunch can calculate confidence intervals (not demonstrated).
  • Fisher's Exact Test:

    • Click 'Compute' for results.
    • Displays new results for Fisher's exact test.