Download - Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Transcript
Page 1: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Uji Satu Sampel

© 2002 Prentice-Hall, Inc. Chap 7-1

Page 2: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Skope

� Uji sebuah rata-rata ( known)

� Uji sebuah rata-rata ( unknown)

� Uji sebuah proporsi

σσ

© 2002 Prentice-Hall, Inc. Chap 7-2

Page 3: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Hypothesis?

� hypothesis adalah klaim

(assumsi)tentang parameterpopulasi

Saya klaim rata-rataIPK mhs unpad 3.5!µ =

© 2002 Prentice-Hall, Inc. Chap 7-3

populasi

© 1984-1994 T/Maker Co.

Page 4: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Hypothesis Testing Process

Idetifikasi Populasi

Asumsi Usia populasi

adalah 50.( )0 : 50H µ =

© 2002 Prentice-Hall, Inc. Chap 7-4

( )

REJECT

Ambil Sampel

Null Hypothesis

No, not likely!X 20 likely if Is ?µ= = 50

0 : 50H µ =

( )20X =

Page 5: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Distribution Sampling

Alasan Rejecting H0

X

© 2002 Prentice-Hall, Inc. Chap 7-5

= 50µµµµ20If H0 is true

X

Klaim Kita

Sampel Kita

Page 6: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Level of Significance and the Rejection Region

H0: µµµµ ≥ ≥ ≥ ≥ 3 H1: µµµµ < 3

0

αααα

αααα

Critical Value(s)

Rejection Regions

© 2002 Prentice-Hall, Inc. Chap 7-6

0

0

H0: µµµµ ≤≤≤≤ 3 H1: µµµµ > 3

H0: µµµµ = = = = 3 H1: µµµµ ≠≠≠≠ 3

αααα

αααα/2

Regions

Page 7: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

One-tail Z Test for Mean( Known)

� Assumsi

� Population berdistribusi normal

� Z test statistic

σ

© 2002 Prentice-Hall, Inc. Chap 7-7

/X

X

X XZ

n

µ µσ σ− −= =

Page 8: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Rejection Region

Reject H0Reject H0

H0: µ ≥ µµ ≥ µµ ≥ µµ ≥ µ0H1: µµµµ < µµµµ0

H0: µ ≤ µµ ≤ µµ ≤ µµ ≤ µ0H1: µµµµ > µµµµ0

© 2002 Prentice-Hall, Inc. Chap 7-8

Z0

0

Z0Z Must Be SignificantlyBelow 0 to reject H0

Small values of Z don’t contradict H0

Don’t Reject H0 !

αα

Page 9: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Example Solution: One Tail Test

αααα = 0.5n = 9 σ = 60

H0: µ ≤ µ ≤ µ ≤ µ ≤ 300 H1: µµµµ > 300

© 2002 Prentice-Hall, Inc. Chap 7-9

n = 9 σ = 60

Page 10: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Example Solution: One Tail Test

αααα = 0.5n = 9 σ = 60

Test Statistic: H0: µ ≤ µ ≤ µ ≤ µ ≤ 300 H1: µµµµ > 300

1.50X

σ−= =

© 2002 Prentice-Hall, Inc. Chap 7-10

n = 9 σ = 60

Critical Value: 1.645

Decision:

Conclusion:Do Not Reject at α = .05

No evidence that true mean is more than 368

Z0 1.645

.05

Reject

1.50

Page 11: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

p -Value Solution

P-Value =.0668

Use the alternative

p-Value is P(Z ≥ ≥ ≥ ≥ 1.50) = 0.0668

© 2002 Prentice-Hall, Inc. Chap 7-11

Z0 1.50

P-Value =.0668

Z Value of Sample Statistic

From Z Table: Lookup 1.50 to Obtain .9332

alternative hypothesis to find the direction of the rejection region.

1.0000- .9332.0668

Page 12: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

p -Value Solution(continued)

(p-Value = 0.0668) ≥ ≥ ≥ ≥ (αααα = 0.05) Do Not Reject.

p Value = 0.0668

© 2002 Prentice-Hall, Inc. Chap 7-12

01.50

Z

Reject

αααα = 0.05

Test Statistic 1.50 is in the Do Not Reject Region

1.645

Page 13: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Example Solution: Two-Tail Test

αααα = 0.05n = 25 σ = 60

Test Statistic: H0: µ = µ = µ = µ = 300 H1: µ ≠µ ≠µ ≠µ ≠ 300

1.50X

σ−= =

© 2002 Prentice-Hall, Inc. Chap 7-13

n = 25 σ = 60

Critical Value: ±1.96

Decision:

Conclusion:

Do Not Reject at α = .05

No Evidence that True Mean is Not 300Z0 1.96

.025

Reject

-1.96

.025

1.50

Page 14: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

p-Value Solution

(p Value = 0.1336) ≥ ≥ ≥ ≥ (αααα = 0.05) Do Not Reject.

p Value = 2 x 0.0668

© 2002 Prentice-Hall, Inc. Chap 7-14

01.50 Z

Reject

αααα = 0.05

1.96

Test Statistic 1.50 is in the Do Not Reject Region

Reject

Page 15: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

R SOLUTION

� x=c(300,300,368,340,300,340,320,352,350)

� library(TeachingDemos)

� z.test(x, mu = 0, stdev, alternative = c("two.sided", "less", "greater"), sd = stdev,

© 2002 Prentice-Hall, Inc. Chap 7-15

c("two.sided", "less", "greater"), sd = stdev, conf.level = 0.95, ...)

