1、观察图形形状验证是否服从正态分布
t1_3_1 <- subset(a,Obesity==1,select = c("TChol","TG","LDL","HDL"))
t1_3_2 <- subset(a,Obesity==0,select = c("TChol","TG","LDL","HDL"))
library(vioplot) #小提琴图
vioplot(t1_3_1$TChol)
vioplot(t1_3_1$TG)#非参
vioplot(t1_3_1$LDL)
vioplot(t1_3_1$HDL)
ggqqplot(t1_3_1$LDL) #qq图
ggqqplot(t1_3_1$HDL)
hist(t1_3_2$TChol) #直方图
hist(t1_3_2$TG)
library(ggpubr) #密度图
ggdensity(t1_3_2$LDL)
ggdensity(t1_3_2$HDL)
t.test(TChol~Obesity,data = a) #t = -1.1699, df = 1107.4, p-value = 0.2423
wilcox.test(TG~Obesity,data=a) # p-value = 1.195e-06
t.test(LDL~Obesity,data = a) #t = -1.3824, df = 520.83, p-value = 0.1674
wilcox.test(HDL~Obesity,data=a) # p-value < 2.2e-16