<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://sthemonica.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sthemonica.github.io/" rel="alternate" type="text/html" /><updated>2026-10-25T17:25:11+01:00</updated><id>https://sthemonica.github.io/feed.xml</id><title type="html">Sthefanie Monica Premebida</title><subtitle>Doutoranda em Ciência da Computação | Constructor University | Bremen, Alemanha</subtitle><entry xml:lang="en"><title type="html">Hypothesis Testing, Tokyo Drift Style</title><link href="https://sthemonica.github.io/articles/2025/drift-en/" rel="alternate" type="text/html" title="Hypothesis Testing, Tokyo Drift Style" /><published>2025-09-30T00:00:00+02:00</published><updated>2025-09-30T00:00:00+02:00</updated><id>https://sthemonica.github.io/articles/2025/drift-en</id><content type="html" xml:base="https://sthemonica.github.io/articles/2025/drift-en/"><![CDATA[<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3MzVkNzdpZ3hyc3NjaGNkNTJrZXppbmhpbzdhbndsanBvZmNpNzE1diZlcD12MV9naWZzX3NlYXJjaCZjdD1n/77r1et1tb9IUczHS4j/giphy.gif" alt="Alt Text" /></p>

<p>That was the question I asked myself this weekend, after watching <em>“The Fast and the Furious: Tokyo Drift”</em> for the first time: how could I use the boldness of drifting to explain a good Hypothesis Test to my students? After all, how do you turn a statistical concept that is essential in the data field into something that isn’t confusing at first glance?</p>

<p>The answer came in today’s class. At the end, to win everyone over, I used an example that made the whole room laugh, and I decided to share it here.</p>

<hr />

<h2 id="the-starting-point">The starting point</h2>

<p>While watching the movie FOR THE FIRST TIME, two questions came to mind:</p>

<ul>
  <li><em>“Could I drift with my little VW Gol?”</em></li>
  <li><em>“Did the number of car rollovers go up after the movie came out?”</em></li>
</ul>

<p>We’ll set the first question aside (for the sake of my little Gol), but the second one is a perfect starting point for a hypothesis test.</p>

<p><img src="https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExODYyNXVlOTVqYmZiYjBndDVwcHIzeWx1ZWpuOXJzMzA2Y2s2dnN3NCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/S6yhb6s2dKlfZMwop6/giphy.gif" alt="Alt Text" /></p>

<p>It all starts with a question. In our case:
<strong>“Did the average number of rollovers increase after the movie’s release?”</strong></p>

<hr />

<h2 id="defining-the-hypotheses">Defining the hypotheses</h2>

<p>With the question defined, we create our hypotheses. I like to start with the <strong>Alternative Hypothesis (Hₐ)</strong> and then move to the <strong>Null Hypothesis (H₀)</strong>, so let’s follow that order here. Hₐ is basically our suspicion, the thing we want to investigate.</p>

<ul>
  <li><strong>Alternative Hypothesis (Hₐ):</strong> The average number of rollovers increased after the movie’s release.</li>
</ul>

<p>H₀ is always the antagonist of our Hₐ, meaning we write it as the opposite of the alternative (we can also think of it as our “business as usual” :D)</p>

<ul>
  <li><strong>Null Hypothesis (H₀):</strong> The average number of rollovers stayed the same or decreased after the movie’s release.</li>
</ul>

<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3Zm93bnlkcTFlM2YyeGY0bDk2bnNqc3h1azg0eHBoNmFhNmVxd2UzZyZlcD12MV9naWZzX3JlbGF0ZWQmY3Q9Zw/TFcwaBxd3lCQE/giphy.gif" alt="Alt Text" /></p>

<hr />

<h2 id="alpha-α-and-p-value">Alpha (α) and p-value</h2>

<p>From here on, our hypothesis test depends on two crucial values: <strong>alpha (α)</strong> and <strong>the p-value</strong>.</p>

