r:chi-square-test
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| r:chi-square-test [2022/10/05 10:18] – astefanowitsch | r:chi-square-test [2024/06/20 13:53] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | **[ [[R: | ||
| + | |||
| + | ====== The Chi-Square test ====== | ||
| + | |||
| + | ===== Prerequisites ===== | ||
| + | |||
| + | * Your data must have the form of a contingency table (see [[R: | ||
| + | |||
| + | ===== How to calculate the chi-square test ===== | ||
| + | |||
| + | Assuming that you have a contingency table that is stored in a variable called '' | ||
| + | |||
| + | chisq.test(mytable, | ||
| + | |||
| + | The option '' | ||
| + | |||
| + | By default, R does not show the expected frequencies or the residuals, but they are created as internal variables by the '' | ||
| + | |||
| + | To show the expected frequencies, | ||
| + | |||
| + | chisq.test(mytable, | ||
| + | |||
| + | or | ||
| + | |||
| + | chisq.test(mytable, | ||
| + | |||
| + | |||
| + | ===== Additional information ===== | ||
| + | |||
| + | * When you report the result of a chi-square test, you should include a) the chi-square value, b) the degrees of freedom, and c) the p-value | ||
| + | * If you want to present your data visually, a bar plot is usually the right way of doing so (see [[R: | ||