� z.test(x, mu = 300, sd = 60, conf.level = 0.9, "two.sided")

Page 16: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

R Solution

Ztest=function(x,m0,alpha,sigma)

{

n=length(x)

Zhit=sqrt(n)*(mean(x)-m0)/sigma

© 2002 Prentice-Hall, Inc. Chap 7-16

Zhit=sqrt(n)*(mean(x)-m0)/sigma

Ztabel=qnorm(1-alpha/2)

pvalue=2*(1-pnorm(Zhit))

hasil=c(Zhit,Ztabel,pvalue)

names(hasil)=c("Zhit","Ztabel","Pvalue")

return(hasil)

}

Page 17: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

t Test: Unknown

� Assumsi

� Population berdistribusi normal

� T test statistic with n-1 degrees of freedom

σ

© 2002 Prentice-Hall, Inc. Chap 7-17

/

Xt

S n

µ−=

Page 18: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Example Solution: One-Tail

αααα = 0.01n = 9, df = 8

Test Statistic: H0: µ ≤ µ ≤ µ ≤ µ ≤ 300 H1: µ >µ >µ >µ > 300

nS

Xt

/

µ−= =3.48

© 2002 Prentice-Hall, Inc. Chap 7-18

3.48

2.896

n = 9, df = 8

Critical Value:

Decision:

Conclusion:

Reject at αααα = .01

that true mean is more than 300t80

.01

Reject

nS /

2.896

Page 19: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

p -Value Solution

(p Value is 0.00823) ≥≥≥≥ (αααα = 0.01). Reject H0.

p Value 0.00823

© 2002 Prentice-Hall, Inc. Chap 7-19

0 3.48 t8

Reject

p Value 0.00823

αααα = 0.01

Test Statistic 3.48 is in Reject Region

2.896

Page 20: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

R Solution

t.test(x, y = NULL, alternative = c("two.sided", "less", "greater"), mu = 0, paired = FALSE, var.equal = FALSE, conf.level = 0.95, ...)

t.test(x, alternative ="two.sided”, conf.level =

© 2002 Prentice-Hall, Inc. Chap 7-20

t.test(x, alternative ="two.sided”, conf.level = 0.95)

Page 21: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

R Solution

Ttest=function(x,m0,alpha){n=length(x)df=n-1Thit=sqrt(n)*(mean(x)-m0)/sd(x)

© 2002 Prentice-Hall, Inc. Chap 7-21

Thit=sqrt(n)*(mean(x)-m0)/sd(x)Ttabel=qt(1-alpha/2,df)pvalue=2*(1-pt(Thit,df))hasil=c(Thit,Ttabel,pvalue)names(hasil)=c("Thit","Ttabel","Pvalue")return(hasil)}

Page 22: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Uji sebuah proporsi

� Terdapat dua “outcomes”

� “Sukses” “Gagal”

Fraction atau proportion dari population in the

© 2002 Prentice-Hall, Inc. Chap 7-22

� Fraction atau proportion dari population in the “success” category didefinisikan sbg p

Page 23: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

Proportion

� Proporsi untuk kategori sukses dinotasikan pS�

(continued)

Number of Successes

Sample Sizes

Xp

n= =

© 2002 Prentice-Hall, Inc. Chap 7-23

� mean dan standard deviation

Sample Sizen

sp pµ = (1 )sp

p p

nσ −=

Page 24: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

( ) ( ).05 .04

1.141 .04 1 .04

500

Sp pZ

p p

n

− −≅ = =− −

Z Test for Proportion: Solution

ps= .05

n = 500

H0: p = = = = .04 H1: p ≠≠≠≠ .04

Test Statistic:

© 2002 Prentice-Hall, Inc. Chap 7-24

500nn = 500

Do not reject at α = .05Critical Values: ±±±± 1.96 Decision:

Conclusion:

Z0

Reject Reject

.025.025

1.96-1.961.14

We do not have sufficient evidence to reject the company’s claim of 4% response rate.

Page 25: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

p -Value Solution

(p Value = 0.6815189 ) ≥ ≥ ≥ ≥ (αααα = 0.05). Do Not Reject.

p Value = 2 x .1271

© 2002 Prentice-Hall, Inc. Chap 7-25

01.14

Z

Reject

αααα = 0.05

1.96

Test Statistic 1.14 is in the Do Not Reject Region

Reject

Page 26: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

R Solution

� prop.test(x, n, p = NULL, alternative = c("two.sided", "less", "greater"), conf.level = 0.95, correct = TRUE)

Prop.test(5,100,0.04, alternative =

© 2002 Prentice-Hall, Inc. Chap 7-26

� Prop.test(5,100,0.04, alternative = "two.sided", conf.level = 0.95)

Page 27: Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata ( known) Uji sebuah rata-rata ( unknown) Uji sebuah proporsi

R Solution

Ptest=function(ps,p0,alpha)

{

Zhit=(ps-p0)/sqrt(ps*(1-ps)/n)

Ztabel=qnorm(1-alpha/2)

© 2002 Prentice-Hall, Inc. Chap 7-27

Ztabel=qnorm(1-alpha/2)

pvalue=2*(1-pnorm(Zhit))

hasil=c(Zhit,Ztabel,pvalue)

names(hasil)=c("Zhit","Ztabel","Pvalue")

return(hasil)

}