- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
跟进 this question ,我正在尝试制作箱线图和成对比较以再次显示显着性水平(仅针对重要的成对),但这次我有超过 2 个组要比较和更复杂的方面。
我将在此处使用 iris 数据集进行说明。检查下面的 MWE,我在其中添加了一个额外的“治疗”变量。
library(reshape2)
library(ggplot2)
data(iris)
iris$treatment <- rep(c("A","B"), length(iris$Species)/2)
mydf <- melt(iris, measure.vars=names(iris)[1:4])
ggplot(mydf, aes(x=variable, y=value, fill=Species)) + geom_boxplot() +
stat_summary(fun.y=mean, geom="point", shape=5, size=4) +
facet_grid(treatment~Species, scales="free", space="free_x") +
theme(axis.text.x = element_text(angle=45, hjust=1))
这会产生以下情节:
想法是对“可变”组(Sepal.Length、Sepal.Width、Petal.Length、Petal.Width)执行 Kruskal-Wallis 检验,并在它们之间进行成对的 Wilcoxon 检验,PER FACET 定义为“物种”和“治疗”。
这很可能涉及更新注释,就像我之前的问题一样。
换句话说,我想做与 this other question 中相同的事情我发布了,但是 PER FACET。
虽然解决方案应该非常相似,但我感到非常困惑和卡住……任何帮助将不胜感激!谢谢!!
最佳答案
你可以试试
library(ggsignif)
ggplot(mydf,aes(x=variable, y=value)) +
geom_boxplot(aes(fill=Species)) + # define the fill argument here
facet_grid(treatment~Species) +
ylim(0,15)+
theme(axis.text.x = element_text(angle=45, hjust=1)) +
geom_signif(test="wilcox.test", comparisons = combn(levels(mydf$variable),2, simplify = F)[-4],
step_increase = 0.2)
Kruskal.wallis 可以通过添加
library(ggpubr)
stat_compare_means(test="kruskal.test")
关于R ggplot2 : boxplots with significance level (more than 2 groups: kruskal. 测试和 wilcox.test 成对)和多个方面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46446392/
这是测试的正常输出: attach(airquality) pw <- pairwise.wilcox.test(Ozone, Month, p.adj = "bonf") pw data: Ozo
我在 r 中有一个名为 tbl 的数据表。我想执行 wilcox 检验以将表中的每一列与其他每一列进行比较,并将 p 值存储在新表或矩阵中。 要比较一对列(在本例中为 1 和 2),我通常会这样做
x <- c(9, 5, 9 ,10, 13, 8, 8, 13, 18, 30) y <- c(10, 6, 9, 8, 11, 4, 1, 3, 3, 10) wilcox.test(y,x, p
我目前正在尝试对多个数据集实现 Wilcoxon Ranksum 测试,我已将这些数据集组合成一个大矩阵 A,即 705x17635 (即我想要运行ranksum测试17,635次。我所见过的不使用f
我正在尝试在 R 中使用 wilcox.test 进行显着性测试。我想基本上测试一个值 x 是否在分布内/外显着 d. 我正在执行以下操作: d = c(90,99,60,80,80,90,90,54
我的数据集包含 cb wilcox_pvals # WC Ana Clo # AB 0.7380622 0.52909692 0.75835096 #
必须有 R-ly 方式来调用 wilcox.test使用 group_by 并行进行多个观察。我花了很多时间阅读这篇文章,但仍然无法确定调用 wilcox.test 的电话。就可以了。下面的示例数据和
我有一个数据框,其中包含一个分组因子(第一列),具有多个级别(两个以上)和多个包含数据的列。我想将 wilcox.test 应用于整个日期框架以将每个组变量与其他变量进行比较。我怎样才能做到这一点?
我想用一个简单(但糟糕)的数据集做一个简单的成对 wilcox 测试。我有 8 个组,每个组有 5 个值(见下面的数据)。这些组位于“id”列中,感兴趣的变量(在本例中为权重)位于“weight”中。
在试图找出哪个更好用时,我遇到了两个问题。 1) wilcox.test 给出的 W 统计量与 coin::wilcox_test 的不同。这是我的输出: wilcox_test: Exact Wil
我使用 WRS2 对我的数据集运行双向方差分析和事后测试。然而在对比中我找不到我需要的比较。是否可以计划我自己的对比? 最佳答案 不幸的是,看起来对比度是硬编码在 mcp2atm 函数中的。该函数的一
为什么在 R 中将“公式”用作 wilcox.test 的关键字参数时会出现错误?文档说它有一个“公式”参数。 df = data.frame(A=rnorm(10), D=sample(c('p',
python 的 scipy.stats.ranksums 和 R 的 wilcox.test 都应该计算 Wilcoxon 秩和检验的双侧 p 值。但是,当我对同一数据运行这两个函数时,我得到的 p
我正在使用这个示例 data.frame 和代码。我想在两组之间进行多次测试,但是当一组中没有数据时,就会导致错误。如何在没有两组的情况下跳过比较并仍然在其他组上运行代码? library(dply
跟进 this question ,我正在尝试制作箱线图和成对比较以再次显示显着性水平(仅针对重要的成对),但这次我有超过 2 个组要比较和更复杂的方面。 我将在此处使用 iris 数据集进行说明。检
我是一名优秀的程序员,十分优秀!