YouTube2Text

Hypothesis Testing and The Null Hypothesis, Clearly Explained!!! — Transcript

by StatQuest with Josh Starmer · 1,970 words · 358 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Stat Quest in the morning Stat Quest at
  2. 0:04night Stat Quest in the afternoon it's
  3. 0:08all right Stat Quest.
  4. 0:12Hello, I'm Josh Starmer and welcome to
  5. 0:15Stat Quest. Today we're going to talk
  6. 0:17about hypothesis testing and the null
  7. 0:20hypothesis.
  8. 0:22I'm not going to name names, but imagine
  9. 0:25there was a virus
  10. 0:27and we had two drugs we could use to
  11. 0:29treat it.
  12. 0:31So we give drug A to three people
  13. 0:34and measure how long it takes each
  14. 0:36person to recover from the virus.
  15. 0:39The first thing we notice is that not
  16. 0:41everyone recovered in the exact same
  17. 0:43amount of time.
  18. 0:45Person number one recovered the fastest
  19. 0:49and person number two recovered the
  20. 0:51slowest.
  21. 0:53It's possible that person number one
  22. 0:56eats healthy food and exercises and
  23. 0:58already has a strong immune system and
  24. 1:01that helped them recover quickly.
  25. 1:04And maybe person number two doesn't get
  26. 1:06as much exercise
  27. 1:08or maybe person number two has a
  28. 1:10stressful job or lives where there is a
  29. 1:12lot of air pollution.
  30. 1:14The point is is that even though all
  31. 1:16three people had the same virus and took
  32. 1:19the same drug
  33. 1:21they did not all recover in the exact
  34. 1:23same amount of time and that might be
  35. 1:26due to a lot of random things like
  36. 1:28exercise or job stress that we cannot
  37. 1:30control.
  38. 1:33Now let's give drug B to three different
  39. 1:35people that have the virus
  40. 1:37and measure how long it takes them to
  41. 1:39recover.
  42. 1:41Again, we see that even though three
  43. 1:43people had the same virus and took the
  44. 1:45same drug
  45. 1:47they did not all recover in the exact
  46. 1:49same amount of time.
  47. 1:52And this is probably due to random stuff
  48. 1:54that we can't control like how much
  49. 1:56exercise each person gets or how much
  50. 1:59candy they eat.
  51. 2:01Overall, it looks like people taking
  52. 2:03drug A took less time to recover than
  53. 2:06people taking drug B.
  54. 2:08And when we calculate the mean or
  55. 2:11average value for drug A
  56. 2:14and the mean value for drug B,
  57. 2:17we see that on average, there is a
  58. 2:2015-hour difference between drug A and
  59. 2:22drug B.
  60. 2:24So, after seeing this preliminary data,
  61. 2:28it might seem reasonable to form the
  62. 2:29following hypothesis.
  63. 2:32People taking drug A need, on average,
  64. 2:3615 fewer hours to recover than people
  65. 2:38taking drug B.
  66. 2:41And now that we have this hypothesis, we
  67. 2:44can test it
  68. 2:46by repeating the experiment.
  69. 2:49Now, when we calculate the means,
  70. 2:51we see that, on average, people taking
  71. 2:54drug A need 35 more hours than people
  72. 2:58taking drug B.
  73. 3:00Compared to our preliminary data, this
  74. 3:02result is very unexpected.
  75. 3:06In fact, it is the opposite of the
  76. 3:08original hypothesis.
  77. 3:11But, it is also possible that all three
  78. 3:13people that took drug A in the second
  79. 3:16experiment have super stressful jobs and
  80. 3:18unhealthy lifestyles.
  81. 3:21And maybe that's why it took them so
  82. 3:23long to recover.
  83. 3:25And maybe everyone taking drug B was
  84. 3:28well-rested and super healthy to begin
  85. 3:30with.
  86. 3:32And maybe that's why they recovered so
  87. 3:34quickly.
  88. 3:35But, it is also possible that we
  89. 3:37mislabeled drug A and drug B and did the
  90. 3:40wrong experiment.
  91. 3:43So, we repeat the experiment.
  92. 3:46And again, the results are totally
  93. 3:48backwards from the preliminary
  94. 3:49experiment
  95. 3:51and totally backwards from the
  96. 3:53hypothesis that we made.
  97. 3:56So, again, just to make sure we didn't
  98. 3:59mislabel things, we redo the experiment.
  99. 4:03And again, these results are the
  100. 4:05opposite of the original hypothesis.
  101. 4:09So, we just keep repeating the
  102. 4:10experiment, each time double-checking
  103. 4:13every little detail.
  104. 4:16And every time we do the experiment, we
  105. 4:18get the opposite result of the original
  106. 4:20hypothesis.
  107. 4:23So, after doing all of these repeated
  108. 4:25experiments, where we double-checked
  109. 4:28every little step,
  110. 4:30we can confidently reject this
  111. 4:32hypothesis that we came up with after
  112. 4:34doing the preliminary experiment.
  113. 4:37Bam!
  114. 4:40Now, let's imagine we had two more
  115. 4:42drugs, C and D.
  116. 4:46And just like before, we gave drug C to
  117. 4:48three people
  118. 4:50and measured how long it took each
  119. 4:52person to recover from the virus.
  120. 4:56Then we gave drug D to three different
  121. 4:58people
  122. 5:00and measured how long it took them to
  123. 5:01recover from the virus.
  124. 5:05And based on this data, we can create a
  125. 5:07hypothesis about drug C and drug D.
  126. 5:11People taking drug C need, on average,
  127. 5:1513 fewer hours to recover than people
  128. 5:17taking drug D.
  129. 5:20Now, just like before, we decide to test
  130. 5:23this hypothesis by repeating the
  131. 5:25experiment.
  132. 5:27Only this time, instead of getting
  133. 5:29something that's the exact opposite of
  134. 5:31what we expected,
  135. 5:33we get something that is only slightly
  136. 5:35different.
  137. 5:37In this case, the difference is in the
  138. 5:39same direction, but it is only 12 hours.
  139. 5:44Then we repeat the experiment again,
  140. 5:47And again, we get something slightly
  141. 5:50different from the preliminary
  142. 5:51experiment and hypothesis.
  143. 5:54The difference is in the same direction,
  144. 5:56but this time it is 13.5 hours.
  145. 6:01The good news is that we probably didn't
  146. 6:03mislabel the drug like we did last time.
  147. 6:06And the differences between the three
  148. 6:08experiments might be due to random
  149. 6:10things we cannot control.
  150. 6:13Like maybe these people exercised a lot
  151. 6:15and had relatively healthy diets
  152. 6:18compared to these people who took longer
  153. 6:20to recover.
  154. 6:22But, regardless, the hypothesis says
  155. 6:25that people taking drug C needed 13
  156. 6:28fewer hours to recover.
  157. 6:30But when we repeated the experiment,
  158. 6:33the first replicate said the difference
  159. 6:35between averages was 12,
  160. 6:38which is different from the hypothesis.
  161. 6:41And the second replicate said the
  162. 6:42difference was 13.5,
  163. 6:45which is also different from the
  164. 6:47hypothesis.
  165. 6:49And let's be honest, the only reason the
  166. 6:52hypothesis says 13 fewer hours is
  167. 6:55because that was the result from the
  168. 6:56first experiment.
  169. 6:59However, we could have just as easily
  170. 7:01put 12 fewer hours in the hypothesis
  171. 7:04because that's what we got the second
  172. 7:05time.
  173. 7:07Or we could have put 13.5 fewer hours in
  174. 7:10the hypothesis because that's what we
  175. 7:12got the third time.
  176. 7:15So if we just pick one experiment like
  177. 7:17the first one,
  178. 7:19and use that to define the hypothesis,
  179. 7:23then we have two experiments that are
  180. 7:25not different enough to give us
  181. 7:27confidence to reject the hypothesis,
  182. 7:30but because there is just as much data
  183. 7:32suggesting that the difference is 12
  184. 7:34hours,
  185. 7:36and there is just as much data
  186. 7:37suggesting that the difference is 13.5
  187. 7:40hours,
  188. 7:42these experiments don't make us super
  189. 7:44confident that the hypothesis of 13
  190. 7:46fewer hours is correct.
  191. 7:49Again, maybe drug A reduces recovery by
  192. 7:5313 fewer hours,
  193. 7:55but maybe it reduces recovery by 12
  194. 7:57hours
  195. 7:58or 13.5.
  196. 8:01Because the results from the repeated
  197. 8:03experiments are not different enough to
  198. 8:05cause us to reject the hypothesis,
  199. 8:09and because they don't convince us that
  200. 8:11the hypothesis is correct, either,
  201. 8:14the best we can do is fail to reject the
  202. 8:17hypothesis.
  203. 8:19Small bam.
  204. 8:21To summarize what we've covered so far,
  205. 8:24we can create a hypothesis.
  206. 8:27And if data gives us strong evidence
  207. 8:29that the hypothesis is wrong,
  208. 8:31then we can reject the hypothesis.
  209. 8:35But when we have data that is similar to
  210. 8:37the hypothesis, but not exactly the
  211. 8:39same,
  212. 8:41then the best we can do is fail to
  213. 8:43reject the hypothesis.
  214. 8:45Because it's unclear if the hypothesis
  215. 8:48should be based on this result
  216. 8:50or this other, slightly different,
  217. 8:52result
  218. 8:53or this result
  219. 8:55or any other possible outcome.
  220. 8:58Double bam.
  221. 9:01Now, let's take a closer look at the
  222. 9:03hypothesis itself.
  223. 9:06You may remember that the only reason
  224. 9:08the hypothesis is 13 fewer hours is that
  225. 9:11it was the first result.
  226. 9:14But we could have just as easily gotten
  227. 9:16a 12-hour difference
  228. 9:18or a 13.5-hour difference and ended up
  229. 9:21with a different hypothesis.
  230. 9:24And if 12 and 13.5 are reasonable
  231. 9:27hypotheses, then so is 12.25
  232. 9:31or 13.1.
  233. 9:33In other words, there are a lot of
  234. 9:35reasonable hypotheses.
  235. 9:38How do we know which one to test?
  236. 9:41Since the goal is to see if drug C is
  237. 9:43different from drug D,
  238. 9:46we simply test to see if there is no
  239. 9:48difference between the drugs.
  240. 9:51Oh, no, it's the dreaded terminology
  241. 9:53alert.
  242. 9:55The hypothesis that there is no
  243. 9:57difference between things is called the
  244. 9:59null hypothesis.
  245. 10:02So, let's take a look at two examples of
  246. 10:04the null hypothesis in action.
  247. 10:07Now, imagine we are testing two new
  248. 10:10drugs, E and F.
  249. 10:13And this time, we only get a 0.5 hour
  250. 10:16difference.
  251. 10:17This person recovered the fastest,
  252. 10:20but it is easy to imagine that if they
  253. 10:23had exercised a little less or had a
  254. 10:25slightly worse diet,
  255. 10:27then they might have taken a little
  256. 10:28longer to recover.
  257. 10:31Likewise, if this person was just a
  258. 10:33little healthier to begin with,
  259. 10:36then they might have recovered a little
  260. 10:37more quickly.
  261. 10:39These small, random differences give us
  262. 10:42a slightly different result.
  263. 10:45Now, instead of drug F being slightly
  264. 10:48better by 0.5 hours, drug E is slightly
  265. 10:52better by 0.25 hours.
  266. 10:55Because these small, random differences
  267. 10:58give a slightly different results,
  268. 11:01we can use the null hypothesis so we
  269. 11:03don't have to worry about whether or not
  270. 11:05the difference is exactly 0.25
  271. 11:08or 0.5 hours.
  272. 11:11Instead, we simply see if the data
  273. 11:13convinces us to reject the hypothesis
  274. 11:16that there's no difference between drug
  275. 11:19E and drug F.
  276. 11:21In this case, the original result was
  277. 11:240.5 hours in favor of drug F.
  278. 11:28But small, random things could have
  279. 11:31easily changed result to be a 0.25 hour
  280. 11:34difference in favor of drug E.
  281. 11:38And thus, the data does not
  282. 11:40overwhelmingly convince us to reject the
  283. 11:43null hypothesis.
  284. 11:45So, we failed to reject the null
  285. 11:47hypothesis that there is no difference
  286. 11:50between the drugs.
  287. 11:52In contrast, if we tested the drugs on a
  288. 11:55lot of people
  289. 11:57and little random things would not
  290. 11:59change the results very much,
  291. 12:02then we could confidently reject the
  292. 12:04null hypothesis that there is no
  293. 12:06difference between drug E and drug F.
  294. 12:11Bam!
  295. 12:12Note, without the null hypothesis, we
  296. 12:15need preliminary data in order to make a
  297. 12:17statement that we can test in follow-up
  298. 12:20experiments.
  299. 12:22This is because we don't know if we
  300. 12:24should test if the difference is 13
  301. 12:26hours or 13,000 hours until we get some
  302. 12:29data.
  303. 12:30In contrast, the null hypothesis does
  304. 12:33not require preliminary data because the
  305. 12:36only value that represents no difference
  306. 12:39is zero.
  307. 12:41Triple bam!
  308. 12:43In summary,
  309. 12:45rather than get stressed out over a
  310. 12:47large number of possible hypotheses that
  311. 12:50we could test to see if drug C is
  312. 12:52different from drug D,
  313. 12:54we use the null hypothesis to determine
  314. 12:57if there is a difference.
  315. 12:59If we do an experiment with a bunch of
  316. 13:01people
  317. 13:02and a lot more people taking drug C had
  318. 13:05shorter recovery times than people
  319. 13:07taking drug D,
  320. 13:09so many that it would be hard to imagine
  321. 13:11that the results were due to random
  322. 13:13things, like everyone taking drug C had
  323. 13:16better diets or got more exercise than
  324. 13:18the people taking drug D,
  325. 13:21then we could reject the null
  326. 13:22hypothesis.
  327. 13:24And then we know that there is a
  328. 13:26difference between drug C and drug D.
  329. 13:30Alternatively, if little random things
  330. 13:33could easily shift the result from one
  331. 13:35drug to the other and then back again,
  332. 13:38then we would fail to reject the null
  333. 13:40hypothesis.
  334. 13:43Bam!
  335. 13:44But wait, what about the alternative
  336. 13:47hypothesis?
  337. 13:49Because the alternative hypothesis is
  338. 13:51super important, it has its own quest,
  339. 13:54so check it out.
  340. 13:55And if you don't already know about P
  341. 13:57values, they would make a wonderful
  342. 13:59follow-up.
  343. 14:01Lastly, if you want to review statistics
  344. 14:04and machine learning offline, check out
  345. 14:06the StatQuest study guides at
  346. 14:08statquest.org.
  347. 14:10There's something for everyone.
  348. 14:13Hooray! We've made it to the end of
  349. 14:16another exciting StatQuest. If you like
  350. 14:18this StatQuest and want to see more,
  351. 14:20please subscribe. And if you want to
  352. 14:22support StatQuest, consider contributing
  353. 14:25to my Patreon campaign, becoming a
  354. 14:27channel member, buying one or two of the
  355. 14:30StatQuest study guides or a t-shirt or a
  356. 14:32hoodie, or just donate. The links are in
  357. 14:35the description below.
  358. 14:36All right, until next time, quest on!

About this transcript

This page contains the full transcript of Hypothesis Testing and The Null Hypothesis, Clearly Explained!!! by StatQuest with Josh Starmer, generated from the public captions YouTube serves with the video. The transcript has 1,970 words across 358 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.