<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Confidence interval on Stats and R</title>
    <link>https://statsandr.com/tags/confidence-interval/</link>
    <description>Recent content in Confidence interval on Stats and R</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Wed, 27 Jan 2021 00:00:00 +0000</lastBuildDate>
    
	<atom:link href="https://statsandr.com/tags/confidence-interval/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Hypothesis test by hand</title>
      <link>https://statsandr.com/blog/hypothesis-test-by-hand/</link>
      <pubDate>Wed, 27 Jan 2021 00:00:00 +0000</pubDate>
      
      <guid>https://statsandr.com/blog/hypothesis-test-by-hand/</guid>
      <description>

&lt;div id=&#34;TOC&#34;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#descriptive-versus-inferential-statistics&#34; id=&#34;toc-descriptive-versus-inferential-statistics&#34;&gt;Descriptive versus inferential statistics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#motivations-and-limitations&#34; id=&#34;toc-motivations-and-limitations&#34;&gt;Motivations and limitations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#hypothesis-test&#34; id=&#34;toc-hypothesis-test&#34;&gt;Hypothesis test&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#why&#34; id=&#34;toc-why&#34;&gt;Why?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#when&#34; id=&#34;toc-when&#34;&gt;When?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#how&#34; id=&#34;toc-how&#34;&gt;How?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#method-a-comparing-the-test-statistic-with-the-critical-value&#34; id=&#34;toc-method-a-comparing-the-test-statistic-with-the-critical-value&#34;&gt;Method A: Comparing the test statistic with the critical value&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#step-1-stating-the-null-and-alternative-hypothesis&#34; id=&#34;toc-step-1-stating-the-null-and-alternative-hypothesis&#34;&gt;Step #1: Stating the null and alternative hypothesis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#step-2-computing-the-test-statistic&#34; id=&#34;toc-step-2-computing-the-test-statistic&#34;&gt;Step #2: Computing the test statistic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#step-3-finding-the-critical-value&#34; id=&#34;toc-step-3-finding-the-critical-value&#34;&gt;Step #3: Finding the critical value&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#step-4-concluding-and-interpreting-the-results&#34; id=&#34;toc-step-4-concluding-and-interpreting-the-results&#34;&gt;Step #4: Concluding and interpreting the results&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#why-dont-we-accept-h_0&#34; id=&#34;toc-why-dont-we-accept-h_0&#34;&gt;Why don’t we accept &lt;span class=&#34;math inline&#34;&gt;\(H_0\)&lt;/span&gt;?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#method-b-comparing-the-p-value-with-the-significance-level-alpha&#34; id=&#34;toc-method-b-comparing-the-p-value-with-the-significance-level-alpha&#34;&gt;Method B: Comparing the &lt;em&gt;p&lt;/em&gt;-value with the significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#step-1-stating-the-null-and-alternative-hypothesis-1&#34; id=&#34;toc-step-1-stating-the-null-and-alternative-hypothesis-1&#34;&gt;Step #1: Stating the null and alternative hypothesis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#step-2-computing-the-test-statistic-1&#34; id=&#34;toc-step-2-computing-the-test-statistic-1&#34;&gt;Step #2: Computing the test statistic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#step-3-computing-the-p-value&#34; id=&#34;toc-step-3-computing-the-p-value&#34;&gt;Step #3: Computing the &lt;em&gt;p&lt;/em&gt;-value&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#step-4-concluding-and-interpreting-the-results-1&#34; id=&#34;toc-step-4-concluding-and-interpreting-the-results-1&#34;&gt;Step #4: Concluding and interpreting the results&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#method-c-comparing-the-target-parameter-with-the-confidence-interval&#34; id=&#34;toc-method-c-comparing-the-target-parameter-with-the-confidence-interval&#34;&gt;Method C: Comparing the target parameter with the confidence interval&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#step-1-stating-the-null-and-alternative-hypothesis-2&#34; id=&#34;toc-step-1-stating-the-null-and-alternative-hypothesis-2&#34;&gt;Step #1: Stating the null and alternative hypothesis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#step-2-computing-the-confidence-interval&#34; id=&#34;toc-step-2-computing-the-confidence-interval&#34;&gt;Step #2: Computing the confidence interval&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#step-3-concluding-and-interpreting-the-results&#34; id=&#34;toc-step-3-concluding-and-interpreting-the-results&#34;&gt;Step #3: Concluding and interpreting the results&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#which-method-to-choose&#34; id=&#34;toc-which-method-to-choose&#34;&gt;Which method to choose?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#summary&#34; id=&#34;toc-summary&#34;&gt;Summary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src=&#34;https://statsandr.com/blog/2021-01-27-hypothesis-test-by-hand_files/hypothesis-test-by-hand.jpeg&#34; style=&#34;width:100.0%&#34; /&gt;&lt;/p&gt;
&lt;div id=&#34;descriptive-versus-inferential-statistics&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Descriptive versus inferential statistics&lt;/h1&gt;
&lt;p&gt;Remember that &lt;strong&gt;&lt;a href=&#34;https://statsandr.com/blog/descriptive-statistics-by-hand/&#34;&gt;descriptive statistics&lt;/a&gt;&lt;/strong&gt; is the branch of statistics aiming at &lt;strong&gt;describing and summarizing a set of data&lt;/strong&gt; in the best possible manner, that is, by reducing it down to a few meaningful key measures and visualizations—with as little loss of information as possible. In other words, the branch of &lt;a href=&#34;https://statsandr.com/blog/descriptive-statistics-by-hand/&#34;&gt;descriptive statistics&lt;/a&gt; helps to have a better understanding and a clear image about a set of observations thanks to summary statistics and graphics. With descriptive statistics, there is no uncertainty because we describe only the group of observations that we decided to work on and no attempt is made to generalize the observed characteristics to another or to a larger group of observations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;https://statsandr.com/tags/inferential-statistics/&#34;&gt;Inferential statistics&lt;/a&gt;&lt;/strong&gt;, one the other hand, is the branch of statistics that uses a random sample of data taken from a population to make inferences, i.e., to &lt;strong&gt;draw conclusions about the &lt;em&gt;population&lt;/em&gt; of interest&lt;/strong&gt; (see the &lt;a href=&#34;https://statsandr.com/blog/what-is-the-difference-between-population-and-sample/&#34;&gt;difference between population and sample&lt;/a&gt; if you need a refresh of the two concepts). In other words, information from the sample is used to make generalizations about the parameter of interest in the population.&lt;/p&gt;
&lt;p&gt;The two most important tools used in the domain of inferential statistics are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;hypothesis test (which is the main subject of the present article), and&lt;/li&gt;
&lt;li&gt;confidence interval (which is briefly discussed in this &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#method-c-comparing-the-target-parameter-with-the-confidence-interval&#34;&gt;section&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;motivations-and-limitations&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Motivations and limitations&lt;/h1&gt;
&lt;p&gt;Via my &lt;a href=&#34;https://www.antoinesoetewey.com/teaching/&#34; target=&#34;_blank&#34;&gt;teaching&lt;/a&gt; tasks, I realized that many students (especially in introductory statistic classes) struggle to perform hypothesis tests and interpret the results. It seems to me that these students often encounter difficulties mainly because hypothesis testing is rather unclear and abstract to them.&lt;/p&gt;
&lt;p&gt;One of the reason it looks abstract to them is because they do not understand the final goal of hypothesis testing—the “why” behind this tool. They often do inferential statistics without understanding the reasoning behind it, as if they were following a cooking recipe which does not require any thinking. However, as soon as they understand the principle underlying hypothesis testing, it is much easier for them to apply the concepts and solve the exercises.&lt;/p&gt;
&lt;p&gt;For this reason, I though it would be useful to write an article on the goal of hypothesis tests (the “why?”), in which context they should be used (the “when?”), how they work (the “how?”) and how to interpret the results (the “so what?”). Like anything else in statistics, it becomes much easier to apply a concept in practice when we understand what we are testing or what we are trying to demonstrate beforehand.&lt;/p&gt;
&lt;p&gt;In this article, I present—as comprehensibly as possible—the different &lt;strong&gt;steps required to perform and conclude a hypothesis test by hand&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;These steps are illustrated with a basic example. This will build the theoretical foundations of hypothesis testing, which will in turn be of great help for the understanding of most &lt;a href=&#34;https://statsandr.com/blog/what-statistical-test-should-i-do/&#34;&gt;statistical tests&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Hypothesis tests come in many forms and can be used for many parameters or research questions. The steps I present in this article are not applicable to &lt;em&gt;all&lt;/em&gt; hypothesis test, unfortunately.&lt;/p&gt;
&lt;p&gt;They are however, appropriate for &lt;em&gt;at least&lt;/em&gt; the most common hypothesis tests—the tests on:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;One mean: &lt;span class=&#34;math inline&#34;&gt;\(\mu\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Two means:
&lt;ul&gt;
&lt;li&gt;independent samples: &lt;span class=&#34;math inline&#34;&gt;\(\mu_1\)&lt;/span&gt; and &lt;span class=&#34;math inline&#34;&gt;\(\mu_2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;paired samples: &lt;span class=&#34;math inline&#34;&gt;\(\mu_D\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;One proportion: &lt;span class=&#34;math inline&#34;&gt;\(p\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Two proportions: &lt;span class=&#34;math inline&#34;&gt;\(p_1\)&lt;/span&gt; and &lt;span class=&#34;math inline&#34;&gt;\(p_2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;One variance: &lt;span class=&#34;math inline&#34;&gt;\(\sigma^2\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Two variances: &lt;span class=&#34;math inline&#34;&gt;\(\sigma^2_1\)&lt;/span&gt; and &lt;span class=&#34;math inline&#34;&gt;\(\sigma^2_2\)&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The good news is that the principles behind these 6 statistical tests (and many more) are exactly the same. So if you understand the intuition and the process for one of them, all others pretty much follow.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;hypothesis-test&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Hypothesis test&lt;/h1&gt;
&lt;div id=&#34;why&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Why?&lt;/h2&gt;
&lt;p&gt;Unlike &lt;a href=&#34;https://statsandr.com/blog/descriptive-statistics-in-r/&#34;&gt;descriptive statistics&lt;/a&gt; where we only describe the data at hand, &lt;strong&gt;hypothesis tests use a subset of observations&lt;/strong&gt;, referred as a &lt;a href=&#34;https://statsandr.com/blog/what-is-the-difference-between-population-and-sample/&#34;&gt;sample&lt;/a&gt;, &lt;strong&gt;to draw conclusions about a population&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;One may wonder why we would try to “guess” or make inference about a parameter of a population based on a sample, instead of simply collecting data for the entire population, compute statistics we are interested in and take decisions based upon that.&lt;/p&gt;
&lt;p&gt;The main reason we actually use a sample instead of the entire population is because, most of the time, collecting data on the entire population is practically impossible, too complex, too expensive, it would take too long, or a combination of any of these.&lt;a href=&#34;#fn1&#34; class=&#34;footnote-ref&#34; id=&#34;fnref1&#34;&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So the &lt;strong&gt;overall objective of a hypothesis test is to draw conclusions in order to confirm or refute a belief about a population&lt;/strong&gt;, based on a smaller group of observations.&lt;/p&gt;
&lt;p&gt;In practice, we take some measurements of the variable of interest—representing the sample(s)—and we check whether our measurements are likely or not given our assumption (our belief). Based on the &lt;a href=&#34;https://statsandr.com/blog/the-9-concepts-and-formulas-in-probability-that-every-data-scientist-should-know/&#34;&gt;probability&lt;/a&gt; of observing the sample(s) we have, we decide whether we can trust our belief or not.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;when&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;When?&lt;/h2&gt;
&lt;p&gt;Hypothesis tests have many practical applications.&lt;/p&gt;
&lt;p&gt;Here are different situations illustrating when the 6 tests mentioned above would be appropriate:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;One mean: suppose that a health professional would like to test whether the mean weight of Belgian adults is different than 80 kg (176.4 lbs).&lt;/li&gt;
&lt;li&gt;Two means:
&lt;ul&gt;
&lt;li&gt;Independent samples: suppose that a physiotherapist would like to test the effectiveness of a new treatment by measuring the mean response time (in seconds) for patients in a control group and patients in a treatment group, where patients in the two groups are different.&lt;/li&gt;
&lt;li&gt;Paired samples: suppose that a physiotherapist would like to test the effectiveness of a new treatment by measuring the mean response time (in seconds) before and after a treatment, where patients are measured twice—before and after treatment, so patients are the same in the 2 samples.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;One proportion: suppose that a political pundit would like to test whether the proportion of citizens who are going to vote for a specific candidate is smaller than 30%.&lt;/li&gt;
&lt;li&gt;Two proportions: suppose that a doctor would like to test whether the proportion of smokers is different between professional and amateur athletes.&lt;/li&gt;
&lt;li&gt;One variance: suppose that an engineer would like to test whether a voltmeter has a lower variability than what is imposed by the safety standards.&lt;/li&gt;
&lt;li&gt;Two variances: suppose that, in a factory, two production lines work independently from each other. The financial manager would like to test whether the costs of the weekly maintenance of these two machines have the same variance. Note that a test on two variances is also often performed to verify the assumption of equal variances, which is required for several other statistical tests, such as the &lt;a href=&#34;https://statsandr.com/blog/student-s-t-test-in-r-and-by-hand-how-to-compare-two-groups-under-different-scenarios/&#34;&gt;Student’s t-test&lt;/a&gt; for instance.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Of course, this is a non-exhaustive list of potential applications and many research questions can be answered thanks to a hypothesis test.&lt;/p&gt;
&lt;p&gt;One important point to remember is that in hypothesis testing we are always interested in the population and not in the sample. The sample is used for the aim of drawing conclusions about the population, so we always test in terms of the population.&lt;/p&gt;
&lt;p&gt;Usually, &lt;strong&gt;hypothesis tests are used to answer research questions in confirmatory analyses&lt;/strong&gt;. Confirmatory analyses refer to statistical analyses where hypotheses—deducted from theory—are defined beforehand (preferably before data collection). In this approach, the researcher has a specific idea about the variables under consideration and she is trying to see if her idea, specified as hypotheses, is supported by data.&lt;/p&gt;
&lt;p&gt;On the other hand, hypothesis tests are rarely used in exploratory analyses.&lt;a href=&#34;#fn2&#34; class=&#34;footnote-ref&#34; id=&#34;fnref2&#34;&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt; Exploratory analyses aims to uncover possible relationships between the variables under investigation. In this approach, the researcher does not have any clear theory-driven assumptions or ideas in mind before data collection. This is the reason exploratory analyses are sometimes referred as hypothesis-generating analyses—they are used to create some hypotheses, which in turn may be tested via confirmatory analyses at a later stage.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;how&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;How?&lt;/h2&gt;
&lt;p&gt;There are, to my knowledge, 3 different methods to perform a hypothesis tests:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#method-a-comparing-the-test-statistic-with-the-critical-value&#34;&gt;Method A: Comparing the test statistic with the &lt;strong&gt;critical value&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#method-b-comparing-the-p-value-with-the-significance-level-alpha&#34;&gt;Method B: Comparing the &lt;strong&gt;&lt;em&gt;p&lt;/em&gt;-value&lt;/strong&gt; with the significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#method-c-comparing-the-target-parameter-with-the-confidence-interval&#34;&gt;Method C: Comparing the target parameter with the &lt;strong&gt;confidence interval&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Although the process for these 3 approaches may slightly differ, they all lead to the exact same conclusions. Using one method or another is, therefore, more often than not a matter of personal choice or a matter of context. See this &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#which-method-to-choose&#34;&gt;section&lt;/a&gt; to know which method I use depending on the context.&lt;/p&gt;
&lt;p&gt;I present the 3 methods in the following sections, starting with, in my opinion, the most comprehensive one when it comes to doing it by hand: comparing the test statistic with the critical value.&lt;/p&gt;
&lt;p&gt;For the three methods, I will explain the required steps to perform a hypothesis test from a general point of view and illustrate them with the following situation:&lt;a href=&#34;#fn3&#34; class=&#34;footnote-ref&#34; id=&#34;fnref3&#34;&gt;&lt;sup&gt;3&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Suppose a health professional who would like to test whether the mean weight of Belgian adults is different than 80 kg.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note that, as for most hypothesis tests, the test we are going to use as example below requires some assumptions. Since the aim of the present article is to explain a hypothesis test, we assume that all assumptions are met. For the interested reader, see the assumptions (and how to verify them) for this type of hypothesis test in the article presenting the &lt;a href=&#34;https://statsandr.com/blog/how-to-perform-a-one-sample-t-test-by-hand-and-in-r-test-on-one-mean/#assumptions&#34;&gt;one-sample t-test&lt;/a&gt;.&lt;/p&gt;
&lt;div id=&#34;method-a-comparing-the-test-statistic-with-the-critical-value&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Method A: Comparing the test statistic with the critical value&lt;/h3&gt;
&lt;p&gt;Method A, which consists in comparing the test statistic with the critical value, boils down to the following 4 steps:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;Stating the &lt;strong&gt;null and alternative hypothesis&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Computing the &lt;strong&gt;test statistic&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Finding the &lt;strong&gt;critical value&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concluding&lt;/strong&gt; and interpreting the results&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Each step is detailed below.&lt;/p&gt;
&lt;div id=&#34;step-1-stating-the-null-and-alternative-hypothesis&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #1: Stating the null and alternative hypothesis&lt;/h4&gt;
&lt;p&gt;As discussed before, a hypothesis test first requires an idea, that is, an assumption about a phenomenon. This assumption, referred as hypothesis, is derived from the theory and/or the research question.&lt;/p&gt;
&lt;p&gt;Since a hypothesis test is used to confirm or refute a prior belief, we need to &lt;strong&gt;formulate our belief so that there is a null and an alternative hypothesis&lt;/strong&gt;. Those hypotheses must be &lt;a href=&#34;https://statsandr.com/blog/the-9-concepts-and-formulas-in-probability-that-every-data-scientist-should-know/#union-of-two-events&#34;&gt;mutually exclusive&lt;/a&gt;, which means that they cannot be true at the same time. This is step #1.&lt;/p&gt;
&lt;p&gt;In the context of our scenario, the null and alternative hypothesis are thus:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Null hypothesis &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu = 80\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Alternative hypothesis &lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu \ne 80\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When stating the null and alternative hypothesis, bear in mind the following three points:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;&lt;em&gt;We are always interested in the population and not in the sample.&lt;/em&gt; This is the reason &lt;span class=&#34;math inline&#34;&gt;\(H_0\)&lt;/span&gt; and &lt;span class=&#34;math inline&#34;&gt;\(H_1\)&lt;/span&gt; will always be written in terms of the population and not in terms of the sample (in this case, &lt;span class=&#34;math inline&#34;&gt;\(\mu\)&lt;/span&gt; and not &lt;span class=&#34;math inline&#34;&gt;\(\bar{x}\)&lt;/span&gt;).&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The assumption we would like to test is often the alternative hypothesis.&lt;/em&gt; If the researcher wanted to test whether the mean weight of Belgian adults was less than 80 kg, she would have stated &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu = 80\)&lt;/span&gt; (or equivalently, &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu \ge 80\)&lt;/span&gt;) and &lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu &amp;lt; 80\)&lt;/span&gt;.&lt;a href=&#34;#fn4&#34; class=&#34;footnote-ref&#34; id=&#34;fnref4&#34;&gt;&lt;sup&gt;4&lt;/sup&gt;&lt;/a&gt; Do not mix the null with the alternative hypothesis, or the conclusions will be diametrically opposed!&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The null hypothesis is often the status quo.&lt;/em&gt; For instance, suppose that a doctor wants to test whether the new treatment A is more efficient than the old treatment B. The status quo is that the new and old treatments are equally efficient. Assuming a larger value is better, she will then write &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu_A = \mu_B\)&lt;/span&gt; (or equivalently, &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu_A - \mu_B = 0\)&lt;/span&gt;) and &lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu_A &amp;gt; \mu_B\)&lt;/span&gt; (or equivalently, &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu_A - \mu_B &amp;gt; 0\)&lt;/span&gt;). On the opposite, if the lower the better, she would have written &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu_A = \mu_B\)&lt;/span&gt; (or equivalently, &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu_A - \mu_B = 0\)&lt;/span&gt;) and &lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu_A &amp;lt; \mu_B\)&lt;/span&gt; (or equivalently, &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu_A - \mu_B &amp;lt; 0\)&lt;/span&gt;).&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div id=&#34;step-2-computing-the-test-statistic&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #2: Computing the test statistic&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;test statistic&lt;/strong&gt; (often called &lt;strong&gt;t-stat&lt;/strong&gt;) is, in some sense, a metric indicating &lt;strong&gt;how extreme the observations are compared to the null hypothesis&lt;/strong&gt;. The higher the t-stat (in absolute value), the more extreme the observations are.&lt;/p&gt;
&lt;p&gt;There are several formulas to compute the t-stat, with one formula for each type of hypothesis test—one or two means, one or two proportions, one or two variances. This means that there is a formula to compute the t-stat for a hypothesis test on one mean, another formula for a test on two means, another for a test on one proportion, etc.&lt;a href=&#34;#fn5&#34; class=&#34;footnote-ref&#34; id=&#34;fnref5&#34;&gt;&lt;sup&gt;5&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The only difficulty in this second step is to choose the appropriate formula. As soon as you know which formula to use based on the type of test, you simply have to apply it to the data. For the interested reader, see the different formulas to compute the t-stat for the most common tests in this &lt;a href=&#34;https://antoinesoetewey.shinyapps.io/statistics-201/&#34; target=&#34;_blank&#34;&gt;Shiny app&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Luckily, formulas for hypothesis tests on one and two means, and one and two proportions follow the same structure.&lt;/p&gt;
&lt;p&gt;Computing the test statistic for these tests is similar than &lt;a href=&#34;https://statsandr.com/blog/do-my-data-follow-a-normal-distribution-a-note-on-the-most-widely-used-distribution-and-how-to-test-for-normality-in-r/#probabilities-and-standard-normal-distribution&#34;&gt;scaling&lt;/a&gt; a random variable (a process also knows as “standardization” or “normalization”) which consists in subtracting the mean from that random variable, and dividing the result by the standard deviation:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[Z = \frac{X - \mu}{\sigma}\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For these 4 hypothesis tests (one/two means and one/two proportions), computing the test statistic is like scaling the estimator (computed from the sample) corresponding to the parameter of interest (in the population). So we basically subtract the target parameter from the point estimator and then divide the result by the standard error (which is equivalent to the standard deviation but for an estimator).&lt;/p&gt;
&lt;p&gt;If this is unclear, here is how the test statistic (denoted &lt;span class=&#34;math inline&#34;&gt;\(t_{obs}\)&lt;/span&gt;) is computed in our scenario (assuming that the variance of the population is unknown):&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[t_{obs} = \frac{\bar{x} - \mu}{\frac{s}{\sqrt{n}}}\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&#34;math inline&#34;&gt;\(\bar{x}\)&lt;/span&gt; is the sample mean (i.e., the estimator)&lt;/li&gt;
&lt;li&gt;&lt;span class=&#34;math inline&#34;&gt;\(\mu\)&lt;/span&gt; is the mean under the null hypothesis (i.e., the target parameter)&lt;/li&gt;
&lt;li&gt;&lt;span class=&#34;math inline&#34;&gt;\(s\)&lt;/span&gt; is the sample standard deviation&lt;/li&gt;
&lt;li&gt;&lt;span class=&#34;math inline&#34;&gt;\(n\)&lt;/span&gt; is the sample size&lt;/li&gt;
&lt;li&gt;(&lt;span class=&#34;math inline&#34;&gt;\(\frac{s}{\sqrt{n}}\)&lt;/span&gt; is the standard error)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Notice the similarity between the formula of this test statistic and the formula used to standardize a random variable. This structure is the same for a test on two means, one proportion and two proportions, except that the estimator, the parameter and the standard error are, of course, slightly different for each type of test.&lt;/p&gt;
&lt;p&gt;Suppose that in our case we have a sample mean of 71 kg (&lt;span class=&#34;math inline&#34;&gt;\(\bar{x}\)&lt;/span&gt; = 71), a sample standard deviation of 13 kg (&lt;span class=&#34;math inline&#34;&gt;\(s\)&lt;/span&gt; = 13) and a sample size of 10 adults (&lt;span class=&#34;math inline&#34;&gt;\(n\)&lt;/span&gt; = 10). Remember that the population mean (the mean under the null hypothesis) is 80 kg (&lt;span class=&#34;math inline&#34;&gt;\(\mu\)&lt;/span&gt; = 80).&lt;/p&gt;
&lt;p&gt;The t-stat is thus:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[t_{obs} = \frac{\bar{x} - \mu}{\frac{s}{\sqrt{n}}} = \frac{71 - 80}{\frac{13}{\sqrt{10}}} = -2.189\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Although formulas are different depending on which parameter you are testing, the value found for the test statistic gives us an indication on how extreme our observations are.&lt;/p&gt;
&lt;p&gt;We keep this value of -2.189 in mind because it will be used again in step #4.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;step-3-finding-the-critical-value&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #3: Finding the critical value&lt;/h4&gt;
&lt;p&gt;Although the t-stat gives us an indication of how extreme our observations are, we cannot tell whether this “score of extremity” is &lt;em&gt;too&lt;/em&gt; extreme or not based on its value only.&lt;/p&gt;
&lt;p&gt;So, at this point, we cannot yet tell whether our data are too extreme or not. For this, we need to compare our t-stat with a threshold—referred as &lt;strong&gt;critical value&lt;/strong&gt;—given by the &lt;a href=&#34;https://statsandr.com/blog/a-guide-on-how-to-read-statistical-tables/&#34;&gt;probability distribution&lt;/a&gt; tables (and which can, of course, also be found with R).&lt;/p&gt;
&lt;p&gt;In the same way that the formula to compute the t-stat is different for each parameter of interest, the underlying probability distribution—and thus the statistical table—on which the critical value is based is also different for each target parameter. This means that, in addition to choosing the appropriate formula to compute the t-stat, we also need to select the appropriate probability distribution depending on the parameter we are testing.&lt;/p&gt;
&lt;p&gt;Luckily, there are only 4 different probability distributions for the 6 hypothesis tests covered in this article (one/two means, one/two proportions and one/two variances):&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;&lt;a href=&#34;https://statsandr.com/blog/do-my-data-follow-a-normal-distribution-a-note-on-the-most-widely-used-distribution-and-how-to-test-for-normality-in-r/#probabilities-and-standard-normal-distribution&#34;&gt;Standard Normal distribution&lt;/a&gt;:
&lt;ul&gt;
&lt;li&gt;test on one and two means with known population variance(s)&lt;/li&gt;
&lt;li&gt;test on two paired samples where the variance of the difference between the 2 samples &lt;span class=&#34;math inline&#34;&gt;\(\sigma^2_D\)&lt;/span&gt; is known&lt;/li&gt;
&lt;li&gt;test on one and two proportions (given that some assumptions are met)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Student distribution:
&lt;ul&gt;
&lt;li&gt;test on one and two means with &lt;em&gt;un&lt;/em&gt;known population variance(s)&lt;/li&gt;
&lt;li&gt;test on two paired samples where the variance of the difference between the 2 samples &lt;span class=&#34;math inline&#34;&gt;\(\sigma^2_D\)&lt;/span&gt; is &lt;em&gt;un&lt;/em&gt;known&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Chi-square distribution:
&lt;ul&gt;
&lt;li&gt;test on one variance&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Fisher distribution:
&lt;ul&gt;
&lt;li&gt;test on two variances&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Each probability distribution also has its own parameters (up to two parameters for the 4 distribution considered here), defining its shape and/or location. Parameter(s) of a probability distribution can be seen as its DNA; meaning that the distribution is entirely defined by its parameter(s).&lt;/p&gt;
&lt;p&gt;Taking our initial scenario—a health professional who would like to test whether the mean weight of Belgian adults is different than 80 kg—as example.&lt;/p&gt;
&lt;p&gt;The underlying probability distribution of a test on one mean is either the standard Normal or the Student distribution, depending on whether the variance of the &lt;em&gt;population&lt;/em&gt; (not sample variance!) is known or unknown:&lt;a href=&#34;#fn6&#34; class=&#34;footnote-ref&#34; id=&#34;fnref6&#34;&gt;&lt;sup&gt;6&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the population variance is known &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow\)&lt;/span&gt; the standard Normal distribution is used&lt;/li&gt;
&lt;li&gt;If the population variance is &lt;em&gt;un&lt;/em&gt;known &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow\)&lt;/span&gt; the Student distribution is used&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If no population variance is explicitly given, you can assume that it is unknown since you cannot compute it based on a sample. If you could compute it, that would mean you have access to the entire population and there is, in this case, no point in performing a hypothesis test (you could simply use some &lt;a href=&#34;https://statsandr.com/blog/descriptive-statistics-in-r/&#34;&gt;descriptive statistics&lt;/a&gt; to confirm or refute your belief).&lt;/p&gt;
&lt;p&gt;In our example, no population variance is specified so it is assumed to be unknown. We therefore use the Student distribution.&lt;/p&gt;
&lt;p&gt;The Student distribution has one parameter which defines it; the number of degrees of freedom. The number of degrees of freedom depends on the type of hypothesis test. For instance, the number of degrees of freedom for a test on one mean is equal to the number of observations minus one (&lt;span class=&#34;math inline&#34;&gt;\(n\)&lt;/span&gt; - 1). Without going too far into the details, the - 1 comes from the fact that there is one quantity which is estimated (i.e., the mean).&lt;a href=&#34;#fn7&#34; class=&#34;footnote-ref&#34; id=&#34;fnref7&#34;&gt;&lt;sup&gt;7&lt;/sup&gt;&lt;/a&gt; The sample size being equal to 10 in our example, the degrees of freedom is equal to &lt;span class=&#34;math inline&#34;&gt;\(n\)&lt;/span&gt; - 1 = 10 - 1 = 9.&lt;/p&gt;
&lt;p&gt;There is only one last element missing to find the critical value: the &lt;a href=&#34;https://statsandr.com/blog/student-s-t-test-in-r-and-by-hand-how-to-compare-two-groups-under-different-scenarios/#a-note-on-p-value-and-significance-level-alpha&#34;&gt;significance level&lt;/a&gt;. The &lt;strong&gt;significance level&lt;/strong&gt;, denoted &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt;, is the probability of wrongly rejecting the null hypothesis, so the &lt;strong&gt;probability of rejecting the null hypothesis although it is in reality true&lt;/strong&gt;. In this sense, it is an error (type I error, as opposed to the type II error&lt;a href=&#34;#fn8&#34; class=&#34;footnote-ref&#34; id=&#34;fnref8&#34;&gt;&lt;sup&gt;8&lt;/sup&gt;&lt;/a&gt;) that we accept to deal with, in order to be able to draw conclusions about a population based on a subset of it.&lt;/p&gt;
&lt;p&gt;As you may have read in many statistical textbooks, the significance level is very often set to 5%.&lt;a href=&#34;#fn9&#34; class=&#34;footnote-ref&#34; id=&#34;fnref9&#34;&gt;&lt;sup&gt;9&lt;/sup&gt;&lt;/a&gt; In some fields (such as medicine or engineering, among others), the significance level is also sometimes set to 1% to decrease the error rate.&lt;/p&gt;
&lt;p&gt;It is best to specify the significance level &lt;em&gt;before&lt;/em&gt; performing a hypothesis test to avoid the temptation to set the significance level in accordance to the results (the temptation is even bigger when the results are on the edge of being significant). As I always tell my students, you cannot “guess” nor compute the significance level. Therefore, if it is not explicitly specified, you can safely assume it is 5%. In our case, we did not indicate it, so we take &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; = 5% = 0.05.&lt;/p&gt;
&lt;p&gt;Furthermore, in our example, we want to test whether the mean weight of Belgian adults is &lt;strong&gt;different&lt;/strong&gt; than 80 kg. Since we do not specify the direction of the test, it is a &lt;strong&gt;two-sided test&lt;/strong&gt;. If we wanted to test that the mean weight was less than 80 kg (&lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu &amp;lt;\)&lt;/span&gt; 80) or greater than 80 kg (&lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu &amp;gt;\)&lt;/span&gt; 80), we would have done a one-sided test.&lt;/p&gt;
&lt;p&gt;Make sure that you perform the correct test (two-sided or one-sided) because it has an impact on how to find the critical value (see more in the following paragraphs).&lt;/p&gt;
&lt;p&gt;So now that we know the appropriate distribution (Student distribution), its parameter (degrees of freedom (df) = 9), the significance level (&lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; = 0.05) and the direction (two-sided), we have all we need to find the critical value in the &lt;a href=&#34;https://statsandr.com/blog/a-guide-on-how-to-read-statistical-tables/&#34;&gt;statistical tables&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://statsandr.com/blog/2021-01-27-hypothesis-test-by-hand_files/critical_value_student_distribution.png&#34; style=&#34;width:100.0%&#34; /&gt;&lt;/p&gt;
&lt;p&gt;By looking at the row df = 9 and the column &lt;span class=&#34;math inline&#34;&gt;\(t_.025\)&lt;/span&gt; in the Student’s distribution table, we find a critical value of:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[t_{n-1; \alpha / 2} = t_{9; 0.025} = 2.262\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;One may wonder why we take &lt;span class=&#34;math inline&#34;&gt;\(t_{\alpha/2} = t_.025\)&lt;/span&gt; and not &lt;span class=&#34;math inline&#34;&gt;\(t_\alpha = t_.05\)&lt;/span&gt; since the significance level is 0.05. The reason is that we are doing a two-sided test (&lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu \ne\)&lt;/span&gt; 80), so the error rate of 0.05 must be divided in 2 to find the critical value to the right of the distribution. Since the Student’s distribution is symmetric, the critical value to the left of the distribution is simply: -2.262.&lt;/p&gt;
&lt;p&gt;Visually, the error rate of 0.05 is partitioned into two parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;0.025 to the left of -2.262 and&lt;/li&gt;
&lt;li&gt;0.025 to the right of 2.262&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://statsandr.com/blog/2021-01-27-hypothesis-test-by-hand_files/figure-html/unnamed-chunk-1-1.png&#34; width=&#34;100%&#34; style=&#34;display: block; margin: auto;&#34; /&gt;&lt;/p&gt;
&lt;p&gt;We keep in mind these critical values of -2.262 and 2.262 for the fourth and last step.&lt;/p&gt;
&lt;p&gt;Note that the red shaded areas in the previous plot are also known as the rejection regions. More on that in the following section.&lt;/p&gt;
&lt;p&gt;These critical values can also be found in R, thanks to the &lt;code&gt;qt()&lt;/code&gt; function:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;qt(0.025, df = 9, lower.tail = TRUE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -2.262157&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;qt(0.025, df = 9, lower.tail = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 2.262157&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;qt()&lt;/code&gt; function is used for the Student’s distribution (&lt;code&gt;q&lt;/code&gt; stands for quantile and &lt;code&gt;t&lt;/code&gt; for Student). There are other functions accompanying the different distributions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;qnorm()&lt;/code&gt; for the Normal distribution&lt;/li&gt;
&lt;li&gt;&lt;code&gt;qchisq()&lt;/code&gt; for the Chi-square distribution&lt;/li&gt;
&lt;li&gt;&lt;code&gt;qf()&lt;/code&gt; for the Fisher distribution&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;step-4-concluding-and-interpreting-the-results&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #4: Concluding and interpreting the results&lt;/h4&gt;
&lt;p&gt;In this fourth and last step, all we have to do is to &lt;strong&gt;compare the test statistic&lt;/strong&gt; (computed in step #2) &lt;strong&gt;with the critical values&lt;/strong&gt; (found in step #3) in order to &lt;strong&gt;conclude the hypothesis test&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The only two possibilities when concluding a hypothesis test are:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;Rejection of the null hypothesis&lt;/li&gt;
&lt;li&gt;Non-rejection of the null hypothesis&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In our example of adult weight, remember that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the t-stat is -2.189&lt;/li&gt;
&lt;li&gt;the critical values are -2.262 and 2.262&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Also remember that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;strong&gt;t-stat gives an indication on how extreme our sample is&lt;/strong&gt; compared to the null hypothesis&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;critical values are the threshold from which the t-stat is considered as &lt;em&gt;too&lt;/em&gt; extreme&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To compare the t-stat with the critical values, I always recommend to plot them:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://statsandr.com/blog/2021-01-27-hypothesis-test-by-hand_files/figure-html/unnamed-chunk-3-1.png&#34; width=&#34;100%&#34; style=&#34;display: block; margin: auto;&#34; /&gt;&lt;/p&gt;
&lt;p&gt;These two critical values form the rejection regions (the red shaded areas):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;from &lt;span class=&#34;math inline&#34;&gt;\(- \infty\)&lt;/span&gt; to -2.262, and&lt;/li&gt;
&lt;li&gt;from 2.262 to &lt;span class=&#34;math inline&#34;&gt;\(\infty\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the &lt;strong&gt;t-stat lies within one of the rejection region, we reject the null hypothesis&lt;/strong&gt;. On the contrary, if the &lt;strong&gt;t-stat does &lt;em&gt;not&lt;/em&gt; lie within any of the rejection region, we do &lt;em&gt;not&lt;/em&gt; reject the null hypothesis&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;As we can see from the above plot, the t-stat is less extreme than the critical value and therefore does not lie within any of the rejection region. In conclusion, we do not reject the null hypothesis that &lt;span class=&#34;math inline&#34;&gt;\(\mu = 80\)&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;This is the conclusion in statistical terms but they are meaningless without proper interpretation. So it is a good practice to also interpret the result in the context of the problem:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;At the 5% significance level, we do not reject the hypothesis that the mean weight of Belgian adults is 80 kg.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div id=&#34;why-dont-we-accept-h_0&#34; class=&#34;section level5&#34;&gt;
&lt;h5&gt;Why don’t we accept &lt;span class=&#34;math inline&#34;&gt;\(H_0\)&lt;/span&gt;?&lt;/h5&gt;
&lt;p&gt;From a more philosophical (but still very important) perspective, note that we wrote “we &lt;em&gt;do not reject&lt;/em&gt; the null hypothesis” and “we &lt;em&gt;do not reject&lt;/em&gt; the hypothesis that the mean weight of Belgian adults is equal to 80 kg”. We did not write “we &lt;em&gt;accept&lt;/em&gt; the null hypothesis” nor “the mean weight of Belgian adults is 80 kg”.&lt;/p&gt;
&lt;p&gt;The reason is due to the fact that, in hypothesis testing, we conclude something about the population based on a sample. There is, therefore, always some uncertainty and we cannot be 100% sure that our conclusion is correct.&lt;/p&gt;
&lt;p&gt;Perhaps it is the case that the mean weight of Belgian adults is in reality different than 80 kg, but &lt;strong&gt;we failed to prove it&lt;/strong&gt; based on the data at hand. It may be the case that if we had more observations, we would have rejected the null hypothesis (since all else being equal, a larger sample size implies a more extreme t-stat). Or, it may be the case that even with more observations, we would not have rejected the null hypothesis because the mean weight of Belgian adults is in reality close to 80 kg. We cannot distinguish between the two.&lt;/p&gt;
&lt;p&gt;So we can just say that we did not find enough evidence against the hypothesis that the mean weight of Belgian adults is 80 kg, but we do not conclude that the mean is equal to 80 kg.&lt;/p&gt;
&lt;p&gt;If the difference is still not clear to you, the following example may help. Suppose a person is suspected of having committed a crime. This person is either innocent—the null hypothesis—or guilty—the alternative hypothesis. In the attempt to know if the suspect committed the crime, the police collects as much information and proof as possible. This is similar to the researcher collecting data to form a sample. And then the judge, based on the collected evidence, decides whether the suspect is considered as innocent or guilty. If there is enough evidence that the suspect committed the crime, the judge will conclude that the suspect is guilty. In other words, she will reject the null hypothesis of the suspect being innocent because there are enough evidence that the suspect committed the crime.&lt;/p&gt;
&lt;p&gt;This is similar to the t-stat being more extreme than the critical value: we have enough information (based on the sample) to say that the null hypothesis is unlikely because our data would be too extreme if the null hypothesis were true. Since the sample cannot be “wrong” (it corresponds to the collected data), the only remaining possibility is that the null hypothesis is in fact wrong. This is the reason we write “we reject the null hypothesis”.&lt;/p&gt;
&lt;p&gt;On the other hand, if there is not enough evidence that the suspect committed the crime (or no evidence at all), the judge will conclude that the suspect is considered as not guilty. In other words, she will not reject the null hypothesis of the suspect being innocent. But even if she concludes that the suspect is considered as not guilty, she will never be 100% sure that he is really innocent.&lt;/p&gt;
&lt;p&gt;It may be the case that:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;the suspect did not commit the crime, or&lt;/li&gt;
&lt;li&gt;the suspect committed the crime but the police was not able to collect enough information against the suspect.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the former case the suspect is really innocent, whereas in the latter case the suspect is guilty but the police and the judge failed to prove it because they failed to find enough evidence against him. Similar to hypothesis testing, the judge has to conclude the case by considering the suspect not guilty, without being able to distinguish between the two.&lt;/p&gt;
&lt;p&gt;This is the main reason we write “we do not reject the null hypothesis” or “we fail to reject the null hypothesis” (you may even read in some textbooks conclusion such as “there is no sufficient evidence in the data to reject the null hypothesis”), and we do not write “we accept the null hypothesis”.&lt;/p&gt;
&lt;p&gt;I hope this metaphor helped you to understand the reason why we reject the null hypothesis instead of accepting it.&lt;/p&gt;
&lt;p&gt;In the following sections, we present two other methods used in hypothesis testing.&lt;/p&gt;
&lt;p&gt;These methods will result in the exact same conclusion: non-rejection of the null hypothesis, that is, we do not reject the hypothesis that the mean weight of Belgian adults is 80 kg. It is thus presented only if you prefer to use these methods over the first one.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;method-b-comparing-the-p-value-with-the-significance-level-alpha&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Method B: Comparing the &lt;em&gt;p&lt;/em&gt;-value with the significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Method B, which consists in computing the &lt;em&gt;p&lt;/em&gt;-value and comparing this &lt;em&gt;p&lt;/em&gt;-value with the significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt;, boils down to the following 4 steps:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;Stating the &lt;strong&gt;null and alternative hypothesis&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Computing the &lt;strong&gt;test statistic&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Computing the &lt;strong&gt;&lt;em&gt;p&lt;/em&gt;-value&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concluding&lt;/strong&gt; and interpreting the results&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In this second method which uses the &lt;em&gt;p&lt;/em&gt;-value, the first and second steps are similar than in the first method.&lt;/p&gt;
&lt;div id=&#34;step-1-stating-the-null-and-alternative-hypothesis-1&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #1: Stating the null and alternative hypothesis&lt;/h4&gt;
&lt;p&gt;The null and alternative hypotheses remain the same:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu = 80\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu \ne 80\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;step-2-computing-the-test-statistic-1&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #2: Computing the test statistic&lt;/h4&gt;
&lt;p&gt;Remember that the formula for the t-stat is different depending on the type of hypothesis test (one or two means, one or two proportions, one or two variances). In our case of one mean with unknown variance, we have:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[t_{obs} = \frac{\bar{x} - \mu}{\frac{s}{\sqrt{n}}} = \frac{71 - 80}{\frac{13}{\sqrt{10}}} = -2.189\]&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;step-3-computing-the-p-value&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #3: Computing the &lt;em&gt;p&lt;/em&gt;-value&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;&lt;em&gt;p&lt;/em&gt;-value&lt;/strong&gt; is the &lt;a href=&#34;https://statsandr.com/blog/the-9-concepts-and-formulas-in-probability-that-every-data-scientist-should-know/&#34;&gt;probability&lt;/a&gt; (so it goes from 0 to 1) of observing a sample at least as extreme as the one we observed if the null hypothesis were true. In some sense, it &lt;strong&gt;gives you an indication on how likely your null hypothesis is&lt;/strong&gt;. It is also defined as the smallest level of significance for which the data indicate rejection of the null hypothesis.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;em&gt;p&lt;/em&gt;-value, I recommend reading this &lt;a href=&#34;https://statsandr.com/blog/student-s-t-test-in-r-and-by-hand-how-to-compare-two-groups-under-different-scenarios/#a-note-on-p-value-and-significance-level-alpha&#34;&gt;note about the &lt;em&gt;p&lt;/em&gt;-value and the significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Formally, the &lt;em&gt;p&lt;/em&gt;-value is the area beyond the test statistic. Since we are doing a two-sided test, the &lt;em&gt;p&lt;/em&gt;-value is thus the sum of the area above 2.189 and below -2.189.&lt;/p&gt;
&lt;p&gt;Visually, the &lt;em&gt;p&lt;/em&gt;-value is the sum of the two blue shaded areas in the following plot:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://statsandr.com/blog/2021-01-27-hypothesis-test-by-hand_files/figure-html/unnamed-chunk-4-1.png&#34; width=&#34;100%&#34; style=&#34;display: block; margin: auto;&#34; /&gt;&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;p&lt;/em&gt;-value can computed with precision in R with the &lt;code&gt;pt()&lt;/code&gt; function:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p_val &amp;lt;- pt(-2.189, df = 9, lower.tail = TRUE) + pt(2.189, df = 9, lower.tail = FALSE)
p_val&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 0.05634202&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# which is equivalent than:
p_val &amp;lt;- 2 * pt(2.189, df = 9, lower.tail = FALSE)
p_val&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 0.05634202&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;em&gt;p&lt;/em&gt;-value is 0.0563, which indicates that there is a 5.63% chance to observe a sample at least as extreme as the one observed if the null hypothesis were true. This already gives us a hint on whether our t-stat is too extreme or not (and thus whether our null hypothesis is likely or not), but we formally conclude in step #4.&lt;/p&gt;
&lt;p&gt;Like the &lt;code&gt;qt()&lt;/code&gt; function to find the critical value, we use &lt;code&gt;pt()&lt;/code&gt; to find the &lt;em&gt;p&lt;/em&gt;-value because the underlying distribution is the Student’s distribution.&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;pnorm()&lt;/code&gt;, &lt;code&gt;pchisq()&lt;/code&gt; and &lt;code&gt;pf()&lt;/code&gt; for the Normal, Chi-square and Fisher distribution, respectively. See also this &lt;a href=&#34;https://antoinesoetewey.shinyapps.io/statistics-101/&#34; target=&#34;_blank&#34;&gt;Shiny app&lt;/a&gt; to compute the &lt;em&gt;p&lt;/em&gt;-value given a certain t-stat for most probability distributions.&lt;/p&gt;
&lt;p&gt;If you do not have access to a computer (during exams for example) you will not be able to compute the &lt;em&gt;p&lt;/em&gt;-value precisely, but you can bound it using the statistical table referring to your test.&lt;/p&gt;
&lt;p&gt;In our case, we use the Student distribution and we look at the row df = 9 (since df = &lt;em&gt;n&lt;/em&gt; - 1):&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://statsandr.com/blog/2021-01-27-hypothesis-test-by-hand_files/p-value-student-distribution.png&#34; style=&#34;width:100.0%&#34; /&gt;&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;The test statistic is -2.189&lt;/li&gt;
&lt;li&gt;We take the absolute value, which gives 2.189&lt;/li&gt;
&lt;li&gt;The value 2.189 is between 1.833 and 2.262 (highlighted in blue in the above table)&lt;/li&gt;
&lt;li&gt;From the column names &lt;span class=&#34;math inline&#34;&gt;\(t_{.050}\)&lt;/span&gt; and &lt;span class=&#34;math inline&#34;&gt;\(t_{.025}\)&lt;/span&gt; related to 1.833 and 2.262, we know that:
&lt;ul&gt;
&lt;li&gt;the area to the right of 1.833 is 0.05&lt;/li&gt;
&lt;li&gt;the area to the right of 2.262 is 0.025&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;So we know that the area to the right of 2.189 must be between 0.025 and 0.05&lt;/li&gt;
&lt;li&gt;Since the Student distribution is symmetric, we know that the area to the left of -2.189 must also be between 0.025 and 0.05&lt;/li&gt;
&lt;li&gt;Therefore, the sum of the two areas must be between 0.05 and 0.10&lt;/li&gt;
&lt;li&gt;In other words, the &lt;em&gt;p&lt;/em&gt;-value is between 0.05 and 0.10 (i.e., 0.05 &amp;lt; &lt;em&gt;p&lt;/em&gt;-value &amp;lt; 0.10)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Although we could not compute it precisely, it is enough to conclude our hypothesis test in the last step.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;step-4-concluding-and-interpreting-the-results-1&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #4: Concluding and interpreting the results&lt;/h4&gt;
&lt;p&gt;The final step is now to simply compare the &lt;em&gt;p&lt;/em&gt;-value (computed in step #3) with the significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt;. As for all &lt;a href=&#34;https://statsandr.com/blog/what-statistical-test-should-i-do/&#34;&gt;statistical tests&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the &lt;strong&gt;&lt;em&gt;p&lt;/em&gt;-value is smaller&lt;/strong&gt; than &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; (&lt;em&gt;p&lt;/em&gt;-value &amp;lt; 0.05) &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow H_0\)&lt;/span&gt; is unlikely &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow\)&lt;/span&gt; we &lt;strong&gt;reject&lt;/strong&gt; the null hypothesis&lt;/li&gt;
&lt;li&gt;If the &lt;strong&gt;&lt;em&gt;p&lt;/em&gt;-value is greater&lt;/strong&gt; than or equal to &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; (&lt;em&gt;p&lt;/em&gt;-value &lt;span class=&#34;math inline&#34;&gt;\(\ge\)&lt;/span&gt; 0.05) &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow H_0\)&lt;/span&gt; is likely &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow\)&lt;/span&gt; we do &lt;strong&gt;not reject&lt;/strong&gt; the null hypothesis&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;No matter if we take into consideration the exact &lt;em&gt;p&lt;/em&gt;-value (i.e., 0.0563) or the bounded one (0.05 &amp;lt; &lt;em&gt;p&lt;/em&gt;-value &amp;lt; 0.10), it is larger than 0.05, so we do not reject the null hypothesis.&lt;a href=&#34;#fn10&#34; class=&#34;footnote-ref&#34; id=&#34;fnref10&#34;&gt;&lt;sup&gt;10&lt;/sup&gt;&lt;/a&gt; In the context of the problem, we do not reject the null hypothesis that the mean weight of Belgian adults is 80 kg.&lt;/p&gt;
&lt;p&gt;Remember that rejecting (or not rejecting) a null hypothesis at the significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; using the critical value method (method A) is equivalent to rejecting (or not rejecting) the null hypothesis when the &lt;em&gt;p&lt;/em&gt;-value is lower (equal or greater) than &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; (method B).&lt;/p&gt;
&lt;p&gt;This is the reason we find the exact same conclusion than with method A, and why you should too if you use both methods on the same data and with the same significance level.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;method-c-comparing-the-target-parameter-with-the-confidence-interval&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Method C: Comparing the target parameter with the confidence interval&lt;/h3&gt;
&lt;p&gt;Method C, which consists in computing the confidence interval and comparing this confidence interval with the target parameter (the parameter under the null hypothesis), boils down to the following 3 steps:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;Stating the &lt;strong&gt;null and alternative hypothesis&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Computing the &lt;strong&gt;confidence interval&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concluding&lt;/strong&gt; and interpreting the results&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In this last method which uses the confidence interval, the first step is similar than in the first two methods.&lt;/p&gt;
&lt;div id=&#34;step-1-stating-the-null-and-alternative-hypothesis-2&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #1: Stating the null and alternative hypothesis&lt;/h4&gt;
&lt;p&gt;The null and alternative hypotheses remain the same:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu = 80\)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&#34;math inline&#34;&gt;\(H_1: \mu \ne 80\)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;step-2-computing-the-confidence-interval&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #2: Computing the confidence interval&lt;/h4&gt;
&lt;p&gt;Like hypothesis testing, confidence intervals are a well-known tool in inferential statistics.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Confidence interval is&lt;/strong&gt; an estimation procedure which produces &lt;strong&gt;an interval&lt;/strong&gt; (i.e., a range of values) &lt;strong&gt;containing the true parameter with a certain&lt;/strong&gt;—usually high—&lt;strong&gt;probability&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In the same way that there is a formula for each type of hypothesis test when computing the test statistics, there exists a formula for each type of confidence interval. Formulas for the different types of confidence intervals can be found in this &lt;a href=&#34;https://antoinesoetewey.shinyapps.io/statistics-201/&#34; target=&#34;_blank&#34;&gt;Shiny app&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is the formula for a confidence interval on one mean &lt;span class=&#34;math inline&#34;&gt;\(\mu\)&lt;/span&gt; (with unknown population variance):&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[
(1-\alpha)\text{% CI for } \mu = \bar{x} \pm t_{\alpha/2, n - 1} \frac{s}{\sqrt{n}}
\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;where &lt;span class=&#34;math inline&#34;&gt;\(t_{\alpha/2, n - 1}\)&lt;/span&gt; is found in the Student distribution table (and is similar to the critical value found in step #3 of method A).&lt;/p&gt;
&lt;p&gt;Given our data and with &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; = 0.05, we have:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[
\begin{aligned}
95\text{% CI for } \mu &amp;amp;= \bar{x} \pm t_{\alpha/2, n - 1} \frac{s}{\sqrt{n}} \\
&amp;amp;= 71 \pm 2.262 \frac{13}{\sqrt{10}} \\
&amp;amp;= [61.70; 80.30]
\end{aligned}
\]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The 95% confidence interval for &lt;span class=&#34;math inline&#34;&gt;\(\mu\)&lt;/span&gt; is [61.70; 80.30] kg. But &lt;strong&gt;what does a 95% confidence interval mean?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We know that this estimation procedure has a 95% probability of producing an interval containing the true mean &lt;span class=&#34;math inline&#34;&gt;\(\mu\)&lt;/span&gt;. In other words, &lt;strong&gt;if we construct many confidence intervals&lt;/strong&gt; (with different samples of the same size), &lt;strong&gt;95% of them will&lt;/strong&gt;, on average, &lt;strong&gt;include the mean of the population&lt;/strong&gt; (the true parameter). So on average, 5% of these confidence intervals will not cover the true mean.&lt;/p&gt;
&lt;p&gt;If you wish to decrease this last percentage, you can decrease the significance level (set &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; = 0.01 or 0.02 for instance). All else being equal, this will increase the range of the confidence interval and thus increase the probability that it includes the true parameter.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;step-3-concluding-and-interpreting-the-results&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step #3: Concluding and interpreting the results&lt;/h4&gt;
&lt;p&gt;The final step is simply to compare the confidence interval (constructed in step #2) with the value of the target parameter (the value under the null hypothesis, mentioned in step #1):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the &lt;strong&gt;confidence interval does not include&lt;/strong&gt; the hypothesized value &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow H_0\)&lt;/span&gt; is unlikely &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow\)&lt;/span&gt; we &lt;strong&gt;reject&lt;/strong&gt; the null hypothesis&lt;/li&gt;
&lt;li&gt;If the &lt;strong&gt;confidence interval includes&lt;/strong&gt; the hypothesized value &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow H_0\)&lt;/span&gt; is likely &lt;span class=&#34;math inline&#34;&gt;\(\rightarrow\)&lt;/span&gt; we do &lt;strong&gt;not reject&lt;/strong&gt; the null hypothesis&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the hypothesized value is 80 (since &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu\)&lt;/span&gt; = 80)&lt;/li&gt;
&lt;li&gt;80 is included in the 95% confidence interval since it goes from 61.70 to 80.30 kg&lt;/li&gt;
&lt;li&gt;So we do not reject the null hypothesis&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the terms of the problem, we do not reject the hypothesis that the mean weight of Belgian adults is 80 kg.&lt;/p&gt;
&lt;p&gt;As you can see, the conclusion is equivalent than with the critical value method (method A) and the &lt;em&gt;p&lt;/em&gt;-value method (method B). Again, this must be the case since we use the same data and the same significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt; for all three methods.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;which-method-to-choose&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Which method to choose?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;All three methods give the same conclusion.&lt;/strong&gt; However, each method has its own advantage so I usually select the most convenient one depending on the situation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Method A (comparing the test statistic with the critical value):
&lt;ul&gt;
&lt;li&gt;It is, in my opinion, the &lt;strong&gt;easiest and most straightforward method&lt;/strong&gt; of the three when I do not have access to R.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Method B (comparing the &lt;em&gt;p&lt;/em&gt;-value with the significance level &lt;span class=&#34;math inline&#34;&gt;\(\alpha\)&lt;/span&gt;):
&lt;ul&gt;
&lt;li&gt;In addition to being able to know whether the null hypothesis is rejected or not, computing the &lt;strong&gt;exact &lt;em&gt;p&lt;/em&gt;-value can be very convenient&lt;/strong&gt; so I tend to use this method if I have access to R.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Method C (comparing the target parameter with the confidence interval):
&lt;ul&gt;
&lt;li&gt;If I need to test &lt;strong&gt;several hypothesized values&lt;/strong&gt;, I tend to choose this method because I can construct one single confidence interval and compare it to as many values as I want. For example, with our 95% confidence interval [61.70; 80.30], I know that any value below 61.70 kg and above 80.30 kg will be rejected, without testing it for each value.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;summary&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Summary&lt;/h1&gt;
&lt;p&gt;In this article, we reviewed the &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#why&#34;&gt;goals&lt;/a&gt; and &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#when&#34;&gt;when&lt;/a&gt; hypothesis testing is used. We then showed &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#how&#34;&gt;how to do a hypothesis test by hand&lt;/a&gt; through three different methods (A. &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#method-a-comparing-the-test-statistic-with-the-critical-value&#34;&gt;critical value&lt;/a&gt;, B. &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#method-b-comparing-the-p-value-with-the-significance-level-alpha&#34;&gt;&lt;em&gt;p&lt;/em&gt;-value&lt;/a&gt; and C. &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#method-c-comparing-the-target-parameter-with-the-confidence-interval&#34;&gt;confidence interval&lt;/a&gt;). We also showed how to &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#step-4-concluding-and-interpreting-the-results&#34;&gt;interpret the results&lt;/a&gt; in the context of the initial problem.&lt;/p&gt;
&lt;p&gt;Although all three methods give the exact same conclusion when using the same data and the same significance level (otherwise there is a mistake somewhere), I also presented my personal &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/#which-method-to-choose&#34;&gt;preferences&lt;/a&gt; when it comes to choosing one method over the other two.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
&lt;p&gt;I hope this article helped you to understand the structure of a hypothesis by hand. I remind you that, at least for the 6 hypothesis tests covered in this article, the formulas are different, but the structure and the reasoning behind it remain the same. So you basically have to know which formulas to use, and simply follow the steps mentioned in this article.&lt;/p&gt;
&lt;p&gt;For the interested reader, I created two accompanying Shiny apps:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;&lt;a href=&#34;https://antoinesoetewey.shinyapps.io/statistics-201/&#34; target=&#34;_blank&#34;&gt;Hypothesis testing and confidence intervals&lt;/a&gt;: after entering your data, the app illustrates all the steps in order to conclude the test and compute a confidence interval. See more information in this &lt;a href=&#34;https://statsandr.com/blog/a-shiny-app-for-inferential-statistics-by-hand/&#34;&gt;article&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://antoinesoetewey.shinyapps.io/statistics-101/&#34; target=&#34;_blank&#34;&gt;How to read statistical tables&lt;/a&gt;: the app helps you to compute the &lt;em&gt;p&lt;/em&gt;-value given a t-stat for most probability distributions. See more information in this &lt;a href=&#34;https://statsandr.com/blog/a-guide-on-how-to-read-statistical-tables/&#34;&gt;article&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;As always, if you have a question or a suggestion related to the topic covered in this article, please add it as a comment so other readers can benefit from the discussion.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;footnotes footnotes-end-of-document&#34;&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id=&#34;fn1&#34;&gt;&lt;p&gt;Suppose a researcher wants to test whether Belgian women are taller than French women. Suppose a health professional would like to know whether the proportion of smokers is different among athletes and non-athletes. It would take way too long to measure the height of all Belgian and French women and to ask all athletes and non-athletes their smoking habits. So most of the time, decisions are based on a representative sample of the population and not on the whole population. If we could measure the entire population in a reasonable time frame, we would not do any inferential statistics.&lt;a href=&#34;#fnref1&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn2&#34;&gt;&lt;p&gt;Don’t get me wrong, this does not mean that hypothesis tests are &lt;em&gt;never&lt;/em&gt; used in exploratory analyses. It is just much less frequent in exploratory research than in confirmatory research.&lt;a href=&#34;#fnref2&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn3&#34;&gt;&lt;p&gt;You may see more or less steps in other articles or textbooks, depending on whether these steps are detailed or concise. Hypothesis testing should, however, follows the same process regardless of the number of steps.&lt;a href=&#34;#fnref3&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn4&#34;&gt;&lt;p&gt;For one-sided tests, writing &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu = 80\)&lt;/span&gt; or &lt;span class=&#34;math inline&#34;&gt;\(H_0: \mu \ge 80\)&lt;/span&gt; are both correct. The point is that the null and alternative hypothesis must be mutually exclusive since you are testing one hypothesis against the other, so both cannot be true at the same time.&lt;a href=&#34;#fnref4&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn5&#34;&gt;&lt;p&gt;To be complete, there are even different formulas within each type of test, depending on whether some assumptions are met or not. For the interested reader, see all the different scenarios and thus the different formulas for a test on &lt;a href=&#34;https://statsandr.com/blog/how-to-perform-a-one-sample-t-test-by-hand-and-in-r-test-on-one-mean/&#34;&gt;one mean&lt;/a&gt; and on &lt;a href=&#34;https://statsandr.com/blog/student-s-t-test-in-r-and-by-hand-how-to-compare-two-groups-under-different-scenarios/&#34;&gt;two means&lt;/a&gt;.&lt;a href=&#34;#fnref5&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn6&#34;&gt;&lt;p&gt;There are more uncertainty if the population variance is unknown than if it is known, and this greater uncertainty is taken into account by using the Student distribution instead of the standard Normal distribution. Also note that as the sample size increases, the degrees of freedom of the Student distribution increases and the two distributions become more and more similar. For large sample size (usually from &lt;span class=&#34;math inline&#34;&gt;\(n &amp;gt;\)&lt;/span&gt; 30), the Student distribution becomes so close to the standard Normal distribution that, even if the population variance is unknown, the standard Normal distribution can be used.&lt;a href=&#34;#fnref6&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn7&#34;&gt;&lt;p&gt;For a test on two independent samples, the degrees of freedom is &lt;span class=&#34;math inline&#34;&gt;\(n_1 + n_2 - 2\)&lt;/span&gt;, where &lt;span class=&#34;math inline&#34;&gt;\(n_1\)&lt;/span&gt; and &lt;span class=&#34;math inline&#34;&gt;\(n_2\)&lt;/span&gt; are the size of the first and second sample, respectively. Note the - 2 due to the fact that in this case, two quantities are estimated.&lt;a href=&#34;#fnref7&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn8&#34;&gt;&lt;p&gt;The type II error is the probability of not rejecting the null hypothesis although it is in reality false.&lt;a href=&#34;#fnref8&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn9&#34;&gt;&lt;p&gt;Whether this is a good or a bad standard is a question that comes up often and is debatable. This is, however, beyond the scope of the article.&lt;a href=&#34;#fnref9&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn10&#34;&gt;&lt;p&gt;Again, &lt;em&gt;p&lt;/em&gt;-values found via a statistical table or via R must be coherent.&lt;a href=&#34;#fnref10&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>A Shiny app for inferential statistics by hand</title>
      <link>https://statsandr.com/blog/a-shiny-app-for-inferential-statistics-by-hand/</link>
      <pubDate>Wed, 15 Jan 2020 00:00:00 +0000</pubDate>
      
      <guid>https://statsandr.com/blog/a-shiny-app-for-inferential-statistics-by-hand/</guid>
      <description>


&lt;p&gt;&lt;img src=&#34;https://statsandr.com/blog/a-shiny-app-for-inferential-statistics_files/Screenshot%202020-02-04%20at%2011.36.38.png&#34; style=&#34;width:100.0%&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Statistics is divided into four main branches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Descriptive statistics&lt;/li&gt;
&lt;li&gt;Inferential statistics&lt;/li&gt;
&lt;li&gt;Predictive analysis&lt;/li&gt;
&lt;li&gt;Exploratory analysis&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Descriptive statistics provide a summary of the data; it helps explaining the data in a concise way without losing too much information. Data can be summarized numerically or graphically. See &lt;a href=&#34;https://statsandr.com/blog/descriptive-statistics-by-hand/&#34;&gt;descriptive statistics by hand&lt;/a&gt; or &lt;a href=&#34;https://statsandr.com/blog/descriptive-statistics-in-r/&#34;&gt;in R&lt;/a&gt; to learn more about this branch of statistics.&lt;/p&gt;
&lt;p&gt;The branch of predictive analysis aims at predicting a dependent variable based on one or several independent variables. Depending on the type of data to be predicted, it often encompasses methods such as &lt;a href=&#34;https://statsandr.com/blog/multiple-linear-regression-made-simple/&#34;&gt;linear regression&lt;/a&gt; or classification.&lt;/p&gt;
&lt;p&gt;Exploratory analyses focus on using graphical approaches to delve into the data and identify the relationships that exist between the different variables in the dataset. They are therefore more akin to data visualization.&lt;/p&gt;
&lt;p&gt;Inferential statistics uses a random sample of data taken from a population to make inferences, i.e., to draw conclusions about the population (see the &lt;a href=&#34;https://statsandr.com/blog/what-is-the-difference-between-population-and-sample/&#34;&gt;difference between population and sample&lt;/a&gt;). In other words, information from the sample is used to make generalizations about the parameter of interest in the population.&lt;/p&gt;
&lt;p&gt;The two major tools in inferential statistics are:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;confidence intervals, and&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/&#34;&gt;hypothesis tests&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Here is a Shiny app which helps you to use these two tools:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://antoinesoetewey.shinyapps.io/statistics-201/&#34; target=&#34;_blank&#34;&gt;Statistics-201&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This Shiny app focuses on confidence intervals and &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/&#34;&gt;hypothesis tests&lt;/a&gt; for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1 and 2 means (with unpaired and paired samples)&lt;/li&gt;
&lt;li&gt;1 and 2 proportions&lt;/li&gt;
&lt;li&gt;1 and 2 variances&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;how-to-use-this-app&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;How to use this app?&lt;/h1&gt;
&lt;p&gt;Follow these steps:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;Open the app via this &lt;a href=&#34;https://antoinesoetewey.shinyapps.io/statistics-201/&#34; target=&#34;_blank&#34;&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Choose the parameter(s) you want to do inference for (i.e., mean(s), proportion(s) or variance(s))&lt;/li&gt;
&lt;li&gt;Write your data in Sample. Observations are separated by a comma and the decimal is a point&lt;/li&gt;
&lt;li&gt;Set the null and alternative hypothesis&lt;/li&gt;
&lt;li&gt;Select the significance level (most of the time &lt;span class=&#34;math inline&#34;&gt;\(\alpha = 0.05\)&lt;/span&gt;)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the results panel (on the right side or below depending on the size of your screen), you will see:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a recap of your sample together with some appropriate descriptive statistics&lt;/li&gt;
&lt;li&gt;the confidence interval&lt;/li&gt;
&lt;li&gt;the hypothesis test&lt;/li&gt;
&lt;li&gt;the interpretation&lt;/li&gt;
&lt;li&gt;and an illustration of the hypothesis test&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All formulas, steps and computations to arrive at the final results are also provided.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;code&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Code&lt;/h1&gt;
&lt;p&gt;See the last version on &lt;a href=&#34;https://github.com/AntoineSoetewey/statistics-201&#34; target=&#34;_blank&#34;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note that the link may not work if the app has hit the monthly usage limit. Try again later if that is the case.&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;conclusion&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
&lt;p&gt;I hope you will find this app useful to do inferential statistics and in particular confidence interval and hypothesis testing by hand.&lt;/p&gt;
&lt;p&gt;If you need to learn more about the structure of a hypothesis test by hand, see this &lt;a href=&#34;https://statsandr.com/blog/hypothesis-test-by-hand/&#34;&gt;article&lt;/a&gt;. See also this &lt;a href=&#34;https://statsandr.com/blog/what-statistical-test-should-i-do/&#34;&gt;flowchart&lt;/a&gt; to have an overview of the most common statistical tests.&lt;/p&gt;
&lt;p&gt;As always, if you have a question or a suggestion related to the topic covered in this article, please add it as a comment so other readers can benefit from the discussion.&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>