TeachingDemos (version 2.12)

chisq.detail: Print details of a chi-squared test

Description

Prints out the details of the computations involved in a chi-squared test on a table. Includes the expected values and the chi-squared contribution of each cell.

Usage

chisq.detail(tab)

Value

This function is used primarily for its side effect of printing the results, but does return invisibly a list with the following components:

obs

A matrix of the observed values, same as tab.

expected

A matrix of the expected values under the null hypothesis.

chi.table

A matrix of the chi-squared contributions of each cell.

chi2

The chi-squared test statistic.

Arguments

tab

Matrix or table to be analyzed

Author

Greg Snow, 538280@gmail.com

Details

This function prints out the input table along with the expected value for each cell under the null hypothesis. It also prints out the chi-squared contribution of each cell in the same pattern as the table. This shows the computations involved and one rule of thumb is to look for these values that are greater than 4 as a post-hoc analysis.

References

~put references to the literature/web site here ~ Moore, bps

See Also

chisq.test,loglin, xtabs, table, prop.table, CrossTable from the gmodels package.

Examples

Run this code
chisq.detail(HairEyeColor[,,1])
chisq.detail(HairEyeColor[,,2])

Run the code above in your browser using DataLab