In statistics, a contingency table is used to classify various outcomes from an event. Based on those outcomes, it's easier to calculate different types of probabilities.
For example let us consider a distribution of 53 people as male or female, single or married. The contingency table to represent this information is as shown below.
How to achieve:
Often the data stored in a database is in a format as shown below.
Using Alteryx, a contingency table can be created from the dataset. Bring a summarize tool on the canvas and connect it with the dataset as shown below. Summarize on the fields which are needed, in this case group by for Gender and Status followed by count for Name field.
Next, append a CrossTab tool, group the data by Gender and change column header to Status and select the values from the drop down menu as Count, the aggregation method used here is summation.
In this way, contingency tables can be created on an ad-hoc basis as per the requirements.
Thus using Alteryx, it’s very easy to create contingency tables which can be used in statistical data analysis.