Application of the Mann–Whitney U Test in E-Commerce Customer Analysis
The Mann–Whitney U test, also known as the Mann–Whitney–Wilcoxon test or the Mann–Whitney rank test,
was invented in 1947 by two statistics of Henry Mann and Donald Whitney. This test is a nonparametric alternative to the t-Student test.
This test is used in situations where the data does not meet the assumptions necessary for parametric tests.
Specifically, whether the distribution of the frequency of the characteristics is a normal distribution. In other words, if the population tested is statistically strange.
In this test, checking the compliance of the population with normal distribution is crucial. When we say that the distribution of characteristics meets the assumptions of normal distribution, it means,
that the values of a particular characteristic (e.g. customer expenditure, number of products purchased, time spent on the site) are distributed in a way characteristic of the normal distribution.
This distribution has specific properties that affect the way the data is analysed.
Suppose we analyze the amounts we spend-
When purchased by customers. If these amounts meet the assumptions of normal distribution, they have the following characteristics.
Symmetry. Customer spending is distributed symmetrically around the average value, i.e. customers spend approximately above and below the average.
For example, if- Sli average amount spent by customers is 100 PLN, the same people spend between 80 and 100 PLN, as between 100 and 120 PLN.
In the normal distribution, the mean, median (central value) and mode (the most frequent value) are the same. That is why this distribution is symmetrical.
When most expenses are close to the average, we have a clue that customers' expenses have a schedule.
Most data are close to the average when about 68% of all expenditure observed falls within one standard deviation from the average,
95% of customers in the two standard deviations range.
For example, if the average amount of expenditure is PLN 100 and the standard deviation is PLN 20, 68% of customers spend from PLN 80 to 120 and 95% from PLN 60 to PLN 140.
There are no non-deviating values. In the distribution of normal extreme values (i.e. very small or very large expenses) are rare.
This means that most customers spend amounts close to the average and cases where
someone spends very little or very much, are unlikely.
Many standard statistical tests (e.g. t-Student test) assume that the data have a normal distribution.
If the information of the online store customers (e.g. their expenses) is consistent with the normal schedule,
you can safely use classic parametric tests (i.e. based on normal distribution). However, if the data are asymmetrical or contain multiple values that stand aside,
parametric tests may give incorrect results and in such cases non-parametric tests, such as Mann-Whitney U test, must be used.
Application to recommendation strategies
Suppose we want to check whether changing the strategy of product recommendations affects the average amount of customer spending.
If the distribution of customer expenditure meets the assumptions of normality, we can use the t-Student test to compare the average expenditure of two customer groups (e.g. those,
recommended for popular products and those recommended on the basis of the purchase history).
We assume that most customers spend amounts close to average, and extreme values are rare.
However, if the customer's expenditure is very diverse, e.g. some spend very little and others very much, which makes the distribution unbalanced,
In this case, we should use non-parametric tests. This test is the U Mann-Whitney test.
Mann-Whitney's U test is used when dealing with data with abnormal distribution of ub when data samples are of different sizes.
This is often found in marketing analyses where customer behaviour data can be distributed, extreme or when data come from small, uneven groups.
In the context of the creation of re-<recommendation systems for online shops, the U Mann-Whitney test can be used to analyze differences in behavior of two customer groups.
After all, it is a nonparametric equivalent of the T test, < which operates only on two groups. Let's imagine the situation in which the owner of the online store introduces
two different product recommendation strategies for customers.
The purpose of the analysis is to determine which strategy generates greater profits, higher conversion rates, or greater involvement of users.
We see that the way of reasoning here is identical to the approach that we use in the t-Student test.
Suppose we have two groups of customers:
Group A: customers whose recommendations are displayed on the basis of the popularity of products.
Group B: customers whose recommendations are displayed based on their purchase history.
In this case, the U Manna-Whitney test may be used to compare the median conversion rate (the percentage of customers purchasing after seeing the recommendation) for both groups.
An example can be the situation where Group A has a more dispersed conversion rate than Group B, which suggests that some recommendations are very effective,
But most of it doesn't lead to shopping. Group B can have more stable results, which indicates a more personalized approach.
The t-Student test assumes that the distribution of the variables tested is normal and the variances in both groups compared are equal.
However, in practice, especially in marketing analyses and customer behaviour testing, these assumptions are often not met. For example,
the results of purchases or clicks in the recommendation systems can be extremely different depending on the individual preferences of customers, which leads to a large range of results.
Such data may be asymmetrical or contain multiple deviation values, which excludes the use of the t-Students test.
Mann-Whitney's U test is suitable in situations of unequal groups, dispersion of results or their low predictability.
It's a nonparametric test, so it doesn't require a normal distribution.
This test is based on data rank rather than numerical value, which makes it more resistant to deviations from normality and inequality
variance. That's why it is often used in behavioral analyses, where data comes from natural, often unpredictable behaviours of customers,
And the distribution of results is far from normal.
We have an online store, we want to see if the new marketing strategy attracts more committed customers.
The company divided customers into two groups: some saw a traditional advertising campaign and others received personalised offers based on their previous purchases.
To assess the effectiveness of these strategies, the company measures the number of pages that customers have viewed in both groups after entering the store's website.
Let's assume that in the group of traditional campaigns the results of browsing pages are very scattered • some customers have looked at very many pages, while others have only one or two.
In turn, in the group that received personalized offers, most customers looked at a relatively small number of pages, but their behaviour is more uniform.
However, these behaviours are inherently asymmetrical and diffuse, which excludes the use of the t-Students test.
Mann-Whitney's U test would allow the company to compare the median number of pages viewed between groups, taking into account both variance inequality,
as well as potential deviations from normal distribution. The result of this test could indicate which strategy is more effective in attracting customers' interest.
Why is Mann-Whitney's U test so useful in analysing customer behavior?
Customer behaviours are often not subject to simple patterns and data on them may be unstable and irregular.
Therefore, nonparametric tests such as Mann-Whitney's U test are extremely useful in market analysis.
They help to better understand how different customer groups react to different marketing strategies or recommendation systems, even if the data are uneven or have large
the number of deviations.
Wojciech Moszczyński — graduate of the Department of Econometrics and Statistics of Nicolaus Copernicus University in Toruń; specialist in econometrics, finance, data science, and management accounting. He specializes in the optimization of production and logistics processes. He conducts research in the area of the development and application of artificial intelligence. For years he has been engaged in the popularization of machine learning and data science in business environments.
