How to visualise an AB test in Tableau?

Kirill Eremenko
A free video tutorial from Kirill Eremenko
Data Scientist
4.5 instructor rating • 118 courses • 1,541,541 students

Lecture description

Learn how to do an AB test in Tableau with accessible and comprehensive visualization

Learn more from the full course

Data Science A-Z™: Real-Life Data Science Exercises Included

Learn Data Science step by step through real Analytics examples. Data Mining, Modeling, Tableau Visualization and more!

21:12:10 of on-demand video • Updated September 2020

  • Successfully perform all steps in a complex Data Science project
  • Create Basic Tableau Visualisations
  • Perform Data Mining in Tableau
  • Understand how to apply the Chi-Squared statistical test
  • Apply Ordinary Least Squares method to Create Linear Regressions
  • Assess R-Squared for all types of models
  • Assess the Adjusted R-Squared for all types of models
  • Create a Simple Linear Regression (SLR)
  • Create a Multiple Linear Regression (MLR)
  • Create Dummy Variables
  • Interpret coefficients of an MLR
  • Read statistical software output for created models
  • Use Backward Elimination, Forward Selection, and Bidirectional Elimination methods to create statistical models
  • Create a Logistic Regression
  • Intuitively understand a Logistic Regression
  • Operate with False Positives and False Negatives and know the difference
  • Read a Confusion Matrix
  • Create a Robust Geodemographic Segmentation Model
  • Transform independent variables for modelling purposes
  • Derive new independent variables for modelling purposes
  • Check for multicollinearity using VIF and the correlation matrix
  • Understand the intuition of multicollinearity
  • Apply the Cumulative Accuracy Profile (CAP) to assess models
  • Build the CAP curve in Excel
  • Use Training and Test data to build robust models
  • Derive insights from the CAP curve
  • Understand the Odds Ratio
  • Derive business insights from the coefficients of a logistic regression
  • Understand what model deterioration actually looks like
  • Apply three levels of model maintenance to prevent model deterioration
  • Install and navigate SQL Server
  • Install and navigate Microsoft Visual Studio Shell
  • Clean data and look for anomalies
  • Use SQL Server Integration Services (SSIS) to upload data into a database
  • Create Conditional Splits in SSIS
  • Deal with Text Qualifier errors in RAW data
  • Create Scripts in SQL
  • Apply SQL to Data Science projects
  • Create stored procedures in SQL
  • Present Data Science projects to stakeholders
English In this tutorial I will show you how to run simple A-B tests in Tableau. And as you will see they will be extremely visual just like everything else in Tableau to start off we're going to save the name of this worksheet and I'm going to call it map so that we can remember what exactly it contains. Now I'm going to go to file and I'm going to save the whole workbook. So I'm going to click save as and I'm going to call my workbook "data mining" and I'll save it into the same folder as the data set. And by the way, if you're using Tableau public the free version of Tablo then you will have to save your workbook to the Tableau public servers but that's not a problem because we're not working with sensitive data here. This is all mockup data. So now what we're going to do is create a new tab or a worksheet and in this worksheet we're going to run a very first AB test in Tableau. So the first thing we need is the dependent variable that we're examining which is exit. Did the person leave or not. And as we can see it's in measures at the moment. So Tableau has recognized this column as a measure meaning that it's looking at it as a number rather than as a category for us exited is actually a category. Did the person leave or not. So it's basically a flag. And that's why we need to move it into dimensions. It is going to drag it into dimensions as we saw in the previous section of the course. And now we have the exited flag here and we can start constructing our AB test and I will show you a step by step method to perform this visualization of an AB test. So let's get started. The classic and most commonly used example when AB test is an AB test for gender. So how about we run one of those four hour data set. And basically what we'll be testing is if we hold everything else equal and we take a male customer and a female customer which one of them is more likely to exit. So let's take gender and we will drag gender on to columns. Now we got two columns of male and female. Now what we want to do is take exited and drag it onto color. This gives us two colors 0 blue for zero meaning people who did not exit an orange for one. Meaning people who did exit and now we're going to take a number of records because we want to see how many people actually left and we will drag a number of records into our rows. So I'm going to move this up a little bit so that we have some space. So what you can see here is there is more males than females and of the females. Quite a large portion left of the males a small portion left. However this is not sufficient for us to understand what exactly is happening and we have to fix this up a little bit to visualize the AB test. First of all let's add the total number of records as a label We already know how to do that and we'll take number of records and dragged into label and let's increase the font of the label so we can actually see it, right? Make it bold. There we go. So that's how many records we have in each of these boxes. Now what we want to do is we want to replace the actual number of records with a percentage. So we want to see rather than the absolute value of female customers that left and left these ones left in the orange bar and the ones that stayed. We want to see the percentage So what percentage of female customers left and what percentage of male customers left because that way we'll be able to compare them to each other. Right now we can't compare them because there is a different number of total customers in each of these groups in order to convert these absolute values into percentages. We need to go to the dropdown menu of this some number of records. Now here we need to select Add table calculation. Once you select a table calculation we need a percentage of total And here an important step is to change from table across to table down. And what that will do is will give us a percentage of total in each column. So we click OK. And as you can see the number has changed. What we'll do now is we will format the label so we'll right click will go to format and will change this to percentage just to zero decimal places. And finally to make this consistent what we're going to do is we're going to take some number of records table calculation and you can see that there is a table calculation by this little triangle that has appeared on the right and we will call hold on control and we'll drag it to replace existing some number of records in the rows area. What that does is now it's consistent. And even the access over here represents the percentage before it was just the absolute value. But now the height of the bar and the label inside the bar are actual light. And so let's analyze this for a second. From here we can see right away that irrespective of the number of female and male customers the percentage of male customers that left the bank is only 16 percent and that is less than the percentage of female customers that left the bank. So the conclusion that we can make from here is that female customers are more likely to leave the bank than male customers. All other things held equal. And bear in mind that this is not the full statistical AB test because we did not check for statistical significance. However this is a very quick and convenient and visual approach which can give you very fast results . And then if you find something of interest you can go and investigate it further and do the proper statistical AB test check for significance and things like that. But personally I really like this approach. I like this method because it helps me focus on things that actually matter and not waste my time on variables that don't actually affect my end result. So we'll be doing lots more of these in this section. Hope this framework is useful and you will see how powerful it is as we go through the tutorials that are ahead of us. I look forward to see you next time. And until then happy analyzing