library(BSDA)
## Loading required package: lattice
##
## Attaching package: 'BSDA'
## The following object is masked from 'package:datasets':
##
## Orange
Nomor 1
- Penghasilan perbulan karyawan pada sebuah perusahaan diketahui menyebar normal dengan simpangan baku Rp 600.000,-. Jika diambil sebanyak 16 contoh acak dari populasi tersebut, diperoleh rata-rata Rp 1.200.000,-. Tentukan selang kepercayaan 95% bagi nilai tengah populasi karyawan perusahaan tersebut
zsum.test(mean.x=1200000,sigma.x=600000, n.x=16, alternative="two.sided", conf.level = 0.95)
##
## One-sample z-Test
##
## data: Summarized x
## z = 8, p-value = 1.244e-15
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 906005.4 1493994.6
## sample estimates:
## mean of x
## 1200000
Nomor 2
tsum.test(mean.x=254, s.x = 3, n.x = 18, mean.y = 225, s.y = 2,
n.y = 27, alternative = "greater", var.equal = TRUE,
conf.level = 0.95)
##
## Standard Two-Sample t-Test
##
## data: Summarized x and y
## t = 38.983, df = 43, p-value < 2.2e-16
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 27.74943 NA
## sample estimates:
## mean of x mean of y
## 254 225
Nomor 3
<-c(57,69,56,67, 55, 56, 62, 67, 67, 56)
before<-c(55, 70, 56, 65, 54, 55, 64, 65, 67, 54)
aftert.test(before,after,paired=TRUE, alternative="greater", mu=0.5)
##
## Paired t-test
##
## data: before and after
## t = 0.44598, df = 9, p-value = 0.3331
## alternative hypothesis: true difference in means is greater than 0.5
## 95 percent confidence interval:
## -0.1220671 Inf
## sample estimates:
## mean of the differences
## 0.7
Nomor 4
tsum.test(mean.x=25, s.x = 6.4, n.x = 20, mean.y = NULL, mu=20, s.y = NULL, n.y = NULL, alternative = "two.sided", var.equal = TRUE,
conf.level = 0.95)
##
## One-sample t-Test
##
## data: Summarized x
## t = 3.4939, df = 19, p-value = 0.002429
## alternative hypothesis: true mean is not equal to 20
## 95 percent confidence interval:
## 22.00471 27.99529
## sample estimates:
## mean of x
## 25
Nomor 5
<-c(4.5, 5.0, 4.8, 4.0, 4.0, 3.9, 3.6, 4.8, 3.8)
IR64<-c(6.4, 5.9, 7.0, 6.5, 6.2, 8.0, 4.2, 3.8,
MSP4.0, 2.5, 5.8, 3.6)
tsum.test(mean.x=mean(IR64), s.x = sd(IR64), n.x = length(IR64), mean.y = mean(MSP), s.y = sd(MSP), n.y = length(MSP), mu=2, alternative = "two.sided", var.equal = TRUE,
conf.level = 0.95)
##
## Standard Two-Sample t-Test
##
## data: Summarized x and y
## t = -5.3258, df = 19, p-value = 3.86e-05
## alternative hypothesis: true difference in means is not equal to 2
## 95 percent confidence interval:
## -2.2602512 0.1435846
## sample estimates:
## mean of x mean of y
## 4.266667 5.325000
Nomor 6
<-c(4.8, 4, 5, 4.6, 5.4, 4.9, 4.3, 5.2, 5.1, 4.7, 5.4, 5.8)
X1<-c(5.5,4.1,5.2,4.5,5,5.3,4.8,4.5,6,4.7,5.3,5.4)
X2t.test(X1,X2,paired=TRUE, alternative="greater")
##
## Paired t-test
##
## data: X1 and X2
## t = -0.66753, df = 11, p-value = 0.7409
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -0.3382811 Inf
## sample estimates:
## mean of the differences
## -0.09166667
Nomor 7
tsum.test(mean.x=520000, s.x = 90000, n.x = 20, mean.y = NULL, mu=500000, s.y = NULL, n.y = NULL, alternative = "greater", var.equal = TRUE,
conf.level = 0.95)
##
## One-sample t-Test
##
## data: Summarized x
## t = 0.99381, df = 19, p-value = 0.1664
## alternative hypothesis: true mean is greater than 5e+05
## 95 percent confidence interval:
## 485201.9 NA
## sample estimates:
## mean of x
## 520000
Nomor 8
#a.
tsum.test(mean.x=14.93, s.x = 1.781, n.x = 22, mu=16, mean.y = NULL, s.y = NULL, n.y = NULL, alternative = "less", var.equal = TRUE,
conf.level = 0.95)
##
## One-sample t-Test
##
## data: Summarized x
## t = -2.8179, df = 21, p-value = 0.005153
## alternative hypothesis: true mean is less than 16
## 95 percent confidence interval:
## NA 15.58338
## sample estimates:
## mean of x
## 14.93
#b
tsum.test(mean.x=21.66, s.x = 2.386, n.x = 12, mean.y = 20.68, s.y = 1.985, n.y = 10, alternative = "two.sided", var.equal = TRUE,
conf.level = 0.95)
##
## Standard Two-Sample t-Test
##
## data: Summarized x and y
## t = 1.0335, df = 20, p-value = 0.3137
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.9979425 2.9579425
## sample estimates:
## mean of x mean of y
## 21.66 20.68
#c
Nomor 9
tsum.test(mean.x=40, s.x = 6, n.x = 10, mean.y = 50, s.y = 10.2, n.y = 10, alternative = "two.sided", var.equal = TRUE,
conf.level = 0.90)
##
## Standard Two-Sample t-Test
##
## data: Summarized x and y
## t = -2.6722, df = 18, p-value = 0.01554
## alternative hypothesis: true difference in means is not equal to 0
## 90 percent confidence interval:
## -16.489199 -3.510801
## sample estimates:
## mean of x mean of y
## 40 50
Nomor 10
prop.test(28, 90, p = 0.25, alternative = "two.sided",
correct = TRUE)
##
## 1-sample proportions test with continuity correction
##
## data: 28 out of 90, null probability 0.25
## X-squared = 1.4815, df = 1, p-value = 0.2235
## alternative hypothesis: true p is not equal to 0.25
## 95 percent confidence interval:
## 0.2199763 0.4185873
## sample estimates:
## p
## 0.3111111
Nomor 11
tsum.test(mean.x=37900, s.x = 5100, n.x = 12, mean.y = 39800, s.y = 5900, n.y = 12, alternative = "two.sided", var.equal = FALSE,
conf.level = 0.95)
##
## Welch Modified Two-Sample t-Test
##
## data: Summarized x and y
## t = -0.84396, df = 21.549, p-value = 0.408
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -6574.576 2774.576
## sample estimates:
## mean of x mean of y
## 37900 39800
Nomor 12
<-c(57,69,56,67, 55, 56, 62, 67, 67, 56)
before<-c(55, 70, 56, 65, 54, 55, 64, 65, 67, 54)
aftert.test(before,after,paired=TRUE, alternative="greater", mu=0.5)
##
## Paired t-test
##
## data: before and after
## t = 0.44598, df = 9, p-value = 0.3331
## alternative hypothesis: true difference in means is greater than 0.5
## 95 percent confidence interval:
## -0.1220671 Inf
## sample estimates:
## mean of the differences
## 0.7
Nomor 13
= 163.5
xbar= 162
mu0 = 6
sig = 100
n = (xbar-mu0)/(sig/sqrt(n))
z z
## [1] 2.5
= .05
alpha = qnorm(1-alpha)
z.alpha z.alpha
## [1] 1.644854
pnorm(z, lower.tail=FALSE)
## [1] 0.006209665
Nomor 14
prop.test(15, 40, p = 0.4, alternative = "two.sided",
correct = FALSE)
##
## 1-sample proportions test without continuity correction
##
## data: 15 out of 40, null probability 0.4
## X-squared = 0.10417, df = 1, p-value = 0.7469
## alternative hypothesis: true p is not equal to 0.4
## 95 percent confidence interval:
## 0.2422298 0.5296756
## sample estimates:
## p
## 0.375
Nomor 15
prop.test(x = c(275, 100), n = c(500, 250), alternative="greater", correct=FALSE)
##
## 2-sample test for equality of proportions without continuity
## correction
##
## data: c(275, 100) out of c(500, 250)
## X-squared = 15, df = 1, p-value = 5.376e-05
## alternative hypothesis: greater
## 95 percent confidence interval:
## 0.08725794 1.00000000
## sample estimates:
## prop 1 prop 2
## 0.55 0.40
Nomor 16
<-c(100,250,150,200,300,275,170,210)
before<-c(250,300,135,250,350,250,150,200)
aftert.test(before,after,paired=TRUE, alternative="greater")
##
## Paired t-test
##
## data: before and after
## t = -1.3679, df = 7, p-value = 0.8932
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -68.56957 Inf
## sample estimates:
## mean of the differences
## -28.75
Nomor 17
#a
<-c(68,79,58,65,89,72,69,56,58,54,65,61,50,57)
before<-c(60,76,52,60,78,73,67,52,54,55,61,56,52,50)
aftert.test(before,after,paired=TRUE, alternative="greater", mu=2, correct=FALSE)
##
## Paired t-test
##
## data: before and after
## t = 1.9901, df = 13, p-value = 0.03402
## alternative hypothesis: true difference in means is greater than 2
## 95 percent confidence interval:
## 2.212348 Inf
## sample estimates:
## mean of the differences
## 3.928571
#b
tsum.test(mean.x=4.86, s.x = 3.98, n.x = 7, mean.y = 3, s.y = 3.27, n.y = 7, alternative = "two.sided", var.equal = TRUE,
conf.level = 0.95)
##
## Standard Two-Sample t-Test
##
## data: Summarized x and y
## t = 0.95536, df = 12, p-value = 0.3582
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -2.38196 6.10196
## sample estimates:
## mean of x mean of y
## 4.86 3.00
Nomor 18
<-c(45,50,38,48,38,40,48)
sedang<-c(60,55,47,46,35,38,50)
tinggit.test(sedang,tinggi,paired=TRUE, alternative="two.sided", var.equal=FALSE)
##
## Paired t-test
##
## data: sedang and tinggi
## t = -1.353, df = 6, p-value = 0.2248
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -9.629342 2.772199
## sample estimates:
## mean of the differences
## -3.428571
Nomor 19
tsum.test(mean.x=1, s.x = 0.5, n.x = 10, mean.y = 1.7, s.y = 0.8, n.y = 10, alternative = "two.sided", var.equal = TRUE,
conf.level = 0.95)
##
## Standard Two-Sample t-Test
##
## data: Summarized x and y
## t = -2.3464, df = 18, p-value = 0.0306
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.32676529 -0.07323471
## sample estimates:
## mean of x mean of y
## 1.0 1.7
Nomor 20
= 203
xbar= 200
mu0 = 16
sig = 25
n = (xbar-mu0)/(sig/sqrt(n))
z z
## [1] 0.9375
= .05
alpha = qnorm(1-alpha)
z.alpha z.alpha
## [1] 1.644854
pnorm(z, lower.tail=FALSE)
## [1] 0.1742507
Nomor 21
prop.test(11, 200, p = 0.1, alternative = "two.sided",
correct = FALSE)
##
## 1-sample proportions test without continuity correction
##
## data: 11 out of 200, null probability 0.1
## X-squared = 4.5, df = 1, p-value = 0.03389
## alternative hypothesis: true p is not equal to 0.1
## 95 percent confidence interval:
## 0.03098534 0.09578700
## sample estimates:
## p
## 0.055
Nomor 22
<-c(4.6,5.0,4.7,4.1,4.0,3.8,3.6,4.8,3.8,4.2)
PakanA<-c(6.5,5.9,7.0,6.4,6.3,8.0,4.6,3.9,4.2,4.5,5.8,3.9)
PakanBt.test(PakanA,PakanB,paired=FALSE, alternative="less", var.equal=TRUE)
##
## Two Sample t-test
##
## data: PakanA and PakanB
## t = -2.9575, df = 20, p-value = 0.003892
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf -0.5516185
## sample estimates:
## mean of x mean of y
## 4.260000 5.583333
Nomor 23
zsum.test(mean.x=350000,sigma.x=1500, n.x=12, alternative="two.sided", conf.level = 0.90)
##
## One-sample z-Test
##
## data: Summarized x
## z = 808.29, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 90 percent confidence interval:
## 349287.8 350712.2
## sample estimates:
## mean of x
## 350000
Nomor 24
tsum.test(mean.x=32, s.x = 8.6, n.x = 25, mean.y = NULL, mu=30, s.y = NULL, n.y = NULL, alternative = "two.sided", var.equal = TRUE,
conf.level = 0.90)
##
## One-sample t-Test
##
## data: Summarized x
## t = 1.1628, df = 24, p-value = 0.2563
## alternative hypothesis: true mean is not equal to 30
## 90 percent confidence interval:
## 29.05728 34.94272
## sample estimates:
## mean of x
## 32
Nomor 25
<-c(112, 75, 119, 94, 91, 94, 93, 76, 88, 96)
solusi1<-c(82, 86, 100, 97, 88, 89, 86, 83, 89, 97, 86, 85, 81, 101)
solusi2tsum.test(mean.x=mean(solusi1), s.x = sd(solusi1), n.x = length(solusi1), mean.y = mean(solusi2), s.y = sd(solusi2), n.y = length(solusi2), alternative = "two.sided", var.equal = TRUE, conf.level = 0.95)
##
## Standard Two-Sample t-Test
##
## data: Summarized x and y
## t = 1.0737, df = 22, p-value = 0.2946
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -4.204936 13.233507
## sample estimates:
## mean of x mean of y
## 93.80000 89.28571
Badan Informasi Geospasial,abdul.aziz@big.go.id↩︎