美文网首页
R语言分组进行正态性检验

R语言分组进行正态性检验

作者: Whuer_deng | 来源:发表于2019-05-25 20:37 被阅读0次
方法一:tapply
with(iris,tapply(Sepal.Length, Species, shapiro.test)) #方法一
$setosa

    Shapiro-Wilk normality test

data:  X[[i]]
W = 0.9777, p-value = 0.4595


$versicolor

    Shapiro-Wilk normality test

data:  X[[i]]
W = 0.97784, p-value = 0.4647


$virginica

    Shapiro-Wilk normality test

data:  X[[i]]
W = 0.97118, p-value = 0.2583
方法二:with
 with(iris,by(Sepal.Length, Species, shapiro.test)) #方法二
Species: setosa

    Shapiro-Wilk normality test

data:  dd[x, ]
W = 0.9777, p-value = 0.4595

---------------------------------------------------------- 
Species: versicolor

    Shapiro-Wilk normality test

data:  dd[x, ]
W = 0.97784, p-value = 0.4647

---------------------------------------------------------- 
Species: virginica

    Shapiro-Wilk normality test

data:  dd[x, ]
W = 0.97118, p-value = 0.2583

相关文章

网友评论

      本文标题:R语言分组进行正态性检验

      本文链接:https://www.haomeiwen.com/subject/vznzzqtx.html