<ul>
  <li>
    <p><strong>Alpha (α):</strong> our threshold, the bar we measure against. It’s a value set before the test (usually 0.05, or 5%).</p>

    <ul>
      <li>It represents the <strong>significance level</strong>, that is, the maximum probability of making a <strong>Type I Error</strong> (rejecting H₀ by mistake, a “false positive”).</li>
      <li>Example: setting α = 0.05 means accepting a 5% chance of making that error.</li>
    </ul>
  </li>
  <li>
    <p><strong>p-value:</strong> it’s calculated from our data and works as a <strong>surprise index</strong>. It ranges from 0 to 1 and tells us how likely it would be to get these results if <strong>H₀</strong> were true.</p>

    <ul>
      <li><strong>Low p-value (e.g., 0.01):</strong> a very surprising result! Maybe our suspicion (Hₐ) is right.</li>
      <li><strong>High p-value (e.g., 0.70):</strong> nothing surprising; it could happen by chance, even if nothing had changed.</li>
    </ul>
  </li>
</ul>

<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3bWZsZmw3aWFiMXd4ODd5aGZpaWR1ZnF5dm10cmh6c2pkdzJiZXJxcyZlcD12MV9naWZzX3NlYXJjaCZjdD1n/rrDuikSJh7Xi0/giphy.gif" alt="Alt Text" /></p>

<hr />

<h2 id="making-the-decision">Making the decision</h2>

<p>The conclusion comes from comparing the p-value with α:</p>

<ul>
  <li>
    <p>If <strong>p-value ≤ α</strong>: we reject <strong>H₀</strong>.
There is statistical evidence to support our suspicion.
→ In our example, we’d say yes, the movie’s release seems to be related to the increase in rollover accidents.</p>
  </li>
  <li>
    <p>If <strong>p-value &gt; α</strong>: we fail to reject <strong>H₀</strong>.
We didn’t find enough evidence to claim that the movie caused an increase.
→ We conclude there was no statistically significant change.</p>
  </li>
</ul>

<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3bmU3OHZqNWdua3lyNmk0Zm92cDF5eHdqbm1ucHh6NDFlaWFtOWUybSZlcD12MV9naWZzX3JlbGF0ZWQmY3Q9Zw/8QC4kjqN9qDEk/giphy.gif" alt="Alt Text" /></p>

<hr />

<h2 id="testing-it-in-practice-with-python">Testing it in practice with Python</h2>

<p>If you wanted to run this analysis in <strong>Python</strong>, you’d probably use the <strong>scipy</strong> library. To compare the accidents “before” and “after”, the ideal test would be the <strong>Independent Samples T-Test</strong>:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">scipy</span> <span class="kn">import</span> <span class="n">stats</span>

<span class="c1"># Assuming 'before' and 'after' are lists with the number of accidents
</span><span class="n">stats</span><span class="p">.</span><span class="n">ttest_ind</span><span class="p">(</span><span class="n">after</span><span class="p">,</span> <span class="n">before</span><span class="p">,</span> <span class="n">alternative</span><span class="o">=</span><span class="s">'greater'</span><span class="p">)</span>
</code></pre></div></div>

<p>The <code class="language-plaintext highlighter-rouge">alternative='greater'</code> parameter specifies that we’re running a <strong>one-tailed test</strong>, exactly like our original question!</p>

<hr />

<p>So, had you ever thought about statistical tests this way?</p>

<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3YTM4NWQzcnlvMmRqZTIwc2lmOTFrbzRpbDFxNWRjZmR1ZXY3MWx6ayZlcD12MV9naWZzX3JlbGF0ZWQmY3Q9Zw/mRpYh11bLKZlm/giphy.gif" alt="Alt Text" /></p>]]></content><author><name></name></author><category term="estatistica" /><category term="ensino" /><category term="python" /><summary type="html"><![CDATA[]]></summary></entry><entry xml:lang="pt"><title type="html">Teste de Hipótese no estilo Desafio em Tóquio</title><link href="https://sthemonica.github.io/pt/artigos/2025/drift-pt/" rel="alternate" type="text/html" title="Teste de Hipótese no estilo Desafio em Tóquio" /><published>2025-09-30T00:00:00+02:00</published><updated>2025-09-30T00:00:00+02:00</updated><id>https://sthemonica.github.io/pt/artigos/2025/drift-pt</id><content type="html" xml:base="https://sthemonica.github.io/pt/artigos/2025/drift-pt/"><![CDATA[<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3MzVkNzdpZ3hyc3NjaGNkNTJrZXppbmhpbzdhbndsanBvZmNpNzE1diZlcD12MV9naWZzX3NlYXJjaCZjdD1n/77r1et1tb9IUczHS4j/giphy.gif" alt="Alt Text" /></p>

