R, normality

Normality test

> install.packages("ggpubr") 
> library("ggpubr") 
> ggdensity(df$a) 
> shapiro.test(df$a) 

Shapiro-Wilk normality test 
data: df$a 
W = 0.85717, p-value = 0.01382

> ctrl_weight = PlantGrowth$weight[PlantGrowth$group=='ctrl'] 
> shapiro.test(ctrl_weight) 

Shapiro-Wilk normality test 

data: ctrl_weight 
W = 0.95668, p-value = 0.7475

Homogeneity of Variance Test

> install.packages("lawstat")
> library(lawstat)
> levene.test(df$a, df$b)

Modified robust Brown-Forsythe Levene-type test based on the absolute deviations from the median 
data: df$a 
Test Statistic = 0.51658, p-value = 0.8245

> 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

> bartlett.test(a~b, df)   

homogeneity of variances 
data: a by c 
Bartlett's K-squared = 0.054557, df = 1, p-value = 0.8153

> bartlett.test(PlantGrowth$weight, PlantGrowth$group) 

Bartlett test of homogeneity of variances 

data: PlantGrowth$weight and PlantGrowth$group 
Bartlett's K-squared = 2.8786, df = 2, p-value = 0.2371