(c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the...

24
(c) 2007 IUPUI SPEA K300 (439 2) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for equal variance Independent sample t-test: equal variance Independent sample t-test: unequal variance Comparing proportions

Transcript of (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the...

Page 1: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Outline

Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for equal variance Independent sample t-test: equal variance Independent sample t-test: unequal variance Comparing proportions

Page 2: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Type of the T-test

One-sample t-test compares one sample mean with a hypothesized value

Paired sample t-test (dependent sample) compares the means of two dependent variables

Independent sample t-test compares the means of two independent variablesEqual varianceUnequal variance

Page 3: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Z-test and T-test

When σ is known, not likely in most cases, conduct the z-test

When σ is not known, conduct the t-testWhat if N is large (large sample)? The z-

test and t-test produce almost the same result. Therefore, t-test is more useful and practical.

Most software packages support the t-test with p-values reported.

Page 4: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Comparison of the z-test and t-test

Q 3, p.410, Revenue of large business N=50, xbar=31.5, s=28.7, α=.05 H0: µ=25, Ha: µ≠25 Critical value: 1.96 (z), 2.01(t) p-value: .1094 (z) and .1158 (t) Test statistic: 1.601

601.1059.4

5.5

50

7.282550.31

n

xzx

)150(~601.1059.4

5.5

50

7.282550.31

t

n

sx

tx

Page 5: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Assumptions of the T-test

Normality, otherwise comparison is not valid. Nonparametric methods are used.

Independence of (between) samples, otherwise the paired t-test is used.

Equal Variance, otherwise the pooled variance is not valid and approximation of degrees of freedom is needed.

Page 6: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

One sample t-test

Compare a sample mean with a particular (hypothesized) value

H0: µ=c, Ha: µ≠c, where c is a particular value Degrees of freedom: n-1 This is exactly what we did for past two weeks

)1(~ nt

n

scx

tx

n

stxc

n

stx 2/2/

Page 7: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Paired sample t-test 1

Compare two paired (matched) samples. Ex. Compare means of pre- and post-

scores given a treatment. We want to know the effect of treatment.

Ex. Compare means of midterm and final exam of K300.

Each subject has data points (pre- and post, or midterm and final)

Page 8: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Paired sample t-test 2

Compute d=x1-x2 (order does not matter) H0: µd=c, Ha: µd≠c, where c is a particular value

(often 0) Degrees of freedom: n-1

n

dd i

1

)( 22

n

dds id

)1(~ nt

n

scd

td

d

n

stdc

n

std dd

2/2/

Page 9: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Paired sample t-test 3: Example

Example 9-13, p. 495. Cholesterol levels H0: µd=0, Ha: µd≠0 N=5, dbar=16.7, std err=25.4, Test size=.01, df=4, critical value=2.015 Test statistic is 1.61, which is smaller than CV Do not reject the null hypothesis. 1.61 is likely

when the null hypothesis is true.

)16(61.1~

6

4.2507.160

n

sd

td

d

Page 10: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test

Compare two independent samplesEx. Compare means of personal income

between Indiana and OhioEx. Compare means of GPA between

SPEA and Kelley SchoolEach variable include different subjects

that are not related at all

Page 11: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

How to get standard error?

If variances of two sample are equal, use the pooled variance.

Otherwise, you have to use individual variance to get the standard error of the mean difference (µ1-µ2)

How do we know two variances are equal?

(Folded form) F test is the answer.

Page 12: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

F-test for equal variance

Compute variances of two samples Conduct the F-test as follows. Larger variance should be the numerator so that F is

always greater than or equal to 1. Look up the F distribution table with two degrees of

freedom. If H0 of equal variance is not rejected, two samples

have the same variance.22

210 : H

)1,1(~2

2

SLS

L nnFs

s

Page 13: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test: Equal variance

Compare means of two independent samples that have the same variance

The null hypothesis is µ1-µ2=c (often 0) Degrees of freedom is n1+n2-2

2

)1()1(

2

)()(

21

222

211

21

222

2112

nn

snsn

nn

yyyys jipool

)2(~11

)(21

21

21

nnt

nns

yyt

pool

Page 14: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test: Equal variance

Example 9-10, p.484 X1bar=$26,800, s1=$600, n1=10 X2bar=$25,400, s2=$450, n2=8 F-test: F 1.78 is smaller than CV 4.82; do not

reject the null hypothesis of equal variance at the .01 level.

Therefore, we can use the pooled variance.

)18,110(78.1~450

6002

2

2

2

S

L

s

s

Page 15: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test: Equal variance

X1bar=$26,800, s1=$600, n1=10 X2bar=$25,400, s2=$450, n2=8 Since 5.47>2.58 and p-value <.01, reject the

H0 at the .01 level.

)2(~11

)(21

21

21

nnt

nns

xxt

pool

75.2910932810

450)18(600)110(

2

)1()1( 22

21

222

2112

nn

snsnspool

)2810(47.5~

8

1

10

15.539

)2540026800(

t

Page 16: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test: Unequal variance

Compare means of two independent samples that have different variances (if the null hypothesis of the F-test is rejected)

The null hypothesis is µ1-µ2=c (often 0) Individual variances need to be used Degrees of freedom is approximated; not

necessarily an integer

)(~

2

22

1

21

21iteSatterthwadft

n

s

n

s

xxt

Page 17: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test: Unequal variance

Approximation of degrees of freedom Not necessarily an integer

Satterthwait’s approximation (common) Cochran-Cox’s approximation Welch’s approximation

22

21

21

)1()1)(1(

)1)(1(

cncn

nndf iteSatterthwa

2221

21

121

nsns

nsc

Page 18: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test: Unequal variance

Example 9-9, p.483 X1bar=191, s1=38, n1=8 X2bar=199, s2=12, n2=10 F-test: F 10.03 (7, 9) is larger than CV 4.20,

indicating unequal variances. Reject H0 of equal variance at the .05 level.

Therefore, we have to use individual variances

)110,18(03.10~12

382

2

2

2

S

L

s

s

Page 19: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test: Unequal variance

Example 9-9, p.483 X1bar=191, s1=38, n1=8 X2bar=199, s2=12, n2=10 Test statistics |-.57| is small. Textbook uses CV 2.365 for 7 (8-1) degrees of

freedom and does not reject the null hypothesis However, we need the approximation of degrees of

freedom to get more reliable df.

)(57.~

10

12

8

38

19919122

2

22

1

21

21iteSatterthwadf

n

s

n

s

xxt

Page 20: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Independent sample t-test: Unequal variance

Example 9-9, p.483 X1bar=191, s1=38, n1=8 X2bar=199, s2=12, n2=10 -.57~t(8.1213), CV is about 2.306. Df is not 16 but 8 Therefore, do not reject the null hypothesis

22

21

21

)1()1)(1(

)1)(1(

cncn

nndf iteSatterthwa

1213.89261).110()9261.1)(18(

)110)(18(22

iteSatterthwadf

9261.1012838

83822

2

2221

21

121

nsns

nsc

Page 21: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Comparing proportions 1

Compare proportions of two binary variables The test statistic is normally distributed (not t

distribution) Think about normal approximation of a

binomial distribution when N is large.

)11)(ˆ1(ˆ

ˆˆ

21

21

nnpp

ppz

pooledpooled

2

22

1

11221

)ˆ1(ˆ)ˆ1(ˆˆˆ

n

pp

n

ppzpp

21

21

21

2211 ˆˆˆ

nn

nn

nn

pnpnp xxpooled

Page 22: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Comparing proportions 2

Example 9-15, p. 505, Vaccination ratesN1=34, n2=24, alpha=.05P1hat=.35=12/34, p2hat=.71=17/24P1pooled=(12+17)/(34+24)=.5Z |-2.7| is larger than CV 1.96, reject H0.

5.2434

1712ˆ

21

21

nn

nnp xxpooled

7.2)241341)(5.1(5.

71.35.

)11)(ˆ1(ˆ

ˆˆ

21

21

nnpp

ppz

pooledpooled

Page 23: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Comparing proportions 3

Proportions are represented by binary variables that have either 0 or 1.

The mean of a binary variable is a proportion

What if we conduct two independent sample t-test?

If N is large, z-test and t-test produce the same result.

Page 24: (c) 2007 IUPUI SPEA K300 (4392) Outline Type of t-test Z-test versus t-test Assumptions of the t-test One sample t-test Paired sample t-test F-test for.

(c) 2007 IUPUI SPEA K300 (4392)

Summary of Comparing Means

One sampleT-test

Onesample?

Dependent?

EqualVariance?

Two

Paired sampleT-test

Independentsample T-test

(Pooled variance)

Independent sampleT-test

(Approximation of d.f.)

Unequal

Independent

cH :0 0:0 dH 0: 210 H 0: 210 H

1ndf 1ndf 221 nndf edapproximatdf