<p>Foi essa pergunta que me fiz neste final de semana, após assistir a <em>“Velozes e Furiosos: Desafio em Tóquio”</em> pela primeira vez: como usar a ousadia dos drifts para explicar um belo Teste de Hipótese para meus alunos? Afinal, como transformar um conceito estatístico, essencial na área de dados, em algo que não seja confuso ao primeiro olhar?</p>

<p>A resposta veio na aula de hoje. No final, para cativar a galera, usei um exemplo que fez todo mundo rir, e resolvi compartilhar aqui.</p>

<hr />

<h2 id="o-ponto-de-partida">O ponto de partida</h2>

<p>Enquanto assistia ao filme PELA PRIMEIRA VEZ, duas perguntas surgiram:</p>

<ul>
  <li><em>“Será que eu consigo fazer drift com meu golzinho?”</em></li>
  <li><em>“Será que o número de capotamentos de carro aumentou depois do lançamento do filme?”</em></li>
</ul>

<p>A primeira pergunta deixaremos de lado (pela segurança do golzinho), mas a segunda é um ponto de partida perfeito para um teste de hipótese.</p>

<p><img src="https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExODYyNXVlOTVqYmZiYjBndDVwcHIzeWx1ZWpuOXJzMzA2Y2s2dnN3NCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/S6yhb6s2dKlfZMwop6/giphy.gif" alt="Alt Text" /></p>

<p>Tudo começa com uma pergunta. No nosso caso:
<strong>“O número médio de capotamentos aumentou após o lançamento do filme?”</strong></p>

<hr />

<h2 id="definindo-as-hipóteses">Definindo as hipóteses</h2>

<p>Com a pergunta definida, criamos nossas hipóteses. Eu gosto de começar pela <strong>Hipótese Alternativa (Hₐ)</strong> e depois ir para a <strong>Hipótese Nula (H₀)</strong>, então vamos seguir essa ordem por aqui. A Hₐ é basicamente a nossa suspeita, aquilo que queremos investigar.</p>

<ul>
  <li><strong>Hipótese Alternativa (Hₐ):</strong> O número médio de capotamentos aumentou após o lançamento do filme.</li>
</ul>

<p>A H₀ é sempre o antagonista da nossa Hₐ, ou seja, vamos fazer ela ao contrário da alternativa (também podemos pensar nela sendo a nossa normalidade :D)</p>

<ul>
  <li><strong>Hipótese Nula (H₀):</strong> O número médio de capotamentos permaneceu o mesmo ou diminuiu após o lançamento do filme.</li>
</ul>

<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3Zm93bnlkcTFlM2YyeGY0bDk2bnNqc3h1azg0eHBoNmFhNmVxd2UzZyZlcD12MV9naWZzX3JlbGF0ZWQmY3Q9Zw/TFcwaBxd3lCQE/giphy.gif" alt="Alt Text" /></p>

<hr />

<h2 id="alpha-α-e-p-valor">Alpha (α) e p-valor</h2>

<p>A partir daqui, nosso teste de hipótese depende de dois valores cruciais: <strong>o alpha (α)</strong> e <strong>o p-value</strong>.</p>

