################################################################################
# TUGAS : STATISTIK SOSIAL #
# NAMA : MAULIDA SYIFA #
# NIM : 2502056010 #
################################################################################
################################### BAB 8 ######################################
#UJI KESAMAAN RATA-RATA DARI DUA POPULASI UNTUK DATA BERPASANGAN DAN SALING BERHUBUNGAN (UJI t)#
#Penyelesaian dalam R untuk Uji Kesamaan Rata-Rata dari Dua Populasi untuk Data Berpasangan dan Saling Baerhubungan dengan Uji t#
data=read.csv("data_berpasangan.csv")
data
## X Y
## 1 78 100
## 2 75 95
## 3 67 70
## 4 77 90
## 5 70 90
## 6 72 90
## 7 78 89
## 8 74 90
## 9 77 100
t.test(data$Y, data$X, paired=TRUE)
##
## Paired t-test
##
## data: data$Y and data$X
## t = 7.6525, df = 8, p-value = 6.003e-05
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## 11.33381 21.11064
## sample estimates:
## mean difference
## 16.22222
#Uji Asumsi Normalitas dalam R#
data=read.csv("data_berpasangan.csv")
data
## X Y
## 1 78 100
## 2 75 95
## 3 67 70
## 4 77 90
## 5 70 90
## 6 72 90
## 7 78 89
## 8 74 90
## 9 77 100
selisih = data$Y - data$X
selisih
## [1] 22 20 3 13 20 18 11 16 23
qqnorm(selisih)
qqline(selisih)

library(nortest)
lillie.test(selisih)
##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: selisih
## D = 0.1682, p-value = 0.6544
library(tseries)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
jarque.bera.test(selisih)
##
## Jarque Bera Test
##
## data: selisih
## X-squared = 1.3935, df = 2, p-value = 0.4982