Statistical significance testing
# Chi-squared test for r x c contingency table

Undertake a chi-squared test on a contingency table with >=2 rows and or >=2 columns.

Undertake a chi-squared test on a contingency table with >=2 rows and or >=2 columns.

Inputs are:

- the desired level of confidence in the estimate;
- the desired precision of the results; and
- three or more columns of data. The first row and column are group identifiers for rows and columns, respectively. The remaining cells are the respective counts for each combination of row and column categories. Do not include row or column totals.

Outputs include:

- the table of observed counts, with row and column totals;
- a table of row proportions (each cell as a proportion of the corresponding row total), with row totals;
- chi-squared statistic, degrees of freedom and corresponding P-value; and
- a stacked bar chart of cell frequencies for each column category in each row category.

Additional outputs are included if there are only two columns of data (column variable is dichotomous) - table and graph of proportions (as a proportion of row total) and associated confidence limits for the first column in each row.