Contents Up << >>

Chisq

Format: C[hisq] [f] [n] [cols rows]
This command sets up a contingency table and performs a chi-squared test on that table to determine the extent to which the values in the table depart from those expected if there is no tendency for categories to be associated with each other.

There are two options. An F will mean that provided a two-by-two table is used Fisher's exact test will always be performed, regardless of the values in the table. EASISTAT automatically performs Fisher's exact test if there is a total of less than 20 items in the table or if the expected value for any cell is less than 5, but specifying F will cause EASISTAT to perform Fisher's test even if these conditions are not met. The N option means that instead of composing the contingency table by applying conditions to the data in EASISTAT's data table, the user can enter by hand the values that he or she wants to appear in each cell of the table.

The user must supply the number of columns and rows for the table. These can optionally be supplied on the command line, otherwise EASISTAT will request them to be entered. The user must also supply the conditions to be used to categorise the values into these rows and columns, or alternatively (when the N option is used) must enter the numbers for each cell of the contingency table.

Example:

Enter command -  CHISQ

- Chi-squared test -
Input number of columns:    2
Input number of rows:    2
Enter condition for column 1: C15<12
Enter condition for column 2: C15>=12
Enter condition for row A: SEX=1
Enter condition for row B: SEX=2
Output:

Column 1: C15<12
Column 2: C15>=12

Row A: SEX=1
Row B: SEX=2


1                  2

A  31.0 31.0% (32.12) 42.0 42.0% (40.88)      73.0  73.0%


B  13.0 13.0% (11.88) 14.0 14.0% (15.12)      27.0  27.0%

44.0 44.0%         56.0 56.0%              100.0

Chi-squared = 0.258, 1 df   p = 0.6113

Using Yates' correction: Chi-squared = 0.079, 1 df p = 0.7785
In this example the first column consists of the number of data rows for which C15 is less than 12, and the second column the number of rows for which it is greater than or equal to 12. (In the example data set in the file EXAMPLE.DAT, C15 contains the GHQ scores.) The rows of the contingency table contain a count of the number of rows of the data table for which the value in the column titled SEX (column 3 in the example data set) is equal to 1 or to 2. The contingency table output shows the observed number of values falling into each category followed by the observed percentage and then in brackets by the expected number for each category. Since this example was performed with 100 valid data rows, the observed numbers and percentages are in fact equal. Row and column totals and percentages are also output.

Example:

Enter command -  c n f

- Chi-squared test -
Input number of columns:   2
Input number of rows:   2
Enter 2 values for row A (all on one line): 13 7
Enter 2 values for row B (all on one line): 10 6

Output:

1                2

A    13 (12.78) 36.1%  7 ( 7.22) 19.4%      20  55.6%

B    10 (10.22) 27.8%  6 ( 5.78) 16.7%      16  44.4%

23  63.9%        13  36.1%             36

Chi-squared = 0.024, 1 df   p = 0.8767

Using Yates' correction: Chi-squared = 0.038, 1 df p = 0.8462

Fisher's exact test, p = 0.5752
When the N option is used the values to go into the table are entered directly by the user rather than being counted from the data set. In the example above the user enters the values 13, 7, 10 and 6 for a two-by-two table. Since the F option was also specified, Fisher's exact test is also performed.

Example:

Enter command -  CH 2 3

- Chi-squared test -
Enter condition for column 1:    SEX=1
Enter condition for column 2:    SEX=2
Enter condition for row A:    CLASS=1
Enter condition for row B:    CLASS=2
Enter condition for row C:    CLASS>2
Output:

1                  2

A    41 (40.88) 41.0%   15 (15.12) 15.0%        56  56.0%

B    24 (25.55) 24.0%   11 ( 9.45) 11.0%        35  35.0%

C     8 ( 6.57)  8.0%    1 ( 2.43)  1.0%         9   9.0%

73  73.0%          27  27.0%              100

Chi-squared = 2.011, 2 df   p = 0.3659

Using Yates' correction: Chi-squared = 0.537, 2 df p = 0.7644
Comments

CHANGE PERCENTAGES

The CHISQ command outputs the observed value in each cell, the expected value in brackets, the column and row totals and the percentages each figure represents with respect to the total number of items. This means that the command can be used simply to provide a frequency distribution of the numbers and percentages of certain observations falling within certain criteria, by setting up a table with only one column. Here's how we can see the numbers and percentages falling within different ranges of GHQ score:

Enter command - c

- Chi-squared test -
Input number of columns:   1
Input number of rows:   5
Enter condition for column 1:    1
Enter condition for row A:    GHQ<=25
Enter condition for row B:    GHQ>25&GHQ<=35
Enter condition for row C:    GHQ>35&GHQ<=45
Enter condition for row D:    GHQ>45&GHQ<=55
Enter condition for row E:    GHQ>55
Output:

1

A    31 (31.00) 35.6%        31  35.6%

B    35 (35.00) 40.2%        35  40.2%

C    11 (11.00) 12.6%        11  12.6%

D     7 ( 7.00)  8.0%         7   8.0%



E     3 ( 3.00)  3.4%         3   3.4%

87  100.0%               87
The expected values and row totals are still calculated, though obviously they are the same as the observed values. The use of just one column in this way can be particularly useful when preparing graphs, especially of continuous variables.