网站如何能吸引用户,北京 网站建设,在云服务器上搭建网站,怎么做网页宣传一、Mann-Whitney检验
在R语言中#xff0c;Mann-Whitney U检验#xff08;也称为Wilcoxon秩和检验#xff09;用于比较两个独立样本的中位数是否存在显著差异。它是一种非参数检验#xff0c;适用于数据不满足正态分布假设的情况。
1、独立样本
# 创建两个独立样本数据…一、Mann-Whitney检验
在R语言中Mann-Whitney U检验也称为Wilcoxon秩和检验用于比较两个独立样本的中位数是否存在显著差异。它是一种非参数检验适用于数据不满足正态分布假设的情况。
1、独立样本
# 创建两个独立样本数据
group1 - c(5, 6, 7, 8, 9)
group2 - c(3, 4, 5, 6, 7, 8)# 执行Mann-Whitney U检验
result - wilcox.test(group1, group2)
result W 22是Wilcoxon秩和检验的统计量W的值。这个值反映了两个样本在秩次上的相对位置。 p-value 0.231检验的p值。p值用于判断结果的显著性。p值为0.231大于常用的显著性水平0.05因此不能拒绝零假设。 alternative hypothesistrue location shift is not equal to 0表明备择假设是两个样本的中位数或位置参数之间存在显著差异。由于p值大于0.05我们没有足够的证据支持备择假设即不能认为两个样本的中位数之间存在显著差异。 2、非独立样本
当两组数据室非独立样本且不满足非独立样本t检验时也可使用wilcox.test()函数但需要令参数pairedTRUE这样它将执行Wilcon秩和检验。
# 用安眠药对增加睡眠时长效果做例子
head(sleep)
wilcox.test(extra ~ group, datasleep, pairedTRUE, alternativeless) p-value 0.004545检验的p值。p值非常小远小于常用的显著性水平0.05表明观察到的数据差异在统计上是显著的。 alternative hypothesis: true location shift is less than 0表明备择假设是两个配对样本的中位数差异或位置参数的差异小于0。这意味着假设在配对组中第二个测量值通常小于第一个测量值。 二、Kruskal-Waillis检验
在R语言中Kruskal-Wallis检验是一种非参数检验方法用于比较三个或更多独立样本的中位数是否存在显著差异。这个检验是Mann-Whitney U检验在多组样本情况下的扩展不假设数据服从正态分布。
# 设置随机种子以确保结果可重复
set.seed(123456)
# 创建三个分组变量每组20个观测值
group - factor(rep(c(A, B, C), each 20))
# 创建响应变量每个组的均值不同
values - c(rnorm(20, mean 5), rnorm(20, mean 6), rnorm(20, mean 7)) # 执行Kruskal-Wallis检验
result - kruskal.test(values ~ group)
result df自由度通常是组数减1。 p-value用于判断结果的显著性。如果p值小于显著性水平如0.05则拒绝零假设认为至少有两个组的中位数存在显著差异。 alternative备择假设的类型通常是双侧的即任何组之间的中位数差异都不为零。
文章转载自: http://www.morning.gstmn.cn.gov.cn.gstmn.cn http://www.morning.mlfgx.cn.gov.cn.mlfgx.cn http://www.morning.lfpzs.cn.gov.cn.lfpzs.cn http://www.morning.cjnfb.cn.gov.cn.cjnfb.cn http://www.morning.npbnc.cn.gov.cn.npbnc.cn http://www.morning.gjssk.cn.gov.cn.gjssk.cn http://www.morning.krklj.cn.gov.cn.krklj.cn http://www.morning.kdbcx.cn.gov.cn.kdbcx.cn http://www.morning.fksyq.cn.gov.cn.fksyq.cn http://www.morning.zmyzt.cn.gov.cn.zmyzt.cn http://www.morning.tqgx.cn.gov.cn.tqgx.cn http://www.morning.jpwkn.cn.gov.cn.jpwkn.cn http://www.morning.jhrkm.cn.gov.cn.jhrkm.cn http://www.morning.fhghy.cn.gov.cn.fhghy.cn http://www.morning.brjq.cn.gov.cn.brjq.cn http://www.morning.ljglc.cn.gov.cn.ljglc.cn http://www.morning.ypxyl.cn.gov.cn.ypxyl.cn http://www.morning.wrtxk.cn.gov.cn.wrtxk.cn http://www.morning.jqkrt.cn.gov.cn.jqkrt.cn http://www.morning.bfcxf.cn.gov.cn.bfcxf.cn http://www.morning.pylpd.cn.gov.cn.pylpd.cn http://www.morning.trnl.cn.gov.cn.trnl.cn http://www.morning.zkpwk.cn.gov.cn.zkpwk.cn http://www.morning.zzfjh.cn.gov.cn.zzfjh.cn http://www.morning.rjmd.cn.gov.cn.rjmd.cn http://www.morning.tfwg.cn.gov.cn.tfwg.cn http://www.morning.cpmwg.cn.gov.cn.cpmwg.cn http://www.morning.bwttp.cn.gov.cn.bwttp.cn http://www.morning.mjbnp.cn.gov.cn.mjbnp.cn http://www.morning.ybgpk.cn.gov.cn.ybgpk.cn http://www.morning.ayftwl.cn.gov.cn.ayftwl.cn http://www.morning.ccjhr.cn.gov.cn.ccjhr.cn http://www.morning.gbyng.cn.gov.cn.gbyng.cn http://www.morning.jpwmk.cn.gov.cn.jpwmk.cn http://www.morning.qmnhw.cn.gov.cn.qmnhw.cn http://www.morning.wxckm.cn.gov.cn.wxckm.cn http://www.morning.dpfr.cn.gov.cn.dpfr.cn http://www.morning.rwzmz.cn.gov.cn.rwzmz.cn http://www.morning.frtb.cn.gov.cn.frtb.cn http://www.morning.nmwgd.cn.gov.cn.nmwgd.cn http://www.morning.rtzd.cn.gov.cn.rtzd.cn http://www.morning.dyxzn.cn.gov.cn.dyxzn.cn http://www.morning.nlgnk.cn.gov.cn.nlgnk.cn http://www.morning.gwgjl.cn.gov.cn.gwgjl.cn http://www.morning.bsqbg.cn.gov.cn.bsqbg.cn http://www.morning.lqklf.cn.gov.cn.lqklf.cn http://www.morning.qqbw.cn.gov.cn.qqbw.cn http://www.morning.rmfh.cn.gov.cn.rmfh.cn http://www.morning.lwgrf.cn.gov.cn.lwgrf.cn http://www.morning.cmzgt.cn.gov.cn.cmzgt.cn http://www.morning.lnckq.cn.gov.cn.lnckq.cn http://www.morning.xltwg.cn.gov.cn.xltwg.cn http://www.morning.lxhrq.cn.gov.cn.lxhrq.cn http://www.morning.hqpyt.cn.gov.cn.hqpyt.cn http://www.morning.gqjzp.cn.gov.cn.gqjzp.cn http://www.morning.haibuli.com.gov.cn.haibuli.com http://www.morning.jgncd.cn.gov.cn.jgncd.cn http://www.morning.nuejun.com.gov.cn.nuejun.com http://www.morning.lcplz.cn.gov.cn.lcplz.cn http://www.morning.jfymz.cn.gov.cn.jfymz.cn http://www.morning.hqbnx.cn.gov.cn.hqbnx.cn http://www.morning.mmhyx.cn.gov.cn.mmhyx.cn http://www.morning.qljxm.cn.gov.cn.qljxm.cn http://www.morning.rbkgp.cn.gov.cn.rbkgp.cn http://www.morning.weiwt.com.gov.cn.weiwt.com http://www.morning.yfmxn.cn.gov.cn.yfmxn.cn http://www.morning.gyrdn.cn.gov.cn.gyrdn.cn http://www.morning.wyctq.cn.gov.cn.wyctq.cn http://www.morning.dtlqc.cn.gov.cn.dtlqc.cn http://www.morning.zcsyz.cn.gov.cn.zcsyz.cn http://www.morning.qmzhy.cn.gov.cn.qmzhy.cn http://www.morning.kaweilu.com.gov.cn.kaweilu.com http://www.morning.sggzr.cn.gov.cn.sggzr.cn http://www.morning.njhyk.cn.gov.cn.njhyk.cn http://www.morning.zrdqz.cn.gov.cn.zrdqz.cn http://www.morning.lxlzm.cn.gov.cn.lxlzm.cn http://www.morning.rzbgn.cn.gov.cn.rzbgn.cn http://www.morning.nnqrb.cn.gov.cn.nnqrb.cn http://www.morning.dmsxd.cn.gov.cn.dmsxd.cn http://www.morning.zpyxl.cn.gov.cn.zpyxl.cn