1 00:00:05,960 --> 00:00:10,740 The other commonly used statistical distribution 2 00:00:10,740 --> 00:00:14,565 is known as the Student's T-distribution. 3 00:00:14,565 --> 00:00:18,990 William Sealy Gosset specified the T-distribution. 4 00:00:18,990 --> 00:00:23,445 In fact, he published a paper in Biometrika in 1908, 5 00:00:23,445 --> 00:00:27,990 and he published it under the pseudonym Student. 6 00:00:27,990 --> 00:00:30,690 He worked for the Guinness Brewery in Dublin, 7 00:00:30,690 --> 00:00:34,110 Ireland, where he worked with small samples of body. 8 00:00:34,110 --> 00:00:36,630 Mr. Gosset is the unsung hero of statistics. 9 00:00:36,630 --> 00:00:38,340 He published his work under 10 00:00:38,340 --> 00:00:39,780 a pseudonym because of 11 00:00:39,780 --> 00:00:41,725 the restrictions from his employer. 12 00:00:41,725 --> 00:00:43,460 Apart from his published work, 13 00:00:43,460 --> 00:00:44,870 his other contributions to 14 00:00:44,870 --> 00:00:49,070 statistical analysis are equally significant. 15 00:00:49,070 --> 00:00:52,010 The cult of statistical significance, 16 00:00:52,010 --> 00:00:55,790 a must read book for anyone interested in Data Science, 17 00:00:55,790 --> 00:00:58,505 chronicles Mr. Gosset's work and how 18 00:00:58,505 --> 00:01:01,550 other influential statistician's of the time, 19 00:01:01,550 --> 00:01:05,210 namely Ronald Fisher and Egon Pearson, 20 00:01:05,210 --> 00:01:07,595 by way of their academic bonafide, 21 00:01:07,595 --> 00:01:09,950 ended up being more influential than the 22 00:01:09,950 --> 00:01:12,530 equally deserving Mr. Gosset. 23 00:01:12,530 --> 00:01:14,900 The normal distribution describes 24 00:01:14,900 --> 00:01:16,430 the mean for the population, 25 00:01:16,430 --> 00:01:18,380 whereas the T-distribution describes 26 00:01:18,380 --> 00:01:21,154 the mean of samples drawn from a population. 27 00:01:21,154 --> 00:01:24,660 The T-distribution for each sample could be different and 28 00:01:24,660 --> 00:01:27,515 the T-distribution resembles the normal distribution 29 00:01:27,515 --> 00:01:29,240 for large sample sizes. 30 00:01:29,240 --> 00:01:33,110 Here, I present normal distribution 31 00:01:33,110 --> 00:01:35,390 which is drawn in blue, 32 00:01:35,390 --> 00:01:39,065 and the T-distribution with a degree of freedom of one, 33 00:01:39,065 --> 00:01:41,299 as the degrees of freedom increase, 34 00:01:41,299 --> 00:01:44,765 the T-distribution curve becomes 35 00:01:44,765 --> 00:01:48,080 more similar to the normal distribution. 36 00:01:48,080 --> 00:01:49,730 In statistical analysis, 37 00:01:49,730 --> 00:01:53,945 several statistical tests rely on T-distribution. 38 00:01:53,945 --> 00:01:56,240 For instance, a comparison of 39 00:01:56,240 --> 00:01:58,925 means tests use the T-distribution. 40 00:01:58,925 --> 00:02:01,130 And it's also known as the T-test. 41 00:02:01,130 --> 00:02:04,850 We have been working with a dataset 42 00:02:04,850 --> 00:02:06,920 comprising teaching evaluations of 43 00:02:06,920 --> 00:02:10,655 instructors from University of Texas. 44 00:02:10,655 --> 00:02:14,149 And I will illustrate the use of T-tests 45 00:02:14,149 --> 00:02:17,210 or T-distribution with the question of, 46 00:02:17,210 --> 00:02:20,450 does instructor evaluation score differ by gender? 47 00:02:20,450 --> 00:02:22,430 Do males and females get 48 00:02:22,430 --> 00:02:24,859 different teaching evaluations from students? 49 00:02:24,859 --> 00:02:26,990 Now, if I were to take 50 00:02:26,990 --> 00:02:29,165 the same dataset and 51 00:02:29,165 --> 00:02:31,520 compute the means and standard deviations. 52 00:02:31,520 --> 00:02:33,980 I can test this statistically. 53 00:02:33,980 --> 00:02:37,520 I have computed the visual representation of 54 00:02:37,520 --> 00:02:39,530 the average teaching evaluation score 55 00:02:39,530 --> 00:02:41,735 for male and female instructors. 56 00:02:41,735 --> 00:02:43,520 The blue bar represents 57 00:02:43,520 --> 00:02:46,805 the average teaching evaluation value for females. 58 00:02:46,805 --> 00:02:49,070 The orange bar represents 59 00:02:49,070 --> 00:02:52,324 the average teaching evaluation value for males. 60 00:02:52,324 --> 00:02:54,710 By eyeballing it, it is around 61 00:02:54,710 --> 00:02:57,350 four and slightly less for females. 62 00:02:57,350 --> 00:03:00,860 Now it's a small difference between males and females. 63 00:03:00,860 --> 00:03:02,795 The question is, is 64 00:03:02,795 --> 00:03:05,650 this difference statistically significant? 65 00:03:05,650 --> 00:03:07,885 To use a T-test, 66 00:03:07,885 --> 00:03:10,685 you have to make some assumptions are met. 67 00:03:10,685 --> 00:03:12,920 The first assumption for a T-test 68 00:03:12,920 --> 00:03:14,810 is that the scale of measurement applied 69 00:03:14,810 --> 00:03:16,055 to the data collected 70 00:03:16,055 --> 00:03:18,950 follows a continuous or ordinal scale. 71 00:03:18,950 --> 00:03:22,160 The second assumption is that the data is collected from 72 00:03:22,160 --> 00:03:25,040 a representative randomly selected portion 73 00:03:25,040 --> 00:03:26,930 of the total population. 74 00:03:26,930 --> 00:03:30,335 The third assumption is the Data when plotted, 75 00:03:30,335 --> 00:03:33,010 will follow a normal distribution. 76 00:03:33,010 --> 00:03:37,865 And the final assumption is homogeneity of variance. 77 00:03:37,865 --> 00:03:40,010 To avoid the test statistics to be 78 00:03:40,010 --> 00:03:42,455 biased towards larger sample sizes. 79 00:03:42,455 --> 00:03:43,790 There's a test for this, 80 00:03:43,790 --> 00:03:45,995 which will be discussed later. 81 00:03:45,995 --> 00:03:49,234 Before we go perform the test in Python. 82 00:03:49,234 --> 00:03:51,815 First, we will state our hypothesis. 83 00:03:51,815 --> 00:03:54,904 The null hypothesis is as follows. 84 00:03:54,904 --> 00:03:56,210 There is no difference in 85 00:03:56,210 --> 00:03:59,180 evaluation scores for males and females. 86 00:03:59,180 --> 00:04:02,180 The alternate hypothesis is there is a difference 87 00:04:02,180 --> 00:04:05,389 in evaluation scores between males and females. 88 00:04:05,389 --> 00:04:08,660 Then set alpha level to 0.05. 89 00:04:08,660 --> 00:04:10,700 To do this in Python, 90 00:04:10,700 --> 00:04:13,070 we will use the T-test independent sample 91 00:04:13,070 --> 00:04:15,365 in the Scipy stats function. 92 00:04:15,365 --> 00:04:17,510 The function takes in the two samples 93 00:04:17,510 --> 00:04:19,145 it is trying to test. 94 00:04:19,145 --> 00:04:21,500 The statistical difference of means for, 95 00:04:21,500 --> 00:04:23,000 in our example is 96 00:04:23,000 --> 00:04:24,965 the female's evaluation scores 97 00:04:24,965 --> 00:04:27,935 versus all the male's evaluation scores. 98 00:04:27,935 --> 00:04:31,590 It will return a T-statistic and a P-value. 99 00:04:31,590 --> 00:04:36,635 Since the P-value is less than 0.05, the alpha level, 100 00:04:36,635 --> 00:04:38,480 we reject the null hypothesis 101 00:04:38,480 --> 00:04:40,550 as there is enough evidence that there is 102 00:04:40,550 --> 00:04:42,440 a statistical difference in teaching 103 00:04:42,440 --> 00:04:45,390 evaluations based on gender.