Tabel berikut ini merupakan data hasil eksperimen tentang efek daya terhadap laju pemotongan bahan. Daya memiliki empat tarat yaitu 160W, 180W, 200W, dan 220W. Sedangkan laju pemotongan bahan diukur dalam satuan menit. Eksperimen menggunakan lima buah replikasi.
Penyusunan data dan analisis varians
perlakuan <- rep(c(1,2,3,4), each =5)
daya <- factor(perlakuan, levels = c(1,2,3,4), labels = c("160W","180W", "200W", "220W") )
laju <- c(575, 542, 530, 539, 570,
565, 593, 590, 579, 610,
600, 651, 610, 637, 629,
725, 700, 715, 685, 710)
dataeksp <- data.frame(daya, laju)
anv <- aov(laju ~ daya, data = dataeksp)
output <- anova(anv)
output
Analysis of Variance Table
Response: laju
Df Sum Sq Mean Sq F value Pr(>F)
daya 3 66871 22290.2 66.797 2.883e-09 ***
Residuals 16 5339 333.7
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Nilai yang diperlukan untuk uji lanjut
RJKE <- output$`Mean Sq`[2]
dkE <- output$Df[2]
k <- length(levels(daya)) # banyaknya taraf perlakuan
n <- 5 # banyaknya replikasi
library(agricolae)
tukey <- HSD.test(anv, "daya", alpha = 0.05, group = FALSE)
print(tukey)
$statistics
MSerror Df Mean CV MSD
333.7 16 617.75 2.957095 33.05438
$parameters
test name.t ntr StudentizedRange alpha
Tukey daya 4 4.046093 0.05
$means
laju std r Min Max Q25 Q50 Q75
160W 551.2 20.01749 5 530 575 539 542 570
180W 587.4 16.74216 5 565 610 579 590 593
200W 625.4 20.52559 5 600 651 610 629 637
220W 707.0 15.24795 5 685 725 700 710 715
$comparison
difference pvalue signif. LCL UCL
160W - 180W -36.2 0.0294 * -69.25438 -3.145624
160W - 200W -74.2 0.0000 *** -107.25438 -41.145624
160W - 220W -155.8 0.0000 *** -188.85438 -122.745624
180W - 200W -38.0 0.0216 * -71.05438 -4.945624
180W - 220W -119.6 0.0000 *** -152.65438 -86.545624
200W - 220W -81.6 0.0000 *** -114.65438 -48.545624
$groups
NULL
attr(,"class")
[1] "group"
Susun kontras
c1 <- c(1, -1, 0, 0)
c2 <- c(1, 1, -1, -1)
c3 <- c(0, 0, 1, -1)
contrastmat <- cbind(c1,c2,c3)
rataan <- aggregate(dataeksp$laju, by = list(dataeksp$daya), FUN = "mean")
C <- rataan$x %*% contrastmat
sigmac2 <- (1/n)*colSums(contrastmat^2)
F_hitung <- (C^2/sigmac2)/RJKE
Ftabel <- qf(1 - 0.05, 1, dkE)
F_hitung
c1 c2 c3
[1,] 9.817501 140.6894 49.88433
Ftabel
[1] 4.493998
# Susun kontras
c11 <- c(1, 1, -1, -1)
c22 <- c(1, 0, 0, -1)
matriks.c <- cbind(c11,c22)
colnames(matriks.c) <- c("c1","c2")
Cs <- rataan$x %*%matriks.c
SC <- sqrt(RJKE *(1/n)*colSums(matriks.c^2))
SCalpha <- SC * sqrt((k-1)*qf((1-0.01), (k - 1), (k*n) - k))
kesimpulan <- rep(0,2)
for (i in 1:2){
kesimpulan[i] <- if(abs(as.vector(Cs)[i]) > as.vector(SCalpha)[i]) {print('H0 ditolak')} else {print('H0 diterima')}
}
[1] "H0 ditolak"
[1] "H0 ditolak"
results <- data.frame(abs(as.vector(Cs)), SCalpha, kesimpulan)
colnames(results) <- c("| C |", "S.alpha", "Keputusan")
results
NA