<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by A. Musa on Medium]]></title>
        <description><![CDATA[Stories by A. Musa on Medium]]></description>
        <link>https://medium.com/@ahmedomusa?source=rss-e92173fdebfc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZmH6KAzjS7c_cCS4032pag.jpeg</url>
            <title>Stories by A. Musa on Medium</title>
            <link>https://medium.com/@ahmedomusa?source=rss-e92173fdebfc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:11:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmedomusa/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Equality vs. Equivalence in Distribution Testing]]></title>
            <link>https://ahmedomusa.medium.com/equality-vs-equivalence-in-distribution-testing-2c87607bbf3c?source=rss-e92173fdebfc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c87607bbf3c</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[hypothesis-testing]]></category>
            <category><![CDATA[mann-whitney]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[kolmogorov-smirnov-test]]></category>
            <dc:creator><![CDATA[A. Musa]]></dc:creator>
            <pubDate>Wed, 31 Jul 2024 14:46:24 GMT</pubDate>
            <atom:updated>2024-07-31T14:46:24.600Z</atom:updated>
            <content:encoded><![CDATA[<p>During my Master’s thesis, I dove into the fascinating world of distribution testing. These tests help us understand how similar or different two sets of data might be. There are two main approaches to testing distributions: parametric (assuming a specific type of distribution) and non-parametric (making no assumptions).</p><p>Here’s where things get interesting — another way to categorize these tests is by their focus: equality or equivalence.</p><h4>Equality Tests: Are distributions different?</h4><p>Equality tests assume, as their name suggests, that the two distributions are the same. Imagine comparing the heights of two groups of people. An equality test typically answers questions like: “Do these two groups differ in height?”. The null hypothesis is that the distributions are the same, and the alternative hypothesis is that they are different.</p><h4><strong>Equivalence Tests: Are distributions equal by a margin?</strong></h4><p>Equivalence tests, on the other hand, typically answer questions such as: “Are the two groups heights equal with a certain margin (i.e, their difference is less than this margin)?”. The null hypothesis is that the distributions are different by a certain margin, and the alternative is that they are the same.</p><h4>Understanding Hypothesis Testing: The Foundation</h4><p>Before diving into specific tests, let’s explore the core concept of hypothesis testing. We start with a null hypothesis, which is an initial assumption (e.g., the distributions are equal). Then, we calculate the probability (p-value) of observing our data if that assumption were true. If this probability is very low (lower than a chosen threshold called the significance level), we reject the null hypothesis. Think of it as strong evidence against the initial assumption. Additionally, a consistent test improves its accuracy with more data, eventually becoming certain of its findings with an infinite amount of data.</p><p>Let’s look at two example tests:</p><h4>Kolmogorov-Smirnov Test: Spotting the Differences</h4><p>One popular non-parametric test is the Kolmogorov-Smirnov (K-S) test. It works by assuming the null hypothesis of equality and then provides guarantees for avoiding false positives. In simpler terms, if the K-S test rejects the null hypothesis, you can be confident (with a certain level of certainty) that the distributions differ.</p><h4>Mann-Whitney Test: Finding the Similarities</h4><p>The Mann-Whitney test flips the script. It starts with the null hypothesis that the distributions are different by a certain margin. Then, it helps you avoid falsely concluding that the distributions are actually similar. Just like the K-S test, it becomes more reliable with more data.</p><h4>Choosing the Right Tool for the Job</h4><p>Both K-S and Mann-Whitney tests have their strengths and weaknesses depending on your needs and data size. Remember, failing to reject the null hypothesis doesn’t necessarily mean the distributions are identical, just that you lack strong evidence to prove otherwise. Only with an infinite amount of data can the absence of evidence become proof.</p><p>Alternatively, you can also consider taking a Bayes Factor distribution equality testing approach which provides a neat way to test both equivalence and equality. For example see this paper: <a href="https://www.tandfonline.com/doi/full/10.1080/10618600.2022.2067547">https://www.tandfonline.com/doi/full/10.1080/10618600.2022.2067547</a></p><p>Another thing to keep in mind when doing hypothesis testing is that you should consider reporting e-values instead of p-values, which provide many advantages. However, that is a topic for another day.</p><h4>Dive Deeper with Python!</h4><p>If the Mann-Whitney test sparks your curiosity, I’ve included a Python implementation on my GitHub for you to explore: <a href="https://github.com/ahmedomermusa/mawi/tree/main">https://github.com/ahmedomermusa/mawi/tree/main</a></p><p>Thank you for reading! I hope this blog post sheds light on the fascinating world of distribution testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c87607bbf3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>