尊敬的各位R语言的朋友,有个问题请教:
我在分析一个数据的每一列是否符合正态分布,因为正态分布检验一次只能检验一列数据,如果有多列数据需要检验,则需要运行多次,数据结构如下:
diagnosis F1_ShapeCompactness1 F1_ShapeCompactness2 F1_ShapeConvex F1_ShapeConvexHullVolume
1 3 -0.6082260 -0.4716234 -0.04256966 0.41542968
2 1 -0.8739602 -0.4461997 -0.04540545 -0.06083073
3 1 -1.0683939 -0.5854250 -0.07018161 -0.32101565
4 1 -0.3223201 -0.7408305 -0.05732012 1.05622575
5 1 -0.4515446 -0.8546835 -0.07743922 0.89721721
6 1 -1.0859284 -0.5042789 -0.04929866 -0.3921340
我想分析从第2列开始到第5列的数据是否符合正态分布,如果单独用如下
data <- read.csv("anovasample.csv", header = TRUE)
ks.test(F1_ShapeCompactness2,"pnorm")
把每一列变量输入后一共需要手工赋值操作4次,我尝试用for循环:
variableR=list(F1_ShapeCompactness1,F1_ShapeCompactness2,F1_ShapeConvex,F1_ShapeConvexHullVolume)
for (i in variableR){
Warning messages:ks.test(i,"pnorm")}
1: In ks.test(i, "pnorm") :
ties should not be present for the Kolmogorov-Smirnov test
2: In ks.test(i, "pnorm") :
ties should not be present for the Kolmogorov-Smirnov test
3: In ks.test(i, "pnorm") :
ties should not be present for the Kolmogorov-Smirnov test
4: In ks.test(i, "pnorm") :
ties should not be present for the Kolmogorov-Smirnov test
我想用shapiro.test():但是结果也不行for (i in variableR){
shapiro.test(i)}
哪个同学能够给我点建议~!?不甚感激!