循环T Wilcoxon检验

x <- c(20.99,20.41,20.10,20.00,20.91,22.60,20.99,20.42,20.90,22.99,23.12,20.89)

#判断数据是否服从某一分布
library(fitdistrplus)
descdist(x)
fitdist(x,"norm")
fitdist(x,'unif')
fitdist(x, "gamma")
fitdist(x, "exp")

# 正态性检验
shapiro.test(x)
#ks.test(x,"pnorm",mean(x),sd(x))

#T检验
#t.test(x, mu = 20.7 )
statistic <- c()
p <- c()
for (i in seq(1,length(x))) {
  statistic[i] <- t.test(x[-i],mu=x[i])$statistic
  p[i] <- t.test(x[-i],mu=x[i])$p.value
}


#Wilcoxon 符号秩检验
statistic <- c()
p <- c()
for (i in seq(1,length(x))) {
  statistic[i] <- wilcox.test(x[-i],mu=x[i])$statistic
  p[i] <- wilcox.test(x[-i],mu=x[i])$p.value
}

评论

此博客中的热门博文

V2ray websocket(ws)+tls+nginx分流

Rstudio 使用代理