Hands-On: Perform Tests on Categorical Variables

Note

This lesson is a continuation of the Interactive Visual Statistics hands-on tutorial.

So far, we’ve implemented hypothesis testing only on numerical variables. Now, let’s test whether two categorical variables in the winequality dataset are independent.

To do this, we will use the Chi-square Independence Test card.

  • Click the New Card button from the “Worksheet” header, then select Statistical tests. Under Categorical test, click Chi-square Independence Test.

  • Select the categorical variable quality for “Variable 1”.

  • Select the categorical variable type for “Variable 2”.

  • Keep the default values 5 for “Maximum X Values to Display” and “Maximum Y Values to Display”.

  • Click Create Card to create the card.

../../../_images/stats_chi-square_card.png

The card displays the tested hypothesis, results of the test, and a conclusion about the test — in this case, “Variables quality and type are not independent”. For more information about this card, see Chi-square independence test in the reference documentation.