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

of 27/27
Uji Satu Sampel © 2002 Prentice-Hall, Inc. Chap 7-1
  • date post

    02-Mar-2019
  • Category

    Documents

  • view

    222
  • download

    0

Embed Size (px)

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?

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.

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

= 5020If 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 dont contradict H0

Dont 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

Z

= =

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

n

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

Z

= =

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

n

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 SizesX

pn

= =

2002 Prentice-Hall, Inc. Chap 7-23

mean dan standard deviation

Sample Sizen

spp = (1 )

sp

p p

n =

( ) ( ).05 .04

1.141 .04 1 .04

500

Sp pZp 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 companys 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)

}