1 Student’s t-Distribution
William S. Gossett, who developed the t-distribution, wrote under the name
“Student” since, as an employee of the Guiness Brewery in Dublin, he was
required by the firm to use a pseudonym in publishing his results.
Population 1
Population 2
William S. Gossett
Founder of: T-
Student 1908
2 Student’s t-Distribution
In the previous lectures on statistical inference (estimation,
hypothesis testing) about the mean, we used the Z statistic
even when we did not know σ. In that case, we used s as a
point estimate of σ for “large enough” n.
What do we do if (a) we don’t know σ and (b) n is small? If
the population of interest is normally distributed, we can use
the Student’s t-distribution in place of the standard normal
distribution, Z.
In a nutshell, we use the t-Distribution when we have small
samples. As you recall, the central limit theorem tells us that
the sample means follow a normal distribution when n is
large (some say at least 30; others say 50).
3 When do we use the t-Distribution
Large sample (n) Small sample (n)
σ known Z test Z test
σ unknown Z test t test – but only if population is ND**
We will use Z for EITHER (1) known σ OR (2) large n
Use t for (1) Small sample AND (2) Taken from N.D.
population** AND (3) Unknown σ
** What can we do if the population is not normally
distributed and we have a small sample? Always
use non-parametric statistical methods in this case.
(We will not study non-parametric statistics in this
course.
tDegrees of freedom
4
The t-Distribution
The t-distribution looks like the normal distribution, except that it has more spread.
It is still symmetrical about the mean; mean=median=mode.
It also goes from -∞ to +∞.
The Student’s t distribution is not a single distribution (like the standardized normal
(Z) distribution.
It is a series of distributions, one for each number of degrees of freedom.
The t distribution with 10 degrees of freedom has a slightly different shape than a t
distribution with 20 degrees of freedom.
As n gets larger, student’s t distribution approaches the normal distribution.
Degrees of freedom (df) = n -1. We will shortly see why we lose the degree of freedom (hint:
remember we divided by (n-1) when computing the sample standard deviation).
5 Using the t statistic
for testing hypotheses (n-1 degrees of freedom):
X − 0 X − 0
t n−1 = =
sX s
n
µH0 or μ0 denotes the claimed population mean (for
example, a company might be making a claim about this
parameter).
(1-)% Confidence Interval Estimator:
s
X t
n
6 Losing a degree of freedom
Serbestlik Derecesi düşürme-azaltma
The number of degrees of freedom is equal to the sample size minus 1.
We “lose” a degree of freedom each time a statistic computed from the
sample is used as a point estimator in place of the parameter.
In this case, we do not know the population σ, so instead of using σ (which
comes from a census, not a sample) we use s, the sample standard deviation.
As you already know, in the formula to compute s, we divide by (n-1), a
loss of a degree of freedom. If we did not divide by (n-1) in computing the
standard deviation, it would be biased when used as a point estimator of
the population standard deviation, σ
In a nutshell, we have n-1 degrees of freedom for reasons that have to do with
mathematically ensuring that our formulas all work properly without any bias.
Example 1
7
A consulting firm claims that its consultants earn on average exactly
$260 an hour. You decide to test the claim using a sample of 16
consultants. You find that X̅ = $200 and s = $96. Test the claim at
𝛼 = 0.05 level. Assume that the population follows a normal
distribution.
We follow the same steps in hypothesis testing as before (see the
virtual handout in question).
Step 1: Formulate the null and alternate hypotheses
H0: μ = $260
H1: μ ≠ $260
8 Example 1 (cont’d)
Step 2: =0.05
Step 3: Choose the test statistic
We are going to use the t-distribution since n is small (only 16) and we
do not know σ
t 15
2.5% 2.5%
-2.1315 2.1315
Step 4: Establish the critical value or values of the test statistic
needed to reject H0.
This is a t15 so we cannot use the critical values of ±1.96 which we
used for a Z test. If you go to the t-table (next slide) and examine the
column that has 0.025 on the top and the row for 15 degrees of
freedom, you will find that the critical values are ±2.1315
Please do not forget that you have (n-1) degrees of freedom (d.f.); n
= 16, but d.f. = 15.
9 Example 1 (cont’d)
Degrees of Upper Tail Areas
Freedom .25 .10 .05 .025 .01 .005
1 1.0000 3.0777 6.3138 12.7062 31.8207 63.6574
2 0.8165 1.8856 2.9200 4.3027 6.9646 9.9248
3 0.7649 1.6377 2.3 534 3.1824 4.5407 5.8409
4 0.7407 1.5332 2.1318 2.7764 3.7469 4.6041
5 0.7267 1.4 759 2.0150 2.5706 3.3649 4.0322
6 0.7176 1.4398 1.9432 2.4469 3.1427 3.7074
7 0.7111 1.4149 1.8946 2.3646 2.9980 3.4995
8 0.7064 1.3968 1.8595 2.3060 2.8965 3.3554
9 0.7027 1.3830 1.8331 2.2622 2.8214 3.2498
10 0.6998 1.3722 1.8125 2.2281 2.7638 3.1693
11 0.6974 1.3634 1.7959 2.2010 2.7181 3.1058
12 0;6955 1.3562 1. 7823 2.1788 2.6810 3.0545
13 0.6938 1.3502 1.7709 2.1604 2.6503 3.0123
14 0.6924 1.3450 1.7613 2.1448 2.6245 2.9768
15 0.6912 1.3406 1.7531 2.1315 2.6025 2.9467
16 0.6901 1.3368 1.7459 2.1199 2.5835 2.9208
17 0.6892 1.3334 1.7396 2.1098 2.5669 2.8982
18 0.6884 1.3304 1.7341 2.1009 2.5524 2.8784
19 0.6876 1.3277 1.7291 2.0930 2.5395 2.8609
20 0.6870 1.3253 1.7247 2.0860 2.5280 2.8453
… … … … … … …
∞ 1.645 1.96 2.33 2.575
10
11 Example 1 (cont’d)
Step 5: Determine the actual value (computed
value) of the test statistic.
t15 = = - 2.50
200 − 260 − 60
=
96 24
16
Step 6: Make the decision (Reject H0 or Do Not
Reject H0).
Reject H0
12 Example 1 (cont’d)
Now, how do we construct a confidence interval estimator
(CIE), using t?
Suppose there had not been a claim about the
population mean and you simply wanted to construct a
95% CIE for μ. Using the sample evidence, what should
you do?
96 s
200± 2.1315 X t
16 n
$200 ± $51.16
$148.84 ↔ $251.16
Interpretation: We have 95% confidence that this interval
($148.84 ↔ $251.16) really does contain the true
population mean, µ.
13 Example 2
A company claims that its soup vending machines deliver (on
average) exactly 4.00 ounces of soup. The company statistician
finds:
n=25
X̅=3.97 ounces
s=0.04 ounces
(a) Test the claim at 𝛼 =0.02.
(b) Supposing no claim was made, construct a two-sided 98%
confidence interval estimator using the sample evidence.
14 Example 2 (cont’d) (a)
H 0 : µ = 4 oz
H 1 : µ ≠ 4 oz
t24
(a) Test the claim (=0.02)
H0: µ=4.0 oz. 0.01 0.01
H1: µ≠4.0 oz.
-2.4922 2.4922
3.97 − 4 - .03 3.97 − 4 - .03
t24 = = = -3.75
t 24 = = = -3.75 REJECT H 0
.04 / 25 .008 .04 / 25 .008
Reject H0 X − 0 X − 0
t n−1 = =
sX s
n
15 Example 2 (cont’d)
(b) 98% CIE of µ
s
3.97 ± 2.4922(.008) X t
3.97 ± .02 n
3.95 oz ←———→ 3.99 oz
Note that 4.00 ounces is not in the 98% CIE.
How is this consistent with (a)?
The t Distribution
Example 3
16
A school claims that the average reading score of its students is
at least 70.
A sample of 16 students is randomly selected (n=16) to test this
claim.
X̅ = 68 and s = 9
(a) Test claim at α = 0.05.
(b) Supposing no claim was made. Use sample evidence to
construct a two-sided 95% confidence interval estimate (CIE) of μ.
The t Distribution
17 Example 3 (cont’d)
(a) H 0 : µ ≥ 70
H 1 : µ < 70
Test the claim at =.05 t15
H0: µ≥70
H1: µ<70
5%
-1.7531
68 − 70 -2
t15 = = = -0.88 68 − 70 - 2
9 / 16 2.25 t = =15 = -0.88 DO NOT REJECT H
9 / 16 2.25
Do Not Reject H0
The t Distribution
18 Example 3 (cont’d)
(b) Two-sided 95% CIE.
We will always construct two-sided CIEs in this course.
s
X t
n
68 2.1315(2.25)
68 4.8
63.2 ———→ 72.8
The t Distribution
19 Example 4
The Vandelay Water Company claims that at most there
is1 ppm (part per million) of benzene in their terribly
expensive horrid- tasting bottled water.
(a) Test the claim at α=.05
(b) Supposing no claim was made. Construct a two-tailed
95% C.I.E of μ
SampleData:
n=25 randomly selected bottles of water
X̅= 1.16 ppm and s = 0.20 ppm
The t Distribution
20 Example 4 (cont’d)
Test the claim at 𝛼=0.05
H0: µ≤1.0 ppm
H1: µ>1.0 ppm
1.16 − 1.00 .16
t 24 = = =4
.20 / 25 .04
Reject H0
X − 0 X − 0
t n−1 = =
sX s
The t Distribution
n
21 Example 4 (cont’d)
t 24
(b) 2-sided 95% CIE of μ
s
X t 0.025 0.025
n
1.16 2.0639(0.04) -2.0639 2.0639
1.16.083
1.077 ppm ——→ 1.243 ppm
The t Distribution
22 The Two-Sample t-Statistic
İki Örneklemli t-İstatistiği
Similar to one-sample hypothesis testing, we use the Z
statistic if we can.
Use Z if σ1 and σ 2 are known OR if samples are large
enough
What is large enough? Both samples together must be at
least 32. Some say 60, or more.
Therefore we must use t when
σ1 and σ 2 are unknown AND
the samples are small AND
the populations are normally distributed
Two-Sample t Test
23 The Two-Sample t-Statistic
To calculate the two-sample t statistic:
1 − 2
t n1 + n2 − 2 =
1 1
s pooled ( + )
2
n1 n2
We have to calculate s2pooled first.
This pooled variance is the variance you would get if you
combined the two groups into one and calculated the
variance.
It is a weighted average of s12 and s22, the variances of the
two groups, weighted by degrees of freedom.
Two-Sample t Test
24 The Two-Sample t-Statistic
The pooled variance is the variance you would get if
you combined the two groups into one and
calculated the variance.
(n1 − 1) s12 + (n2 − 1) s22
s 2pooled =
n1 + n2 − 2
It is a weighted average of s12 and s22, the variances of
the two groups, weighted by degrees of freedom.
Two-Sample t Test
25 About Homoscedasticity
Eşdeğişkenlik hakkında
Technically, to use this formula one must know (or be
able to prove statistically) that the two variances are
“equal” – this property is called homoskedasticity.
Incidentally, this is sometimes spelled with a c,
“homoscedasticity.”
An F-test may be performed to test whether σ1 and σ2
and are statistically equivalent, i.e., to test for
homoskedasticity.
We will learn about this F-test in other courses.
If we do not have homoskedasticity, i.e. the variances
https://stats.stackexchange.com/q/76151
are not proved to be statistically equivalent, then we
have to make adjustment to the formula.
Two-Sample t Test
26
Problem 1: Reading Scores
Suppose we want to compare the reading scores of men
and women on a standardized reading test. We take a
random sample of 31 people and obtain the results
below. Note that the women outperform the men by 4
points. Of course, this might simply be sampling error. We
would like to test whether or not this difference is
significant at the =0.05 level.
Men Women
80 = 1 84 = 2
S 16 = S1 20 = S 2
n 16 = n1 15 = n2
Two-Sample t Test
27 Problem 1: Reading Scores
(cont’d)
H0: μ1= μ2
H1: μ1≠ μ2
Note that
σ1,σ2 are not given
n1+ n2 = 31
We will use a t statistic with n1+ n2 -2 = 29 degrees of
freedom
Two-Sample t Test
28 Problem 1: Reading Scores
(cont’d)
To calculate the t29 test statistic, first get the pooled variance:,
15(256) + 14(400) 9440 (n1 − 1) s12 + (n2 − 1) s22
= = 325.5 s 2pooled =
n1 + n2 − 2
s2pooled = 29 29
Note that, since it is a weighted average, s2pooled is between s1
(=256) and s2 (=400).
1 − 2
80 − 84 −4 −4 t n1 + n2 − 2 =
= = = −.62 1 1
t29 = 1 1 42.04 6.48 s 2pooled ( + )
325.5( + ) n1 n2
16 15
Conclusion: Do not reject H0. There is no statistically difference
between men and women on test scores.
Two-Sample t Test
29 Problem 2: Company Pay
We would like to determine whether the difference in
daily pay between two companies is statistically
significant. 𝛼 = 0.01
Company 1 Company 2
Sample average X̅1= $210 X̅2 = $175
Standard deviation s1 = $25 s2 = $20
Sample size n1 = 10 n2 = 20
Two-Sample t Test
30 Problem 2: Company Pay
(cont’d)
t 28
.005 .005
-2.7633 2.7633
(n1 − 1) s12 + (n2 − 1) s22
s 2
=
n1 + n2 − 2
pooled
1 − 2
t n1 + n2 − 2 =
1 1
Two-Sample t Test s 2pooled ( + )
n1 n2
31 Problem 2: Company Pay (cont’d)
t 28
.005 .005
-2.7633 2.7633
Conclusion: Reject H0.
Since the calculated value of 4.16 is in the rejection region (right tail),
we conclude that the pay rates at the two companies are indeed
different. Company A pays more than Company B.
Two-Sample t Test
32 Problem 3: Strength of Concrete Beams
Two types of precast concrete beams are being
considered for sale. The only difference between the
two beams is in the type of material used. Strength is
measured in terms of pounds per square inch (psi) of
pressure. Is there a significant difference in beams
supplied by Supplier A and Supplier B? Or, is the
difference of 25 psi explainable as sampling error? Test
at α = 0.05
Supplier A Supplier B
Sample average X̅1= 5000 psi X̅2 = 4975 psi
Standard deviation s1 = 50 psi s2 = 60 psi
Sample size n1 = 12 batches n2 = 10 batches
Two-Sample t Test
Problem 3: Concrete Beams
(cont’d)
(n1 − 1) s12 + (n2 − 1) s22
s 2
=
n1 + n2 − 2
pooled
1 − 2
t n1 + n2 − 2 =
1 1
s 2pooled ( + )
n1 n2
Do not reject H0; There is no statistically
significant difference between the beams
made by Supplier A and Supplier B.
Two-Sample t Test
33
Using MS Excel to Solve
Two-Sample t-Tests
Instructions for using MS Excel to solve two-
sample t-test problems may be found on
the Virtual Handouts page at:
http://sites.google.com/site/proffriedmansta
t/home/handouts
Another example
https://www.youtube.com/watch?v=_WNUfgZip
ww
35 Using MS Excel: Spending on
Wine
A marketer wants to determine whether men
and women spend different amounts on wine.
(It is well known that men spend considerably
more on beer.)
The researcher randomly samples 34 people
(17 women and 17 men) and finds that the
average amount spent on wine (in a year)
by women is $437.47. The average amount
spent by men is $552.94.
Given the Excel printout (next slide), is the
difference statistically significant?
Two-Sample t Test
36 Using MS Excel: Spending on
Wine (cont’d)
Output from MS Excel:
Note: Variable 1 represents women; Variable 2,men.
Two-Sample t Test
37 Using MS Excel: Spending on
A comparison of men and women and how much they spend on wine per year.
Wine (cont’d)
Women Men
$100.00 $107.00
Digression – what was the $250.00 $240.00
input? $890.00
$765.00
$880.00
$770.00
$456.00 $409.00
$356.00 $500.00
$876.00 $800.00
This is the data input into MS $740.00 $900.00
Excel as two columns of $231.00
$222.00
$1,000.00
$489.00
numbers showing how much $555.00 $800.00
$666.00 $890.00
money 17 men and 17 $876.00 $770.00
women spent on wine over $10.00
$290.00
$509.00
$100.00
the year. $98.00 $102.00
$56.00 $134.00
Two-Sample t Test
Using MS Excel: Spending on Wine
38 (cont’d)
Given the printout, is the difference statistically significant?
Answer: If a two-tail test was done, the probability of getting the sample
evidence (or sample evidence showing an even larger difference) given
that there is no difference in the population means of job satisfaction
scores for men and women is .30 (rounded from .297399288). In another
words, if men and women (in the population) spend the same on wine,
there is a 30% chance of getting the sample evidence (or sample evidence
indicating a larger difference between men and women) we obtained.
Statisticians usually test at an alpha of .05 so we do not have evidence to
reject the null hypothesis. Conclusion: There is no statistically significant
difference between men and women on how much they spend on wine
consumption.Two-Sample t Test
39 Using MS Excel: Spending on Wine (cont’d)
In the printout, the calculated t-statistic is
-1.059287941. Why is it negative?
Answer: The amount spent on wine by women is less
than that spent by men (although the difference is not
statistically significant). If you make men the first
variable the t-value will be positive but the results will be
exactly the same (the t-distribution is symmetric).
What would the calculated t-value have to be for
us to reject it?
Answer: If a two-tail test is being done, the critical value
of t is 2.036931619. To reject the null hypothesis, we
would need a calculated t-value of more than
2.036931619 or less than -2.036931619.
Two-Sample t Test
40 Using MS Excel: Job Satisfaction
Comparing men and women on job
satisfaction
10 is the highest job satisfaction score; 0 the
lowest
MEN WOMEN
7 1 1 4
8 7 10 3
6 2 3 5
5 4 4 6
6 6 1 4
5 7 1 2
6 8 2 5
9 9 3 1
Two-Sample t Test
8 7 5 4
41 Using MS Excel: Job Satisfaction
(cont’d)
The output:
Variable 1 represents Men (n1 = 18)
Variable 2 represents Women (n2 = 18)
Two-Sample t Test
42 Using MS Excel: Job Satisfaction
(cont’d)
Question: It appears that men have more job satisfaction
than women at this firm. The company claims that a
sample of 36 is quite small given the fact that 5,000
people work at the company and they are asserting that
the difference is entirely due to sampling error. Given the
Excel printout above, what do you think?
Answer: If a two-tail test was done, the probability of
getting the sample evidence given that there is no
difference in the population means of job satisfaction
scores for men and women is .0012. In another words, if
men and women feel the same about working in this
firm, there is only a 12 out of 10,000 chance of getting
the sample evidence we obtained (or worse - one
showing an even larger difference). Statisticians usually
test at an alpha of .05 so we are going to reject the null
hypothesis.
Two-Sample t Test
43 Using MS Excel: Job Satisfaction
(cont’d)
The average job satisfaction score for men is 6.17
(rounded) and 3.56 for women. This is a difference of about
2.61 in satisfaction on the 0 to 10 scale.
If men and women in the firm actually have the same job
satisfaction (i.e., the difference between the population
means is actually 0), the likelihood of getting a difference
between two sample means of men and women of 2.61 or
greater is .0012. This is why we will reject HO that the two
population means are the same.
Conclusion: Reject HO. There is a statistically significant
difference between the average job satisfaction scores of
men and women at this firm.
Two-Sample t Test
44
REFERENCE BOOK
Engineering Statistics (5th ed.), by Douglas C.
Montgomery, George C. Runger, Norma F. Hubele,
John Wiley, New York, NY (2012).