<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Who Eats More Chicken Wings? | Zhu Xuelin</title><link>https://linstats.github.io/teaching/dsa3361-tutorial-3/</link><atom:link href="https://linstats.github.io/teaching/dsa3361-tutorial-3/index.xml" rel="self" type="application/rss+xml"/><description>Who Eats More Chicken Wings?</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Fri, 11 Sep 2026 00:00:00 +0000</lastBuildDate><image><url>https://linstats.github.io/teaching/dsa3361-tutorial-3/featured.jpg</url><title>Who Eats More Chicken Wings?</title><link>https://linstats.github.io/teaching/dsa3361-tutorial-3/</link></image><item><title>Are Permutation Histograms Always Bell-Shaped?</title><link>https://linstats.github.io/teaching/dsa3361-tutorial-3/permutation-distribution-shape/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linstats.github.io/teaching/dsa3361-tutorial-3/permutation-distribution-shape/</guid><description>&lt;h2 id="a-common-misconception">A common misconception&lt;/h2>
&lt;p>Students sometimes connect permutation tests with the CLT, normal distributions, or bell-shaped histograms. Just one caution: a permutation distribution is &lt;strong>not necessarily bell-shaped&lt;/strong>. Its shape depends on what we choose to recalculate.&lt;/p>
&lt;p>In the main example, we use &lt;code>avg(boys) - avg(girls)&lt;/code>. This statistic can be positive or negative, and its permutation distribution is centred around 0. But we could instead use &lt;code>|avg(boys) - avg(girls)|&lt;/code>. This quantity is never negative, so its permutation distribution has a very different shape:&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="Permutation distribution of the absolute mean difference." srcset="
/teaching/dsa3361-tutorial-3/permutation-distribution-shape/images/absolute-difference_hu16378422144750002952.webp 400w,
/teaching/dsa3361-tutorial-3/permutation-distribution-shape/images/absolute-difference_hu15247314436239631867.webp 760w,
/teaching/dsa3361-tutorial-3/permutation-distribution-shape/images/absolute-difference_hu16346708913941192458.webp 1200w"
src="https://linstats.github.io/teaching/dsa3361-tutorial-3/permutation-distribution-shape/images/absolute-difference_hu16378422144750002952.webp"
width="760"
height="382"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>The key question is not whether the histogram looks normal. The key question is: &lt;strong>under the null assumption, which values would be considered extreme?&lt;/strong>&lt;/p>
&lt;p>Once “extreme” has been defined appropriately, we can calculate the p-value in the same spirit.&lt;/p></description></item><item><title>Choosing a Quantity for a Permutation Test</title><link>https://linstats.github.io/teaching/dsa3361-tutorial-3/choosing-test-statistic/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linstats.github.io/teaching/dsa3361-tutorial-3/choosing-test-statistic/</guid><description>&lt;h2 id="what-should-we-recalculate">What should we recalculate?&lt;/h2>
&lt;p>You may be wondering: &lt;strong>in a permutation test, what quantity should we use?&lt;/strong> For example, if we want to test whether &lt;code>avg(boys) = avg(girls)&lt;/code>, we could use&lt;/p>
&lt;ul>
&lt;li>&lt;code>avg(boys) - avg(girls)&lt;/code>, or&lt;/li>
&lt;li>&lt;code>avg(boys) ÷ avg(girls)&lt;/code>.&lt;/li>
&lt;/ul>
&lt;p>That is a good question because it has two parts: &lt;strong>what hypothesis are we trying to check, and which quantity helps us check it?&lt;/strong> Let’s use a small stock-return example.&lt;/p>
&lt;h2 id="two-stocks-five-daily-returns">Two stocks, five daily returns&lt;/h2>
&lt;p>Suppose the daily returns are:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">&lt;/th>
&lt;th style="text-align: left">Daily returns&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">Stock 1&lt;/td>
&lt;td style="text-align: left">+1%, −2%, +3%, +2%, +5%&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">Stock 2&lt;/td>
&lt;td style="text-align: left">−3%, −2%, +4%, +1%, −7%&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Our hypothesis is:&lt;/p>
&lt;blockquote>
&lt;p>&lt;strong>Hypothesis A:&lt;/strong> In the long run, &lt;code>avg(Stock 1) = avg(Stock 2)&lt;/code>.&lt;/p>
&lt;/blockquote>
&lt;h2 id="option-1-the-signed-difference">Option 1: the signed difference&lt;/h2>
&lt;p>We can use &lt;code>avg(Stock 1) − avg(Stock 2)&lt;/code>. This quantity can be positive or negative. If Hypothesis A is true, we expect the permutation distribution to be centred around &lt;strong>0&lt;/strong>, with positive and negative values on both sides:&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="Permutation distribution of the signed difference between the two stock means." srcset="
/teaching/dsa3361-tutorial-3/choosing-test-statistic/images/signed-difference_hu5630429043551780361.webp 400w,
/teaching/dsa3361-tutorial-3/choosing-test-statistic/images/signed-difference_hu2993194338501466600.webp 760w,
/teaching/dsa3361-tutorial-3/choosing-test-statistic/images/signed-difference_hu11364085410694390031.webp 1200w"
src="https://linstats.github.io/teaching/dsa3361-tutorial-3/choosing-test-statistic/images/signed-difference_hu5630429043551780361.webp"
width="760"
height="497"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>After this, the rest is just like chicken wing example: decide what counts as extreme, then calculate the proportion of permutation results at least that extreme.&lt;/p>
&lt;h2 id="option-2-the-absolute-difference">Option 2: the absolute difference&lt;/h2>
&lt;p>We can also use &lt;code>|avg(Stock 1) − avg(Stock 2)|&lt;/code>. This quantity is never negative. If Hypothesis A is true, we expect it to be &lt;strong>small&lt;/strong>, so the permutation distribution looks different:&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="Permutation distribution of the absolute difference between the two stock means." srcset="
/teaching/dsa3361-tutorial-3/choosing-test-statistic/images/absolute-difference_hu1523390929761735785.webp 400w,
/teaching/dsa3361-tutorial-3/choosing-test-statistic/images/absolute-difference_hu4296223415435695690.webp 760w,
/teaching/dsa3361-tutorial-3/choosing-test-statistic/images/absolute-difference_hu17311765055137505500.webp 1200w"
src="https://linstats.github.io/teaching/dsa3361-tutorial-3/choosing-test-statistic/images/absolute-difference_hu1523390929761735785.webp"
width="760"
height="497"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>Here is a small challenge: &lt;strong>which part of this histogram should count as extreme?&lt;/strong> Once we define “extreme,” we can again calculate the proportion of permutation results that are at least as extreme as the observed value. That proportion is our p-value.&lt;/p>
&lt;h2 id="why-not-use-the-ratio">Why not use the ratio?&lt;/h2>
&lt;p>The ratio &lt;code>avg(Stock 1) ÷ avg(Stock 2)&lt;/code> is less convenient here:&lt;/p>
&lt;ol>
&lt;li>The two averages can be positive or negative, so the ratio can jump between positive and negative values.&lt;/li>
&lt;li>Some returns are close to 0%. If a permutation average gets close to 0 in the denominator, the ratio can become enormous or unstable.&lt;/li>
&lt;/ol>
&lt;p>In theory, if the two means were equal and safely away from zero, we might expect &lt;code>|avg(Stock 1) ÷ avg(Stock 2)|&lt;/code> to be around 1. But the sign changes and near-zero denominators make this statistic awkward for this example, so we set it aside.&lt;/p>
&lt;h2 id="so-which-quantity-should-we-use">So, which quantity should we use?&lt;/h2>
&lt;p>There is no single fixed answer. It depends on the question we want to study: are we asking whether two groups have equal means, or whether one group’s mean equals a particular value such as 20 wings?&lt;/p>
&lt;p>Under a given hypothesis, a quantity is useful when its permutation distribution has a pattern we can understand and use to define “extreme.” The two plots above show two reasonable choices for the same equality question; they simply require us to define extremeness in different ways.&lt;/p></description></item><item><title>Why Use the Smaller Tail?</title><link>https://linstats.github.io/teaching/dsa3361-tutorial-3/two-sided-p-value/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linstats.github.io/teaching/dsa3361-tutorial-3/two-sided-p-value/</guid><description>&lt;h2 id="why-define-the-two-sided-p-value-as-2--minp_left-p_right-instead-of-using-max">Why define the two-sided p-value as &lt;code>2 × min(p_left, p_right)&lt;/code> instead of using &lt;code>max&lt;/code>?&lt;/h2>
&lt;p>First, don’t worry about this for exams or daily use. Usually, &lt;code>p_left&lt;/code> and &lt;code>p_right&lt;/code> are fairly similar, say 0.009 and 0.012. So &lt;code>min&lt;/code> and &lt;code>max&lt;/code> often lead to the same conclusion.&lt;/p>
&lt;p>But let’s dig a little deeper. What if &lt;code>p_left = 0.001&lt;/code> and &lt;code>p_right = 0.026&lt;/code>? Then:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>2 × min = 0.002 → reject the assumption.&lt;/strong>&lt;/li>
&lt;li>&lt;strong>2 × max = 0.052 → just fail to reject.&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>Why do we use the &lt;code>min&lt;/code>? The symbol &lt;strong>⇔&lt;/strong> means “is equivalent to.”&lt;/p>
&lt;ul>
&lt;li>&lt;code>2 × min &amp;lt; 0.05&lt;/code> ⇔ &lt;code>p_left &amp;lt; 0.025&lt;/code> &lt;strong>OR&lt;/strong> &lt;code>p_right &amp;lt; 0.025&lt;/code> ⇔ &lt;strong>at least one direction is sufficiently extreme.&lt;/strong>&lt;/li>
&lt;li>&lt;code>2 × max &amp;lt; 0.05&lt;/code> ⇔ &lt;code>p_left &amp;lt; 0.025&lt;/code> &lt;strong>AND&lt;/strong> &lt;code>p_right &amp;lt; 0.025&lt;/code> ⇔ &lt;strong>both directions must be sufficiently extreme.&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>The second rule asks for more than we want: one sufficiently extreme direction is already enough evidence against our assumption. A silly analogy:&lt;/p>
&lt;blockquote>
&lt;p>&lt;strong>Assumption:&lt;/strong> this person is innocent.&lt;/p>
&lt;p>&lt;strong>Evidence 1:&lt;/strong> He is holding a knife covered with the victim’s blood.&lt;/p>
&lt;p>&lt;strong>Evidence 2:&lt;/strong> He owns an old rusty gun that stopped working years ago.&lt;/p>
&lt;/blockquote>
&lt;p>Even if Evidence 2 is only borderline suspicious, Evidence 1 alone may already give us a strong reason to question the assumption. We don’t need both pieces of evidence to be equally suspicious!&lt;/p>
&lt;p>This analogy is just about &lt;strong>OR versus AND&lt;/strong>. In our symmetric permutation distribution, the two tails are equal in theory; the unequal values above are only a thought experiment to make the logic easier to see.&lt;/p></description></item></channel></rss>