Exercise

Standardized Residuals

Our Chi-square test has told us that the categories in our investigation are not independent, and the Cramér’s V value of 0.31 tells us that there is a moderate association (0 means no association, and 1 is perfect). Now let's take a look at the residuals you calculated previously to see where there is the most deviation from the expected values.

To standardise our residuals we need to divide each residual value by its standard error.

It is possible to do this manually, but we can also do this in R very simply. When you assign the output of your chisq.test() to an object, this object contains more information than just the Chi-square value, including the standardised residuals! You can access these by indexing using $. For example, your_object$stdres would print your standardised residuals. Let's try it now!

Instructions

100 XP
  • Add a line of code to your script to print the standardised residuals from your Chi-square test.
  • Relax and admire your output!