F-test
Used for two groups variance comparison. Data must be normally distributed.
H0: the population variances are equal
H1: the population variances are not equal

var.test(len ~ supp, data = ToothGrowth)
## 
##  F test to compare two variances
## 
## data:  len by supp
## F = 0.6386, num df = 29, denom df = 29, p-value = 0.2331
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.3039488 1.3416857
## sample estimates:
## ratio of variances 
##          0.6385951

p-value > 0.05: accept HO, there is no statistically significantly different between the two variances

Bartlett’s test
Used for two or more groups variance comparison. Data must be normally distributed
Ho: All populations variances are equal
H1: At least two of them different

#1)Bartlett’s test with one independent variable
bartlett.test(weight ~ group, data = PlantGrowth)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  weight by group
## Bartlett's K-squared = 2.8786, df = 2, p-value = 0.2371
#p-value > 0.05 : accept HO, there is no  statistically significantly different for the three groups.
#2)Bartlett’s test with multiple independent variables
bartlett.test(len ~ interaction(supp,dose), data=ToothGrowth)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  len by interaction(supp, dose)
## Bartlett's K-squared = 6.9273, df = 5, p-value = 0.2261

p-value > 0.05 : accept HO, there is no statistically significantly different for the three groups.
Levene’s test
An alternative to Bartlett’s test for non-normally distributed data
Ho: All populations variances are equal
H1: At least two of them different

library(carData)
library(car)
#1)Levene's test with one independent variable
leveneTest(weight ~ group, data = PlantGrowth)
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  2  1.1192 0.3412
##       27
#p-value > 0.05 : accept HO, there is no  statistically significantly different for the three groups.
#2)Levene's test with multiple independent variables
leveneTest(len ~ interaction(supp, dose),data = ToothGrowth)
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  5  1.7086 0.1484
##       54

p-value > 0.05 : accept HO, there is no statistically significantly different for the three groups.
Fligner-Killeen’s test
A non-parametric test for non-normal data.
Ho: All populations variances are equal
H1: At least two of them different

fligner.test(weight ~ group, data = PlantGrowth)
## 
##  Fligner-Killeen test of homogeneity of variances
## 
## data:  weight by group
## Fligner-Killeen:med chi-squared = 2.3499, df = 2, p-value = 0.3088

p-value > 0.05 : accept HO, there is no statistically significantly different for the three groups.