Chi-square (x²) test for independence
The chi-square test for independence, or contingency table test, is a non-parametric test which uses the x² distribution to determine whether there is statistical independence between two variables or whether a relationship between them exists. The x² statistic is calculated by comparison of observed data values of two categories of two variables with the corresponding expected values which should occur if a null hypothesis is true. By reference to the input data contingency table (below) it can be seen that a typical null hypothesis would take the form of:
HO: The survival of a plant is independent of whether a drug treatment has been administered.
and the alternate hypothesis would take the form of:
HA: The survival of the plants is associated with the administration of the drug treatment.
The raw observed data is arranged in a contingency table such as the one below. Note that this accomodates the testing of the independence of the row data with that of the columns, and vice versa.
Script operation
The tool operates in a similar way to others with the exception that it will incorporate both row and column headings if they are included in the data input range. Once the input range has been entered, a requestor will ask you if the range includes row headings to the left-hand side of the data.
Click here for information about general script usage.
Click **need to insert graphic src here** for the formulae used by this test.
Note that this tool currently deals only with 2x2 contingency tables.
Raw cont. table data: Spreadsheet output: Dead Alive Chi-square test for independence Treated 9 15 Not treated 15 10 Expected Frequencies Dead Alive Treated 11.7551 12.2449 Not treated 12.2449 12.7551 Chi-square: 2.4806 d.f.: 1 P(CHI<=chi): 0.8847 Chi-Critical(95%): 3.8431 Chi-Critical(99%): 6.637 With Yates correction Chi-square: 1.662 P(CHI<=chi): 0.8027 Measures of Association: Phi.Coeff.: 0.225 Yules Q: -0.4286 Odds Ratio: 0.9 Pearson Cont.Coeff.: 0.2195 Cramers Phi.Coeff.: 0.225
Interpretation
In the first section of the output the expected frequencies are computed and printed for each of the original observed data elements. These are the expected frequencies if the null hypothesis is true.
Two chi-square values are calculated: one is a straightforward calculation and the other is modified after the application of Yate's continuity correction. In the case of a 2x2 contingency table where the degrees of freedom is always '1', the corrected chi-square value should always be used as it provides a more conservative estimate of x². In chi-square analysis the result, in the form of the x² statistic, is only an approximation to the theoretical distribution. At any other value of d.f. it is a reasonably accurate approximation and the Yate's correction factor can be ignored (it has little effect with larger d.f. and large sample sizes anyway).
Before analyzing the output it is worthwhile noting another proviso of the chi-square analysis method. It should not be used if any of the expected frequencies are seen to be less than '5'. This can be remedied by increasing the sample size or by using an alternative test that determines direct probability values:
Related tool:
From the output the x² statistic (corrected) can be seen to be 1.662 and the critical value at the 0.05 level of significance can be seen to be 3.8431. If testing at this level the null hypothesis would therefore be retained as the critical value is not exceeded by the test statistic. It would then be concluded that there is no statistically significant association between drug administration and survival.