# TUGAS BAB 7
# UJI KESAMAAN VARIANS POPULASI

# Nama : Tirza Abigail Theodora
# NIM  : 2502056040


simpan=read.csv2("varians.csv",header=TRUE)

simpan
##    Nilai Kelas
## 1     70     1
## 2     80     1
## 3     87     1
## 4     77     1
## 5     80     1
## 6     80     2
## 7     85     2
## 8     70     2
## 9     77     2
## 10    85     2
## 11    60     2
## 12    80     2
## 13    70     3
## 14    87     3
## 15    90     3
## 16    77     3
## 17    76     3
## 18    87     3
# ==========================================
# UJI LEVENE
# ==========================================

library(lawstat)

# Pendekatan Location = Median

levene.test(simpan[,"Nilai"],simpan[,"Kelas"],
            location="median",
            correction.method="zero.correction")
## 
##  Modified robust Brown-Forsythe Levene-type test based on the absolute
##  deviations from the median with modified structural zero removal method
##  and correction factor
## 
## data:  simpan[, "Nilai"]
## Test Statistic = 0.4372, p-value = 0.6557
# Pendekatan Location = Mean

levene.test(simpan[,"Nilai"],simpan[,"Kelas"],
            location="mean",
            correction.method="zero.correction")
## 
##  Classical Levene's test based on the absolute deviations from the mean
##  ( zero.correction not applied because the location is not set to median
##  )
## 
## data:  simpan[, "Nilai"]
## Test Statistic = 0.64903, p-value = 0.5366