The other commonly used statistical distribution
is known as the Student's T-distribution.
William Sealy Gosset specified the T-distribution.
In fact, he published a paper in Biometrika in 1908,
and he published it under the pseudonym Student.
He worked for the Guinness Brewery in Dublin,
Ireland, where he worked with small samples of body.
Mr. Gosset is the unsung hero of statistics.
He published his work under
a pseudonym because of
the restrictions from his employer.
Apart from his published work,
his other contributions to
statistical analysis are equally significant.
The cult of statistical significance,
a must read book for anyone interested in Data Science,
chronicles Mr. Gosset's work and how
other influential statistician's of the time,
namely Ronald Fisher and Egon Pearson,
by way of their academic bonafide,
ended up being more influential than the
equally deserving Mr. Gosset.
The normal distribution describes
the mean for the population,
whereas the T-distribution describes
the mean of samples drawn from a population.
The T-distribution for each sample could be different and
the T-distribution resembles the normal distribution
for large sample sizes.
Here, I present normal distribution
which is drawn in blue,
and the T-distribution with a degree of freedom of one,
as the degrees of freedom increase,
the T-distribution curve becomes
more similar to the normal distribution.
In statistical analysis,
several statistical tests rely on T-distribution.
For instance, a comparison of
means tests use the T-distribution.
And it's also known as the T-test.
We have been working with a dataset
comprising teaching evaluations of
instructors from University of Texas.
And I will illustrate the use of T-tests
or T-distribution with the question of,
does instructor evaluation score differ by gender?
Do males and females get
different teaching evaluations from students?
Now, if I were to take
the same dataset and
compute the means and standard deviations.
I can test this statistically.
I have computed the visual representation of
the average teaching evaluation score
for male and female instructors.
The blue bar represents
the average teaching evaluation value for females.
The orange bar represents
the average teaching evaluation value for males.
By eyeballing it, it is around
four and slightly less for females.
Now it's a small difference between males and females.
The question is, is
this difference statistically significant?
To use a T-test,
you have to make some assumptions are met.
The first assumption for a T-test
is that the scale of measurement applied
to the data collected
follows a continuous or ordinal scale.
The second assumption is that the data is collected from
a representative randomly selected portion
of the total population.
The third assumption is the Data when plotted,
will follow a normal distribution.
And the final assumption is homogeneity of variance.
To avoid the test statistics to be
biased towards larger sample sizes.
There's a test for this,
which will be discussed later.
Before we go perform the test in Python.
First, we will state our hypothesis.
The null hypothesis is as follows.
There is no difference in
evaluation scores for males and females.
The alternate hypothesis is there is a difference
in evaluation scores between males and females.
Then set alpha level to 0.05.
To do this in Python,
we will use the T-test independent sample
in the Scipy stats function.
The function takes in the two samples
it is trying to test.
The statistical difference of means for,
in our example is
the female's evaluation scores
versus all the male's evaluation scores.
It will return a T-statistic and a P-value.
Since the P-value is less than 0.05, the alpha level,
we reject the null hypothesis
as there is enough evidence that there is
a statistical difference in teaching
evaluations based on gender.