You are on page 1of 2

> modul <- read.table(file="C:/data/modul.

txt",head=TRUE)

> modul
sebelum sesudah
1 18 22
2 21 25
3 16 17
4 22 24
5 19 16
6 24 29
7 17 20
8 21 23
9 23 19
10 18 20
11 14 15
12 16 15
13 16 18
14 19 26
15 18 18
16 20 24
17 12 18
18 22 25
19 15 19
20 17 16

> X <- modul

>X
sebelum sesudah
1 18 22
2 21 25
3 16 17
4 22 24
5 19 16
6 24 29
7 17 20
8 21 23
9 23 19
10 18 20
11 14 15
12 16 15
13 16 18
14 19 26
15 18 18
16 20 24
17 12 18
18 22 25
19 15 19
20 17 16

> n <- nrow(X)

>n
[1] 20

> p <- ncol(X)

>p
[1] 2

> xbar <- colMeans(X)

> xbar
sebelum sesudah
18.40 20.45

>
> t.test(modul$sesudah, modul$sebelum,alternative = "greater", mu = 0,paired=TRUE)
Paired t-test

data: modul$sesudah and modul$sebelum


t = 3.2313, df = 19, p-value = 0.002197
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
0.9529882 Inf
sample estimates:
mean of the differences
2.05

> t.test(modul$sesudah, modul$sebelum,alternative = "two.sided", mu = 0,paired=TRUE)


Paired t-test

data: modul$sesudah and modul$sebelum


t = 3.2313, df = 19, p-value = 0.004395
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
0.7221251 3.3778749
sample estimates:
mean of the differences
2.05

>

You might also like