<ul>
  <li>
    <p><strong>Alpha (α):</strong> nosso limite, a régua de aceitação. É um valor definido antes do teste (geralmente 0.05 ou 5%).</p>

    <ul>
      <li>Ele representa o <strong>nível de significância</strong>, ou seja, a probabilidade máxima de cometer um <strong>Erro Tipo I</strong> (rejeitar a H₀ por engano, um “falso positivo”).</li>
      <li>Exemplo: definir α = 0.05 significa aceitar uma chance de 5% de cometer esse erro.</li>
    </ul>
  </li>
  <li>
    <p><strong>p-value:</strong> é calculado a partir dos nossos dados e funciona como um <strong>índice de surpresa</strong>. Varia de 0 a 1 e indica quão provável seria obter os resultados se a <strong>H₀</strong> fosse verdadeira.</p>

    <ul>
      <li><strong>p-value baixo (ex: 0.01):</strong> resultado muito surpreendente! Talvez a nossa suspeita (Hₐ) esteja correta.</li>
      <li><strong>p-value alto (ex: 0.70):</strong> nada surpreendente, poderia acontecer por acaso, mesmo que nada tenha mudado.</li>
    </ul>
  </li>
</ul>

<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3bWZsZmw3aWFiMXd4ODd5aGZpaWR1ZnF5dm10cmh6c2pkdzJiZXJxcyZlcD12MV9naWZzX3NlYXJjaCZjdD1n/rrDuikSJh7Xi0/giphy.gif" alt="Alt Text" /></p>

<hr />

<h2 id="tomando-a-decisão">Tomando a decisão</h2>

<p>A conclusão vem da comparação entre p-value e α:</p>

<ul>
  <li>
    <p>Se <strong>p-value ≤ α</strong>: rejeitamos a <strong>H₀</strong>.
Há evidência estatística para apoiar nossa suspeita.
→ No exemplo, diríamos que sim, o lançamento do filme parece ter relação com o aumento de acidentes por capotamento.</p>
  </li>
  <li>
    <p>Se <strong>p-value &gt; α</strong>: falhamos em rejeitar a <strong>H₀</strong>.
Não encontramos evidências suficientes para afirmar que o filme causou um aumento.
→ Concluímos que não houve mudança estatisticamente significativa.</p>
  </li>
</ul>

<h2><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3bmU3OHZqNWdua3lyNmk0Zm92cDF5eHdqbm1ucHh6NDFlaWFtOWUybSZlcD12MV9naWZzX3JlbGF0ZWQmY3Q9Zw/8QC4kjqN9qDEk/giphy.gif" alt="Alt Text" /></h2>

<h2 id="testando-na-prática-com-python">Testando na prática com Python</h2>

<p>Se você quiser rodar essa análise no <strong>Python</strong>, usaria provavelmente a biblioteca <strong>scipy</strong>. Para comparar os acidentes “antes” e “depois”, o teste ideal seria o <strong>Teste T de Amostras Independentes</strong>:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">scipy</span> <span class="kn">import</span> <span class="n">stats</span>

<span class="c1"># Supondo que 'antes' e 'depois' são listas com o número de acidentes
</span><span class="n">stats</span><span class="p">.</span><span class="n">ttest_ind</span><span class="p">(</span><span class="n">depois</span><span class="p">,</span> <span class="n">antes</span><span class="p">,</span> <span class="n">alternative</span><span class="o">=</span><span class="s">'greater'</span><span class="p">)</span>
</code></pre></div></div>

<p>O parâmetro <code class="language-plaintext highlighter-rouge">alternative='greater'</code> especifica que estamos fazendo um <strong>teste unilateral</strong>, exatamente como em nossa pergunta original!</p>

<hr />

<p>E aí, você já tinha pensado em testes estatísticos dessa forma?</p>

<p><img src="https://media.giphy.com/media/v1.Y2lkPWVjZjA1ZTQ3YTM4NWQzcnlvMmRqZTIwc2lmOTFrbzRpbDFxNWRjZmR1ZXY3MWx6ayZlcD12MV9naWZzX3JlbGF0ZWQmY3Q9Zw/mRpYh11bLKZlm/giphy.gif" alt="Alt Text" /></p>]]></content><author><name></name></author><category term="estatistica" /><category term="ensino" /><category term="python" /><summary type="html"><![CDATA[]]></summary></entry></feed>