{"id":3471,"date":"2026-03-01T20:31:39","date_gmt":"2026-03-01T19:31:39","guid":{"rendered":"https:\/\/www.gironi.it\/blog\/?p=3471"},"modified":"2026-03-02T09:32:59","modified_gmt":"2026-03-02T08:32:59","slug":"the-t-distribution-and-hypothesis-testing","status":"publish","type":"post","link":"https:\/\/www.gironi.it\/blog\/en\/the-t-distribution-and-hypothesis-testing\/","title":{"rendered":"The t Distribution and Hypothesis Testing"},"content":{"rendered":"<p>In a <a href=\"https:\/\/www.gironi.it\/blog\/en\/hypothesis-testing-a-step-by-step-guide\/\">previous article<\/a> we presented the concept of hypothesis testing\u2014a statistical method widely used to determine the validity of a claim based on a sample of data.<\/p>\n<p>In the examples we proposed, however, we knew the value of the population standard deviation, <strong>sigma<\/strong>. In practice, this is a rather rare case, which allowed us to use the <strong>normal distribution<\/strong> and compute the <strong>Z-score<\/strong>.<\/p>\n<p>If instead we do not know the population sigma, or if <strong>we are working with small samples<\/strong>, we must turn to a different type of distribution, called the <strong>t distribution<\/strong> or <strong>Student&#8217;s distribution<\/strong>.<\/p>\n<p>Put more simply and clearly:<\/p>\n<p style=\"background-color:#f0f0f0;padding:1em;\"><strong>Student&#8217;s t distribution is a probability distribution used to assess the statistical significance of results when dealing with small sample sizes and uncertainty about the variance.<\/strong><\/p>\n<p><!--more--><\/p>\n<div style=\"border: 1px solid #ccc;padding: 1.2em 1.5em;margin: 1.5em 0;border-radius: 6px\">\n<h3 style=\"margin-top: 0\">What We&#8217;ll Cover<\/h3>\n<ul>\n<li><a href=\"#historical-digression\">A Brief Historical Digression<\/a><\/li>\n<li><a href=\"#example\">An Example Is Worth a Thousand Explanations<\/a><\/li>\n<li><a href=\"#p-value\">An Alternative to Critical Regions: Looking at the p-Value<\/a><\/li>\n<li><a href=\"#confidence-interval\">Estimate, Margin of Error, and Confidence Interval<\/a><\/li>\n<li><a href=\"#r-t-test\">The t-Test, p-Value, and Confidence Interval in R<\/a><\/li>\n<li><a href=\"#further-reading\">Further Reading<\/a><\/li>\n<\/ul>\n<\/div>\n<hr \/>\n<h2 id=\"historical-digression\">A Brief Historical Digression<\/h2>\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.gironi.it\/blog\/wp-content\/uploads\/2019\/11\/William_Sealy_Gosset.jpg\" alt=\"Photo of William Gosset - discoverer of the t distribution\" \/><figcaption>William Sealy Gosset (Student)<\/figcaption><\/figure>\n<p>In the early 1900s, the chemist and statistician William Sealy Gosset, employed at the Guinness brewery (and a collaborator of the statistical giant <a href=\"https:\/\/en.wikipedia.org\/wiki\/Karl_Pearson\" target=\"_blank\" rel=\"noreferrer noopener\">Karl Pearson<\/a>), discovered that when working with very small samples, the distributions of the mean differed significantly from the normal distribution.<\/p>\n<p>Even more interesting, as the sample size changed, the shape of the distribution changed too, and as the sample grew, the distribution gradually approximated the normal more and more closely.<\/p>\n<p>Unable to reveal his identity so as not to benefit competitors, he published his results under the pseudonym &#8220;Student&#8221;\u2014and this is why distributions for small samples are now known as &#8220;Student&#8217;s t distributions.&#8221; If you want to <a href=\"https:\/\/en.wikipedia.org\/wiki\/William_Sealy_Gosset\" target=\"_blank\" rel=\"noreferrer noopener\">read the full story<\/a>, Wikipedia is, as always, a good source.<\/p>\n<hr \/>\n<p>The t distribution is symmetric about zero, but it is &#8220;flatter&#8221; than the standardised normal distribution, so that a greater portion of its area lies in the tails.<\/p>\n<p><strong>A larger sample causes the t distribution to approximate the normal distribution ever more closely. The differences between the t distribution and the normal are greatest when we have fewer degrees of freedom.<\/strong><\/p>\n<figure><img decoding=\"async\" src=\"https:\/\/www.gironi.it\/blog\/wp-content\/uploads\/2019\/11\/distribuzionitcompara.png\" alt=\"Hypothesis testing - comparison of t distributions for various degrees of freedom\" \/><figcaption>The t distribution curves for various degrees of freedom, compared with the normal.<\/figcaption><\/figure>\n<p>But what do we mean by <strong>degrees of freedom<\/strong>? The number of sample values that have the &#8220;freedom&#8221; to change without altering the sample mean.<\/p>\n<p>If the concept is not immediately clear, we can still move on to practical usage, because the degrees of freedom\u2014fundamental to our calculation\u2014are simply equal to the sample size minus one:<\/p>\n<p style=\"background-color:#f0f0f0;padding:1em;\"><strong>df = n &#8211; 1<\/strong><\/p>\n<p>where df = <em>degrees of freedom<\/em><br \/>n = sample size<\/p>\n<p>The procedure for conducting a hypothesis test using the t distribution largely mirrors what we have already seen in the case of a known sigma and the use of the normal distribution.<\/p>\n<p><strong>We therefore state the null hypothesis, H<sub>0<\/sub>, and the alternative hypothesis, H<sub>a<\/sub>.<\/strong><\/p>\n<p>To compute the t-test statistic we use the formula:<\/p>\n\\(<br \/>\nt = \\frac{\\bar{x} &#8211; \\mu}{\\frac{s}{\\sqrt{n}}} \\\\<br \/>\n\\)\n<p>where \\(\\frac{s}{\\sqrt{n}}\\) is the estimated standard error, which we can also denote as SE.<\/p>\n<h2 id=\"example\">An Example Is Worth a Thousand Explanations<\/h2>\n<p>A light bulb manufacturer claims that its product has a mean lifespan of at least 4200 hours.<\/p>\n<p>A sample of n = 10 bulbs is taken, and the sample mean lifespan is found to be 4000 hours. The sample standard deviation is 200 hours.<\/p>\n<p>In summary:<\/p>\n\\(<br \/>\nn=10 \\\\<br \/>\n\\bar{x}=4000 \\\\<br \/>\ns=200 \\\\<br \/>\n\\)\n<p>We then set up our test conditions:<\/p>\n<p>H<sub>0<\/sub>: &mu; &ge; 4200<br \/>\nH<sub>a<\/sub>: &mu; &lt; 4200<\/p>\n<p>We choose a <strong>significance level of 95%<\/strong> (i.e. <strong>alpha = 0.05<\/strong>).<\/p>\n<p>In the table of critical values for the t distribution, we look up the value corresponding to 9 degrees of freedom (<em>the row<\/em>) and alpha 0.05 (<em>cross with the column<\/em>). <strong>This value turns out to be 1.833.<\/strong><\/p>\n<p><strong>We will reject the null hypothesis if the t value we calculate is less than -1.833.<\/strong><\/p>\n<p>The standard error is:<\/p>\n\\(<br \/>\n\\frac{s}{\\sqrt{n}}=\\frac{200}{\\sqrt{10}}=\\frac{200}{3.16}=63.3 \\\\<br \/>\n\\)\n<p>We compute t:<\/p>\n\\(<br \/>\nt=\\frac{\\bar{x} &#8211; \\mu}{SE}=\\frac{4000-4200}{63.3}=\\frac{-200}{63.3}=-3.16 \\\\<br \/>\n\\)\n<p>The <strong>t value falls in the critical region<\/strong>: <strong>we therefore reject the null hypothesis<\/strong> and accept, at a 95% significance level, that the mean bulb lifespan is less than the 4200 hours claimed by the manufacturer.<\/p>\n<h2 id=\"p-value\">An Alternative to Critical Regions: Looking at the p-Value<\/h2>\n<p>We can also evaluate a hypothesis by asking: &#8220;<em>What is the probability of obtaining the test statistic value we observed, if the null hypothesis is true?<\/em>&#8221; This probability is called the <strong>p-value<\/strong>.<\/p>\n<p>This is, in fact, the most convenient approach when we have tools such as a statistical calculator or R: the interpretation of the result is immediate.<\/p>\n<p>Using R or a calculator on our example, we obtain t = -3.16 and p = 0.00575.<\/p>\n<p>This means there is just a 0.575% probability that under the null hypothesis we would observe the result we found.<\/p>\n<p><strong>p is less than our chosen significance level<\/strong> alpha (p &lt; 0.05).<\/p>\n<p>Therefore, <strong>the null hypothesis is to be rejected<\/strong> in favour of the alternative hypothesis.<\/p>\n<h2 id=\"confidence-interval\">Estimate, Margin of Error, and Confidence Interval: Verifying the Hypothesis Test Result<\/h2>\n<p>When a hypothesis is rejected, it is certainly useful to produce an estimate to try to understand what the true mean value is. In our example, we rejected the manufacturer&#8217;s claim that their bulbs last on average more than 4200 hours. But then, how long do they actually last?<\/p>\n<p>To calculate the confidence interval, we need to know three things:<\/p>\n<ol>\n<li><strong>The sample mean<\/strong><\/li>\n<li><strong>The standard error<\/strong><\/li>\n<li><strong>The critical value<\/strong><\/li>\n<\/ol>\n<p>The formula for the confidence interval is:<\/p>\n\\(<br \/>\n\\bar{x} \\pm Margin\\ of\\ Error \\\\<br \/>\n\\)\n<p>and the Margin of Error is:<\/p>\n\\(<br \/>\nME = t_{critical} \\times SE \\\\<br \/>\n\\)\n<p>In our case: ME = 1.833 &times; 63.3 &approx; 116<\/p>\n<p>So we can say that our 95% confidence interval is between 3884 and 4116.<\/p>\n<p>As we can see, the value stated by the manufacturer, 4200 hours, falls\u2014as we expected\u2014outside the confidence interval.<\/p>\n<h2 id=\"r-t-test\">The t-Test, p-Value, and Confidence Interval in R<\/h2>\n<p>R is, as always, our best ally, allowing us to perform the test with utmost simplicity and providing all the information we need. We prepare a vector containing 10 measurements with a mean of 4000 and feed it to R&#8217;s <strong>t.test<\/strong> function, specifying that the null hypothesis mean (<strong>mu<\/strong>) is 4200, and that the alternative hypothesis is that the true value is lower\u2014<strong>alternative = &#8220;less&#8221;<\/strong>:<\/p>\n<pre><code class=\"language-r\">bulb_life <- c(4100, 3900, 3800, 4200, 4000,\n               4100, 3900, 3800, 4200, 4000)\nt.test(bulb_life, mu = 4200, alternative = \"less\")<\/code><\/pre>\n<p>R provides in its output all the information we need: the t statistic, the p-value, and the confidence interval.<\/p>\n<p>In general, Student's t distribution is a powerful and flexible tool that can be used to assess the statistical significance of results in many different contexts. With a thorough understanding of the t distribution and the use of software like R, it is possible to construct effective hypothesis tests and make informed decisions based on the data collected.<\/p>\n<p style=\"background-color:#f0f0f0;padding:1em;\"><em>Side note: if the sample is small (n &lt; 30) and the population is not approximately normally distributed, we can apply <a href=\"https:\/\/www.gironi.it\/blog\/en\/the-normal-distribution\/\">Chebyshev's Theorem<\/a>.<\/em><\/p>\n<h3>Useful Links for Further Study<\/h3>\n<ul>\n<li><a href=\"https:\/\/statisticsbyjim.com\/hypothesis-testing\/t-tests-t-values-t-distributions-probabilities\/\" target=\"_blank\" rel=\"noreferrer noopener\">How t-Tests Work: t-Values, t-Distributions, and Probabilities \u2014 <em>statisticsbyjim.com<\/em><\/a><\/li>\n<li><a href=\"https:\/\/sixsigmastudyguide.com\/one-sample-t-hypothesis-test\/\" target=\"_blank\" rel=\"noreferrer noopener\">One Sample T Hypothesis Test (Student's T Test) \u2014 <em>sixsigmastudyguide.com<\/em><\/a><\/li>\n<\/ul>\n<hr \/>\n<h3>You might also like<\/h3>\n<ul>\n<li><a href=\"https:\/\/www.gironi.it\/blog\/en\/hypothesis-testing-a-step-by-step-guide\/\">Hypothesis Testing: A Step-by-Step Guide<\/a><\/li>\n<li><a href=\"https:\/\/www.gironi.it\/blog\/en\/confidence-intervals-what-they-are-how-to-calculate-them-and-what-they-do-not-mean\/\">Confidence Intervals: What They Are, How to Calculate Them (and What They Do NOT Mean)<\/a><\/li>\n<li><a href=\"https:\/\/www.gironi.it\/blog\/en\/guide-to-statistical-tests-for-a-b-analysis\/\">Guide to Statistical Tests for A\/B Analysis<\/a><\/li>\n<\/ul>\n<hr \/>\n<h3 id=\"further-reading\">Further Reading<\/h3>\n<p>For a comprehensive treatment of the t distribution, hypothesis testing, and the full machinery of statistical inference, <a href=\"https:\/\/www.amazon.it\/dp\/8891910651?tag=consulenzeinf-21\" rel=\"nofollow sponsored noopener\" target=\"_blank\"><em>Statistica<\/em><\/a> by Newbold, Carlson and Thorne provides a rigorous yet accessible walkthrough of the theory and practice, from small-sample tests to confidence interval construction.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a previous article we presented the concept of hypothesis testing\u2014a statistical method widely used to determine the validity of a claim based on a sample of data. In the examples we proposed, however, we knew the value of the population standard deviation, sigma. In practice, this is a rather rare case, which allowed us &hellip; <a href=\"https:\/\/www.gironi.it\/blog\/en\/the-t-distribution-and-hypothesis-testing\/\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;The t Distribution and Hypothesis Testing&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[161],"tags":[],"class_list":["post-3471","post","type-post","status-publish","format-standard","hentry","category-statistics"],"lang":"en","translations":{"en":3471,"it":1131},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"autore-articoli","author_link":"https:\/\/www.gironi.it\/blog\/author\/autore-articoli\/"},"uagb_comment_info":1,"uagb_excerpt":"In a previous article we presented the concept of hypothesis testing\u2014a statistical method widely used to determine the validity of a claim based on a sample of data. In the examples we proposed, however, we knew the value of the population standard deviation, sigma. In practice, this is a rather rare case, which allowed us&hellip;","_links":{"self":[{"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/posts\/3471","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/comments?post=3471"}],"version-history":[{"count":1,"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/posts\/3471\/revisions"}],"predecessor-version":[{"id":3474,"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/posts\/3471\/revisions\/3474"}],"wp:attachment":[{"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/media?parent=3471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/categories?post=3471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gironi.it\/blog\/wp-json\/wp\/v2\/tags?post=3471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}