Stat 312: Lecture 15
Twosample
t
test
Moo K. Chung
[email protected]
March 13, 2003
Concepts
1. Pooled sample variance:
S
2
p
=
(
n

1)
S
2
X
+ (
m

1)
S
2
Y
n
+
m

2
.
2. Let
X
1
,
· · ·
, X
n
and
Y
1
,
· · ·
, Y
m
be two indepen
dent samples from normal distributions with
the same population variance. The test statis
tic for testing
H
0
:
μ
X
=
μ
Y
vs.
H
1
:
μ
X
6
=
μ
Y
T
=
¯
X

¯
Y

(
μ
X

μ
Y
)
S
p
p
1
/n
+ 1
/m
∼
t
n
+
m

2
.
Reject
H
0
if

T

> t
α/
2
,n
+
m

2
.
Inclass problems
Example 1.
A study was conducted to compare the
weights of cats and dogs. Weights of cats: 20, 21,
35, 13, 21, 10.
Weights of dogs:
31, 10, 20, 40.
Assume that the population variance to be same for
both cats and dogs. Is there any difference between
the weights of cats and dogs?
> x<c(20,21,35,13,21,10)
> y<c(31,10,20,40)
> sqrt((5*var(x)+3*var(y))/8)
[1] 10.52824
> t=(mean(x)mean(y))/(10.53*sqrt(1/5+1/3))
> t
[1] 0.6827026
> qt(0.05,8)
[1] 1.859548
If you use R, it is very easy to do two sample hy
pothesis testing.
>t.test(x,y,alternative="two.sided",
var.equal=TRUE,conf.level=0.9)
Two Sample ttest
data:x and y t = 0.7725, df = 8,
pvalue = 0.462 alternative
hypothesis: true difference in means is not equal to
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '04
 Chung
 Statistics, Normal Distribution, Standard Deviation, Variance, Sample standard deviation, Moo K. Chung

Click to edit the document details