# Chi-squared test

Command: | Tests Chi-squared test |

## Description

Allows to test the statistical significance of differences in a classification system (one-way classification) or the relationship between two classification systems (two-way classification).

To perform this Chi-squared test, you must already have the data classified in a frequency table (this test is not performed on the raw data).

A frequency table shows the number of cases that belong simultaneously to two or more distinct categories, e.g. patients cross-classified according to both gender and age group.

## Required input

The data of the contingence table have to be entered in the table in the dialog form. Either a one-way classification can be used (occupying one single row or one single column), or a two-way classification table up to a 6 x 9 table.

Optionally, you can select a **Chi-squared test for trend**. The Cochran-Armitage test for trend (Armitage, 1955) provides a more powerful test than the unordered test, but this test is only applicable if your classification table has 2 columns and 3 or more rows (or 2 rows and 3 or more columns), and if the data originate from ordered categories.

After you click the Test button (or press the *Enter* key) the program will automatically calculate the expected frequencies for every cell in the table, and the following results will be displayed:

**Chi-squared**with**degrees of freedom**and**P-value**. The Chi-squared statistic is the sum of the squares of the differences of observed and expected frequency divided by the expected frequency for every cell:For a 2x2 table, MedCalc uses the "N-1" Chi-squared test as recommended by Campbell (2007) and Richardson (2011). In the "N-1" Chi-squared test as given above is multiplied by a factor (

*N*-1)/*N*. The use of Yates' continuity correction is no longer recommended.If the calculated P-value is less than 0.05, then there is a statistically significant relationship between the two classifications.

The

**Contingency Coefficient**is a measure of the degree of relationship, association of dependence of the classifications in the frequency table. The coefficient is calculated as follows (**n**is the total number of cases in the table):The larger the value of this coefficient, the greater the degree of association. The maximum value of the coefficient, which is never greater than 1, is determined by the number of rows and columns in the table.

In the *Comment* input field you can enter a comment or conclusion that will be included on the printed report.

## Literature

- Altman DG (1991) Practical statistics for medical research. London: Chapman and Hall.
- Armitage P (1955) Tests for linear trends in proportions and frequencies. Biometrics 11:375-386.
- Campbell I (2007) Chi-squared and Fisher-Irwin tests of two-by-two tables with small sample recommendations. Statistics in Medicine 26:3661-3675. [Abstract]
- Richardson JTE (2011) The analysis of 2 x 2 contingency tables - Yet again. Statistics in Medicine 30:890. [Abstract]

## External links

- Cochran-Armitage test for trend on Wikipedia.