StatCrunch logo (home)

< StatCrunch Examples
Creating a contingency table from summary data
This tutorial covers the steps for creating a contingency table or two-way frequency table in StatCrunch. To begin, load the Pairwise Counts For Two Categorical Variables data set. This data set consists of the contingency table produced in Creating a contingency table loaded directly into the StatCrunch data table. In this case, the contingency table shows the six a values are paired with four c values and two d values. The four b values are paired with two c values and two d values. While it may seem odd at first to run this summary data through the StatCrunch contingency table procedure, doing so allows for the computation of additional statistics for table cells as well as the calculation of related hypothesis tests and confidence intervals.
Creating contingency table output
To analyze this summary data with StatCrunch, choose the Stat > Tables > Contingency > With Summary menu option. Select the c and d columns containing the pairwise counts, select var1 under Row labels, specify a Column label of var2 (this is required because there is no designation of this in the summary data) and click Compute!. The resulting contingency table below shows the original data in the table. The remaining cells in the table show the row-wise totals, column-wise totals and the total number of pairs. The output also shows the results of a default Chi-Square test for independence. Since the cell counts are quite low in this case, a warning message is displayed below the test results. A better alternative for this data will be discussed below.
Displaying more information in the table cells
StatCrunch allows for additional information to be added to the table cells that contain the frequencies of the variable pairings. The statistics which can be added include the Row percent, Column percent and Percent of total. For this example, in the window containing the resulting contingency table above, choose Options > Edit to reopen the contingency table dialog window. In the Display options, select the Row percent option and click Compute!. The resulting table below now shows that two-thirds (66.67%) of the a values are paired with c values while one-third (33.33%) are paired with d values. The plot also shows a 50-50 split between c and d pairings for b values.
Computing different tests and confidence intervals
As mentioned above, the default Chi-Square test is not appropriate with this data due to the small cell counts. StatCrunch offers a number of tests which can be computed from the contingency table output including Fisher's exact test for independence, McNemar's test for marginal homogeniety, Cramer's V test for association, and the Mantel-Haenszel test. Note that some of these calculations are restricted to two-by-two tables. In the window containing the resulting contingency table above, choose Options > Edit to reopen the contingency table dialog window. Under Hypothesis Tests, deselect the default Chi-Square test for independence and select Fisher's exact test for independence (2x2 only). Click Compute!. The resulting output below shows the new results for the test selected. Note StatCrunch will also compute confidence intervals for selected statistics. The list of standard statistics includes Lambda, Uncertainty coefficient, Kappa, Gamma, Somers' d, Kendall's tau-b, Kendall's tau-c, Relative risk, and Odds ratio.

Always Learning