Soal Latihan dari Buku Azen Bab 3
Soal 3.1
##soal no 3.1
#bagian a
p<-13/20
p
## [1] 0.65
a<-pbinom(13,20,prob=p)-pbinom(12,20,prob=p)
a
## [1] 0.1844012
#bagian b
#hipotesis alternative: p>0.4
stats::binom.test(13,20,p=0.4,alternative = "great",conf.level=0.95)
##
## Exact binomial test
##
## data: 13 and 20
## number of successes = 13, number of trials = 20, p-value = 0.02103
## alternative hypothesis: true probability of success is greater than 0.4
## 95 percent confidence interval:
## 0.4419655 1.0000000
## sample estimates:
## probability of success
## 0.65
#p value yang diperoleh lebih kecil dari alfa=5%
#sehingga tidak tolak H0
#dengan kata lain teknik pembelajaran baru lebih baik dalam
#meningkatkan pemahaman siswa terhadap matematika
Soal 3.3 : Repeat Problem 3.1 using score test
##soal nomor3.3
prop.test(13,20,alternative = "great",conf.level = 0.95, correct=TRUE)
##
## 1-sample proportions test with continuity correction
##
## data: 13 out of 20, null probability 0.5
## X-squared = 1.25, df = 1, p-value = 0.1318
## alternative hypothesis: true p is greater than 0.5
## 95 percent confidence interval:
## 0.4423272 1.0000000
## sample estimates:
## p
## 0.65
Soal 3.8
##soal nomor 3.8
#bagian a
#hipotesis alternatif: p>0.5
#bagian b
prop.test(120,200,p=0.5,alternative = "great",conf.level=0.95)
##
## 1-sample proportions test with continuity correction
##
## data: 120 out of 200, null probability 0.5
## X-squared = 7.605, df = 1, p-value = 0.00291
## alternative hypothesis: true p is greater than 0.5
## 95 percent confidence interval:
## 0.5395277 1.0000000
## sample estimates:
## p
## 0.6
#p-value=0.002 kurang dari alfa=0.05 sehinga tolak H0
#dengan kata lain klaim bahwa kandidat X akan mendapatkan suara
#mayoritas benar pada alfa 5%
#bagian c
#di R belum tersedia dg menggunakan uji sehingga menggunakan selang kepercayaan
DescTools::BinomCI(120,200,conf.level=0.95,method="wald")
## est lwr.ci upr.ci
## [1,] 0.6 0.5321049 0.6678951
#karena batas atas selang di atas 0.5 maka klaim bahwa kandidat
#X akan memperoleh suara mayoritas adalah benar pada alfa 5%
Soal 3.9
##nomor 3.9
#bagian a
DescTools::BinomCI(120,200,conf.level=0.95,method="wald")
## est lwr.ci upr.ci
## [1,] 0.6 0.5321049 0.6678951
#bagian b
DescTools::BinomCI(120,200,conf.level=0.99,method="wald")
## est lwr.ci upr.ci
## [1,] 0.6 0.5107707 0.6892293
#baik pada SK 95% maupun 99% menunjukkan bahwa batas bawah lebih dari 0.5
#oleh karena itu semakin memperkuat bahwa kandidat X akan memperoleh suara mayoritas
Soal 3.10
##nomor 3.10
#bagian a
new.teach<-c(25,30,30,14,1)
res<-chisq.test(new.teach,p=c(0.2,0.4,0.2,0.15,0.05))
res
##
## Chi-squared test for given probabilities
##
## data: new.teach
## X-squared = 12.017, df = 4, p-value = 0.01723
#p value yang dihasilkan <alfa 0.05 sehingga tolak H0
#dengan kata lain metode baru memiliki hasil yang berbeda
#dengan metode lama
#bagian b
#metode baruu memberikan nilai yang lebih besar karena jumlah
#yang mendapat nilai D dan E pada metode baru lebih
#sedikit jika dibanding metode lama
Soal 3.12 : Repeat Problem 3.10 using the likelihood ratio test.
#nomor 3.12
res2 <- c(new.teach, p=c(20,40,20,15,5))
DescTools::GTest(res2, correct = "none")
##
## Log likelihood ratio (G-test) goodness of fit test
##
## data: res2
## G = 76.793, X-squared df = 9, p-value = 6.988e-13
#hasil yang diperoleh adalah nilai p value<0.05 sehingga
#dengan kata lain metode baru dan metode lama memiliki
#hasil yang berbeda
Tugas
Silahkan dikerjakan secara mandiri soal berikut
Referensi
Azen M, Walker CM.2011. Categorical data analysis for the behavioral and social sciences. Newyork (US): Taylor & Fracis Group