Two Sample t-Test: Lecture 17 - Moo K. Chung, Study notes of Mathematical Statistics

The process of conducting a two-sample t-test to determine if there is a significant difference between the means of two independent samples from normal distributions with equal population variance. The formula for the pooled estimator of the population variance, the test statistic, and the rejection region. An example is provided to illustrate the application of the test.

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-sul
koofers-user-sul 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Stat 312: Lecture 17
Two sample ttest
Moo K. Chung
November 9, 2004
1. Let X1,· · · , Xnand Y1,···, Ymbe two indepen-
dent samples from normal distributions with
the same population variance, i.e.
XiN(µX, σ2) and YjN(µY, σ2).
The pooled estimator of σis
S2
p=(n1)S2
X+ (m1)S2
Y
n+m2.
The test statistic for testing
H0:µX=µYvs. H1:µX6=µY
T=¯
X¯
Y(µXµY)
Spp1/n + 1/m tn+m2.
Reject H0if |T|> tα/2,n+m2.
Example. 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 normality and equal variance
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)
> Sp<-sqrt((5*var(x)+3*var(y))/8)
[1] 10.52824
> t=(mean(x)-mean(y))/(Sp*sqrt(1/5+1/3))
> t
[1] -0.6827026
> qt(0.05,8)
[1] -1.859548
2. Checking the equality of variance. This topic
will be discussed later in detail.
> var(x)
[1] 75.2
> var(y)
[1] 170.25
> var.test(x,y)
F test to compare two variances
... p-value = 0.3975
alternative hypothesis: true ratio of variances
is not equal to 1 95 percent confidence interval:
0.02967475 3.42920369
sample estimates: ratio of variances
0.4417034
The Welch-Satterthwaite ttest is an alternative to
the two sample t-test with equal variance, and is
used when the assumption that the two populations
have equal variances seems unreasonable. The prob-
lem with this method is that it is asymptotically a
t distribution.
>t.test(x,y,alternative="two.sided",
conf.level=0.9)
Welch Two Sample t-test
data:x and y t = -0.7073,df = 4.778
p-value = 0.5124 alternative
hypothesis: true difference in means
is not equal to 0 90 percent
confidence interval:
-20.361647 9.861647
Review problems. Compute a CI for µXµYin the
previous Example. Example 9.7

Partial preview of the text

Download Two Sample t-Test: Lecture 17 - Moo K. Chung and more Study notes Mathematical Statistics in PDF only on Docsity!

Stat 312: Lecture 17

Two sample t test

Moo K. Chung

[email protected]

November 9, 2004

  1. Let X 1 , · · · , Xn and Y 1 , · · · , Ym be two indepen- dent samples from normal distributions with the same population variance, i.e.

Xi ∼ N (μX , σ^2 ) and Yj ∼ N (μY , σ^2 ).

The pooled estimator of σ is

S^2 p = (n − 1)S X^2 + (m − 1)S Y^2 n + m − 2

The test statistic for testing

H 0 : μX = μY vs. H 1 : μX 6 = μY

T =

X¯ − Y¯ − (μX − μY ) Sp

√ 1 /n + 1/m

∼ tn+m− 2.

Reject H 0 if |T | > tα/ 2 ,n+m− 2. Example. 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 normality and equal variance 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) Sp<-sqrt((5var(x)+3var(y))/8) [1] 10. t=(mean(x)-mean(y))/(Sp*sqrt(1/5+1/3)) t [1] -0. qt(0.05,8) [1] -1.

  1. Checking the equality of variance. This topic will be discussed later in detail.

var(x) [1] 75.

var(y) [1] 170. var.test(x,y)

F test to compare two variances

... p-value = 0. alternative hypothesis: true ratio of variance is not equal to 1 95 percent confidence interv 0.02967475 3. sample estimates: ratio of variances

The Welch-Satterthwaite t test is an alternative to the two sample t-test with equal variance, and is used when the assumption that the two populations have equal variances seems unreasonable. The prob- lem with this method is that it is asymptotically a t distribution.

t.test(x,y,alternative="two.sided", conf.level=0.9) Welch Two Sample t-test data:x and y t = -0.7073,df = 4. p-value = 0.5124 alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval: -20.361647 9.

Review problems. Compute a CI for μX − μY in the previous Example. Example 9.