A. Persiapan
A.1 Instalasi Package R yang diperlukan
# Menentukan Lokasi Mirror, di Indonesia ada di BPPT
r <- getOption("repos")
r["CRAN"] <- "https://repo.bppt.go.id/cran/"
options(repos = r)
# Nama Package yang diperlukan
packages <- c('readxl', 'agricolae')
# Fungsi Cek Apakah Package ada? Jika tidak ada, maka Install. Jika Sudah Di install maka Load!
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
## Loading required package: readxl
## Loading required package: agricolae
A.2 Data
Silahkan unduh data yang diperlukan KLIK SINI untuk DOWNLOAD Data One Way Anova. Lalu tempatkan pada Folder yang sesuai. Kalau di Tutorial ini, diletakkan di Drive E
dengan nama Folder R
B. Contoh 1 : Nilai Siswa SMA berdasarkan Tempat Duduk
B.1 Akses R ke Data
## # A tibble: 24 x 2
## Grup Nilai
## <chr> <dbl>
## 1 Depan 82
## 2 Depan 83
## 3 Depan 97
## 4 Depan 93
## 5 Depan 55
## 6 Depan 67
## 7 Depan 53
## 8 Tengah 83
## 9 Tengah 78
## 10 Tengah 68
## # ... with 14 more rows
B.2 One Way Anova
## Df Sum Sq Mean Sq F value Pr(>F)
## Grup 2 1902 950.8 5.896 0.00928 **
## Residuals 21 3386 161.3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
B.3 Uji Lanjut
##
## Study: anova1 ~ "Grup"
##
## LSD t Test for Nilai
## P value adjustment method: hommel
##
## Mean Square Error: 161.2532
##
## Grup, means and individual ( 95 %) CI
##
## Nilai std r LCL UCL Min Max
## Belakang 53.50000 8.96023 8 44.16333 62.83667 38 66
## Depan 75.71429 17.63249 7 65.73297 85.69560 53 97
## Tengah 67.11111 10.94811 9 58.30842 75.91381 51 83
##
## Alpha: 0.05 ; DF Error: 21
## Critical Value of t: 2.079614
##
## Groups according to probability of means differences and alpha level( 0.05 )
##
## Treatments with the same letter are not significantly different.
##
## Nilai groups
## Depan 75.71429 a
## Tengah 67.11111 ab
## Belakang 53.50000 b
##
## Study: anova1 ~ "Grup"
##
## HSD Test for Nilai
##
## Mean Square Error: 161.2532
##
## Grup, means
##
## Nilai std r Min Max
## Belakang 53.50000 8.96023 8 38 66
## Depan 75.71429 17.63249 7 53 97
## Tengah 67.11111 10.94811 9 51 83
##
## Alpha: 0.05 ; DF Error: 21
## Critical Value of Studentized Range: 3.564625
##
## Groups according to probability of means differences and alpha level( 0.05 )
##
## Treatments with the same letter are not significantly different.
##
## Nilai groups
## Depan 75.71429 a
## Tengah 67.11111 ab
## Belakang 53.50000 b
C. Contoh 2 : Distorsi Suara Berdasarkan Lapisan Pita Suara
C.1 Akses R ke Data
## # A tibble: 22 x 2
## Lapisan Distorsi
## <chr> <dbl>
## 1 A 10
## 2 A 15
## 3 A 8
## 4 A 12
## 5 A 15
## 6 B 14
## 7 B 18
## 8 B 21
## 9 B 15
## 10 C 17
## # ... with 12 more rows
C.2 One Way Anova
contoh2$Lapisan<-as.factor(contoh2$Lapisan)
anova2<-aov(Distorsi~Lapisan, data=contoh2)
summary(anova2)
## Df Sum Sq Mean Sq F value Pr(>F)
## Lapisan 3 68 22.667 4.34 0.0181 *
## Residuals 18 94 5.222
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
C.3 Uji Lanjut
##
## Study: anova2 ~ "Lapisan"
##
## LSD t Test for Distorsi
## P value adjustment method: hommel
##
## Mean Square Error: 5.222222
##
## Lapisan, means and individual ( 95 %) CI
##
## Distorsi std r LCL UCL Min Max
## A 12 3.082207 5 9.852898 14.14710 8 15
## B 17 3.162278 4 14.599467 19.40053 14 21
## C 16 1.414214 7 14.185368 17.81463 14 18
## D 15 1.673320 6 13.039973 16.96003 12 17
##
## Alpha: 0.05 ; DF Error: 18
## Critical Value of t: 2.100922
##
## Groups according to probability of means differences and alpha level( 0.05 )
##
## Treatments with the same letter are not significantly different.
##
## Distorsi groups
## B 17 a
## C 16 a
## D 15 ab
## A 12 b
##
## Study: anova2 ~ "Lapisan"
##
## HSD Test for Distorsi
##
## Mean Square Error: 5.222222
##
## Lapisan, means
##
## Distorsi std r Min Max
## A 12 3.082207 5 8 15
## B 17 3.162278 4 14 21
## C 16 1.414214 7 14 18
## D 15 1.673320 6 12 17
##
## Alpha: 0.05 ; DF Error: 18
## Critical Value of Studentized Range: 3.996978
##
## Groups according to probability of means differences and alpha level( 0.05 )
##
## Treatments with the same letter are not significantly different.
##
## Distorsi groups
## B 17 a
## C 16 a
## D 15 ab
## A 12 b