# 22.4: Standardized Residuals

When we find a significant effect with the chi-squared test, this tells us that the data are unlikely under the null hypothesis, but it doesn’t tell us how the data differ. To get a deeper insight into how the data differ from what we would expect under the null hypothesis, we can examine the residuals from a model, which reflects the deviation of the data (i.e., the observed frequencies) from the model in each cell (i.e., the expected frequencies). Rather than looking at the raw residuals (which will vary simply depending on the number of observations in the data), it’s more common to look at ther standardized residuals, which are computed as:

$standardized\ residual_{ij} = \frac{observed_{ij} - expected_{ij}}{\sqrt{expected_{ij}}}$ where $i$ and $j$ are the indices for the rows and columns respectively.

The table shows these for the police stop data. These standardized residuals can be interpreted as Z scores – in this case, we see that the number of searches for black individuals are substantially higher than expected based on independence, and the number of searches for white individuals are substantially lower than expected. This provides us with the context that we need to interpret the signficant chi-squared result.

Table 22.4: Summary of standardized residuals for police stop data
searched driver_race Standardized residuals
FALSE Black -3.3
TRUE Black 26.6
FALSE White 1.3
TRUE White -10.4