27
Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1

hanhu
• Category

## Documents

• view

240

0

### Transcript of Uji Satu Sampel · Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1. Skope Uji sebuah rata-rata...

Uji Satu Sampel

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

Skope

� Uji sebuah rata-rata ( known)

� Uji sebuah rata-rata ( unknown)

� Uji sebuah proporsi

σσ

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

Hypothesis?

(assumsi)tentang parameterpopulasi

Saya klaim rata-rataIPK mhs unpad 3.5!µ =

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

populasi

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 =

Distribution Sampling

Alasan Rejecting H0

X

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

= 50µµµµ20If H0 is true

X

Klaim Kita

Sampel Kita

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

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

µ µσ σ− −= =

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 !

αα

Example Solution: One Tail Test

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

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

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

n = 9 σ = 60

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

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

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

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

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

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")

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)

}

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

µ−=

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

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

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)

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)}

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

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σ −=

( ) ( ).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.

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

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)

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)

}