通过箱线图判断偏向
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过箱线图判断偏向相关的知识,希望对你有一定的参考价值。
箱线图(Boxplot)也称箱须图(Box-whisker Plot),是利用数据中的五个统计量:最小值、第一四分位数、中位数、第三四分位数与最大值来描述数据的一种方法,它也可以粗略地看出数据是否具有有对称性,分布的分散程度等信息,特别可以用于对几个样本的比较。
在箱图中,最上方和最下方的线段分别表示数据的最大值和最小值,其中箱图的上方和下方的线段分别表示第三四分位数和第一四分位数,箱图中间的粗线段表示数据的中位数。另外,箱图中在最上方和最下方的星号和圆圈分别表示样本数据中的极端值。
数据的形状
同一数轴上,几批数据的箱形图并行排列,几批数据的中位数、尾长、异常值、分布区间等形状信息便一目了然。在一批数据中,哪几个数据点出类拔萃,哪些数据点表现不及一般,这些数据点放在同类其它群体中处于什么位置,可以通过比较各箱形图的异常值看出。各批数据的四分位距大小,正常值的分布是集中还是分散,观察各方盒和线段的长短便可明了。
以上内容参考:百度百科-箱形图
参考技术A 箱线图(Boxplot)也称箱须图(Box-whisker Plot),是利用数据中的五个统计量:最小值、第一四分位数、中位数、第三四分位数与最大值来描述数据的一种方法,它也可以粗略地看出数据是否具有有对称性,分布的分散程度等信息,特别可以用于对几个样本的比较。1.直观明了地识别数据批中的异常值
一批数据中的异常值值得关注,忽视异常值的存在是十分危险的,不加剔除地把异常值包括进数据的计算分析过程中,对结果会带来不良影响;重视异常值的出现,分析其产生的原因,常常成为发现问题进而改进决策的契机。箱线图为我们提供了识别异常值的一个标准:异常值被定义为小于Q1-1.5IQR或大于Q3+1.5IQR的值。虽然这种标准有点任意性,但它来源于经验判断,经验表明它在处理需要特别注意的数据方面表现不错。这与识别异常值的经典方法有些不同。众所周知,基于正态分布的3σ法则或z分数方法是以假定数据服从正态分布为前提的,但实际数据往往并不严格服从正态分布。它们判断异常值的标准是以计算数据批的均值和标准差为基础的,而均值和标准差的耐抗性极小,异常值本身会对它们产生较大影响,这样产生的异常值个数不会多于总数0.7%。显然,应用这种方法于非正态分布数据中判断异常值,其有效性是有限的。箱线图的绘制依靠实际数据,不需要事先假定数据服从特定的分布形式,没有对数据作任何限制性要求,它只是真实直观地表现数据形状的本来面貌;另一方面,箱线图判断异常值的标准以四分位数和四分位距为基础,四分位数具有一定的耐抗性,多达25%的数据可以变得任意远而不会很大地扰动四分位数,所以异常值不能对这个标准施加影响,箱线图识别异常值的结果比较客观。由此可见,箱线图在识别异常值方面有一定的优越性。
2.利用箱线图判断数据批的偏态和尾重
比较标准正态分布、不同自由度的t分布和非对称分布数据的箱线图的特征,可以发现:对于标准正态分布的大样本,只有 0.7%的值是异常值,中位数位于上下四分位数的中央,箱线图的方盒关于中位线对称。选取不同自由度的t分布的大样本,代表对称重尾分布,当t分布的自由度越小,尾部越重,就有越大的概率观察到异常值。以卡方分布作为非对称分布的例子进行分析,发现当卡方分布的自由度越小,异常值出现于一侧的概率越大,中位数也越偏离上下四分位数的中心位置,分布偏态性越强。异常值集中在较小值一侧,则分布呈现左偏态;;异常值集中在较大值一侧,则分布呈现右偏态。下表列出了几种分布的样本数据箱线图的特征(样本数据由SAS的随机数生成函数自动生成),验证了上述规律。这个规律揭示了数据批分布偏态和尾重的部分信息,尽管它们不能给出偏态和尾重程度的精确度量,但可作为我们粗略估计的依据。
3.利用箱线图比较几批数据的形状
同一数轴上,几批数据的箱线图并行排列,几批数据的中位数、尾长、异常值、分布区间等形状信息便昭然若揭。在一批数据中,哪几个数据点出类拔萃,哪些数据点表现不及一般,这些数据点放在同类其它群体中处于什么位置,可以通过比较各箱线图的异常值看出。各批数据的四分位距大小,正常值的分布是集中还是分散,观察各方盒和线段的长短便可明了。每批数据分布的偏态如何,分析中位线和异常值的位置也可估计出来。还有一些箱线图的变种,使数据批间的比较更加直观明白。例如有一种可变宽度的箱线图,使箱的宽度正比于批量的平方根,从而使批量大的数据批有面积大的箱,面积大的箱有适当的视觉效果。如果对同类群体的几批数据的箱线图进行比较,分析评价,便是常模参照解释方法的可视图示;如果把受测者数据批的箱线图与外在效标数据批的箱线图比较分析,便是效标参照解释的可视图示。箱线图结合这些分析方法用于质量管理、人事测评、探索性数据分析等统计分析活动中去,有助于分析过程的简便快捷,其作用显而易见。
希望能帮到你~ 参考技术B 首先异常值不能存在,或者相比较而言一两个也可以接受。
其次如果你的目标是越大越好,那么箱型图整体靠上,中位数横线靠上的比其他的好。
如果你的目标是越小越好,那么箱型图整体靠下,横线靠下的好。
总而言之就是矩形区域表示50%的数据所在,横线表示正态分布的那个顶峰所在的值。依据你是觉得50%分布比较重要还是数量顶峰所在的值的高低比较重要来选择。
如何通过迭代方法创建一系列带有统计注释的箱线图
【中文标题】如何通过迭代方法创建一系列带有统计注释的箱线图【英文标题】:How to create by an iterative method a series of boxplots with statistics annotations 【发布时间】:2021-12-22 05:56:22 【问题描述】:我已经安装了以下模型
models_list_1 <- data_long %>%
group_by(signals) %>%
do(fit = lmerTest::lmer(value ~ COND*SES + (1 |ID), data = .)) %>%
pull(fit) %>%
lapply(., function(x) summary(x)$coefficients) %>%
setNames(unique(data_long$signals))
并提取成对统计如下
md <- data_long %>%
group_by(signals) %>%
do(fit = lmerTest::lmer(value ~ COND*SES + (1 |ID), data = .)) %>%
pull(fit) %>%
lapply(., function(m) lsmeans(m, pairwise ~ COND*SES, adjust="tukey"))
如果我想重复 迭代(对于包含在下面数据集中的每个 signals 变量)一种箱线图
在示例中报告的 时间 位置,我将拥有我的数据集的 三个不同的会话 (SES = L,V,R)(报告如下将出现),并且对于每个会话,三个条件(COND(NEG-CTR,NEG-NOC和NEU-NOC)之间的多个成对比较报告到数据集中)我应该做些什么?我应该设置哪个以及如何设置迭代函数来报告显着差异条?
提前致谢
这里是数据集
> dput(head(data_long,300))
structure(list(ID = c("01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "01",
"02", "02", "02", "02", "02", "02", "02", "02", "02", "02", "02",
"02", "02", "02", "02", "02", "02", "02", "02", "02", "02", "02",
"02", "02", "02", "02", "02", "02", "02", "02", "02", "02", "02",
"02", "02", "02", "02", "02", "02", "02", "02", "02", "02", "02",
"02", "02", "02", "02", "02", "02", "02", "02", "02", "02", "02",
"02", "02", "02", "02", "02", "02", "02", "02", "02", "02", "02",
"02", "02", "02", "02", "02", "02", "02", "02", "02", "02", "02",
"02", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04", "04", "04", "04", "04",
"04", "04", "04", "04", "04", "04", "04"), GR = c("RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP", "RP",
"RP"), SES = c("L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V",
"V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V",
"V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V",
"V", "V", "V", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L",
"L", "L", "L", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"R", "R", "R", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V",
"V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V", "V",
"V", "V", "V", "V"), COND = c("NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC", "NEU-NOC",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR", "NEG-CTR",
"NEG-CTR", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC", "NEG-NOC",
"NEG-NOC", "NEG-NOC", "NEU-NOC"), signals = c("P3(400-450).FCz",
"P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz", "P3(400-450).Cz", "P3(400-450).Pz", "LPPearly(500-700).FCz",
"LPPearly(500-700).Cz", "LPPearly(500-700).Pz", "LPP1(500-1000).FCz",
"LPP1(500-1000).Cz", "LPP1(500-1000).Pz", "LPP2(1000-1500).FCz",
"LPP2(1000-1500).Cz", "LPP2(1000-1500).Pz", "LPP2(1000-1500).POz",
"P3(400-450).FCz"), value = c(-13.733750856001, -9.75024624896264,
2.65626156135631, -11.2145748677083, -8.14861856277773, 3.4315211013568,
-7.774797181711, -5.0379636708446, 4.67200616533014, -0.397250087672501,
2.91913936481813, 8.38141924882334, 9.61455213192824, -11.0706676917232,
-8.42427447113084, 3.37360619561252, -13.9481657323772, -11.7645758007163,
-1.55179922542943, -8.40872060176111, -6.36865552801825, 1.75888442936359,
1.01519755373062, 1.85489998202138, 4.88842858528025, 7.21299011910717,
-8.4719202003519, -5.61886494275071, 5.4043480635031, -12.0047623683783,
-9.16726244915301, 1.13509020104859, -7.03235376576925, -4.54670193355435,
2.49276476951357, -1.17300033366376, 0.694393606954545, 5.0594399581601,
6.1861244061312, -5.04318152659785, 0.73152672768007, 19.5226358864568,
-4.24372139176794, 0.918751423320568, 16.3120391015512, -0.65010821749741,
4.05493850786385, 13.8997702651793, 0.663115370014327, 3.95694572160701,
3.88831364571248, 6.46723813995257, -6.25375875400145, 1.11453058993788,
18.5017390789352, -7.38414465678688, -0.674372568935879, 14.1694182774958,
-3.24350263682843, 2.67516303169366, 13.2135623121441, -1.72160165493474,
2.36649557381131, 5.83201076558185, 7.25962635499353, -7.0474968134059,
-2.25104720773472, 11.7844254386573, -6.61221718491095, -2.47425935490564,
9.04781409226351, -2.84832379590422, 1.02479302810681, 9.51479768101391,
0.0540027107377267, 2.71292196345657, 3.65113189260335, 7.92952342178602,
-11.6312151716924, -5.16524399006139, 11.8802266972569, -11.7785042972793,
-5.96429031525769, 8.23981597718437, -5.67295796971287, -0.774461731301161,
9.99385579756163, -0.198736254963744, 2.96437294922766, 6.28027312932027,
7.91468942320841, -11.1438413285935, -5.53112490175437, 12.1053426662461,
-9.14927207125904, -5.10918437158799, 9.51261484648731, -4.3918290080777,
-0.650009462761383, 11.1212652173052, -3.16101041766438, -2.12913230708907,
5.24535230966772, 9.94838815736199, -3.99591470944713, 0.621502123415388,
12.955441582096, -7.58190508537766, -2.81732229625975, 9.42367409925817,
-2.96652960658775, 1.14010250644923, 10.6989716871958, 0.895992279831378,
2.94619035115619, 7.68162285335806, 10.2186482048953, 8.71618523084192,
10.0972150696175, 13.9718285231429, 14.2438131545118, 18.1277616996079,
20.6284861844249, 12.5228696634748, 15.0856583318757, 15.4011622649207,
9.21248347391488, 10.0673617448764, 8.55827491190151, 5.76901446016799,
3.1567164130045, 3.29671672118792, 6.37710361710325, 10.3728637305957,
14.0324104861749, 17.1194345279475, 10.1688421767607, 12.7218688256241,
13.5845965959489, 4.2029104966206, 5.28032844958354, 4.37390045274906,
1.63411653734436, 0.11779005903818, 0.527314779744752, 3.52040283490143,
4.71555467505934, 7.88901307601169, 9.74981375898379, 4.94891653050796,
7.04929483656524, 7.62145250862908, 5.29260474692784, 5.76317883868431,
4.27567967018154, 2.14044069620066, 6.2230923800622, 7.48013969467974,
13.9681839573434, 8.16263381384371, 10.9263261999576, 15.5578942384162,
8.29234474523583, 9.71944484568732, 12.4214977980377, 4.43538787409554,
4.54790063971537, 6.04702803069286, 4.09091078261671, 0.545039723311392,
2.24297008138028, 8.64955428897889, 2.54754270788021, 5.40070389371842,
10.3425870381822, 2.89989209310052, 5.19815917760722, 8.94731174966949,
1.28346027317076, 2.16569592764593, 5.29458007289059, 5.32593378182311,
-0.383605036065646, -0.0523505792147314, 2.80847380898547, -1.01463338713448,
0.139150314055044, 3.41932708826405, 1.69916872833203, 2.20513206952329,
4.10953557761617, 1.17003451023205, 1.33824716938448, 1.21234812875355,
-0.0587064331536407, -2.10936383457265, 0.0473343786951428, 10.1644392609445,
-6.4216236476269, -4.61042211238648, 4.05274207265641, -1.13332962482291,
-0.20305866581144, 5.80373742668179, 3.21881665778703, 2.58426832963409,
6.30887598671621, 6.86490468078958, 1.81064934015995, 2.78240093455642,
13.2788201390174, -4.08374576377548, -3.5562551128714, 3.767844291789,
0.649857280429136, 1.01053594416015, 5.74639215930458, 5.92604591551597,
5.077230852852, 5.9614279900414, 5.26280996552585, 0.754416368133019,
2.60057993978525, 10.5077997492971, -8.46742290376216, -6.85651693740331,
0.326110657534835, -4.43684347222634, -2.96241685765962, 1.48762660613099,
-2.75555354427229, -1.59699177169018, -0.609381826740468, 0.981300734684586,
-1.2371236814317, 1.4302038359579, 13.4030666728381, -6.30908300837476,
-2.17237957159954, 6.65839865279684, -2.31574543509226, 1.26480036715092,
6.04018553841336, 2.18006640865321, 6.61872855398538, 3.66646157996528,
5.0384350436334, -2.76852389876276, -0.650797837853182, 4.74014346829081,
-6.72661142802369, -6.18867237684241, 1.17003883692158, -2.73359549382074,
-2.00512841997728, 1.9050381096835, -0.225533814334514, -1.21696526578647,
0.240956222277802, 0.361670119961531, 5.54144355778122, 7.81248993867768,
11.9003140352528, -3.32736490042247, -1.77938930999718, 5.40630013085777,
-0.38736451456005, -0.423105565152366, 6.37211228749408, 0.986467266459687,
-0.507207892673482, 1.15053325116554, 0.393791410918138, -0.314155675382471,
2.23100741241039, 15.0981004360619, -4.01515836011381, -1.43557366487622,
5.06332653216481, 0.159183652691071, 1.51403741206392, 3.7899021820967,
3.11042068112836, 3.44844607014521, 1.08242973465635, 1.07455889922813,
0.238885648959708, 3.96990710862955, 15.4046229884164, -6.60165385653499,
-3.14872157912645, 5.02619159395405, -1.78361184935376, 0.25571835554024,
4.59413830322224, 2.27800090558473, 3.02403433835637, 2.99896314000211,
1.65917850515029, 5.03749946898385)), row.names = c(NA, -300L
), class = c("tbl_df", "tbl", "data.frame"))
>
【问题讨论】:
【参考方案1】:这样的?
library(tidyverse)
library(ggpubr)
data_long %>%
ggplot(aes(COND, value, color = COND)) +
geom_boxplot() +
stat_compare_means(
comparisons = list(
c("NEG-CTR", "NEG-NOC"),
c("NEG-CTR", "NEU-NOC"),
c("NEG-NOC", "NEU-NOC")
)
) +
facet_wrap(~signals)
【讨论】:
一种。如果可能的话,最好输入 SES 一种颜色并逐个打印图表,但当存在显着差异时,条形图会显示星号。 我刚刚以这种方式 git 比较统计信息***.com/questions/69905668/…。这些是我要绘制这些图表的表格 此外,三个会话中的每一个都会有三个条件(所以三个箱线图)。这意味着每张图有 9 个箱线图【参考方案2】:我尝试通过此代码(应用于宽格式数据集)迭代地重现图表。
for (i in 5:ncol(data))
p <- ggboxplot(data,
x = 'SES',
y = colnames(data[i]),
color = 'COND'
)
print(
p + stat_compare_means(aes(label = paste0(..method.., ", p-value = ", ..p.format..)),
method = method2, label.y = max(data[, i], na.rm = TRUE)
)
+ stat_compare_means(comparisons = my_comparisons, method = method2, label = "p.format") # remove if p-value of ANOVA or Kruskal-Wallis test >= alpha
)
顺便说一句,我对结果不太满意,因为它错过了图表上的比较条,此外,我想学习将代码重塑为长格式。有人可以帮忙吗?
【讨论】:
@Marek Fiołka 如果您愿意,也许您可以提出一些建议。谢谢以上是关于通过箱线图判断偏向的主要内容,如果未能解决你的问题,请参考以下文章