Difference between one-way and two-way tables¶
A one-way table describes counts for each outcome in a single variable. A two-way table describes counts for combinations of outcomes for two variables. when we consider a two-way table, we often would like to know if the variables are related in any way; that is, are they dependent or independent?
Computing expected counts in a two-way table¶
To identify the expected count for the \(i^{th}\) row and \(j^{th}\) column, compute \(\(\text{Expected Count}_{\text{row }i, \text{col }j}=\frac{(\text{row } i \text{ total}) \times (\text{column } j \text{ total})}{\text{table total}}\)\)
Chi-square test for two-way tables¶
Computed the same way as a one-way table. Compute (observed count - expected count)\(^2\) / expected count for each cell and take the sum to find \(X^2\).
Degrees of freedom for two-way tables¶
\(df =\) (number of rows minus 1) \(\times\) (number of columns minus 1)