stat_compare_means用于一组箱形图

时间:2018-07-15 12:56:08

标签: r ggplot2 ggpubr

我正在研究我的硕士学位。为此,我测量了蛋鸡的骨强度。现在,我想通过创建家庭结构的箱形图来比较数据。使用ggplot2,效果很好。但是我想知道天气在家庭之间有很大的不同。为此,我想使用stat_compare_means。 但这是行不通的。

这是我的代码:

library(ggplot2)
library(ggpubr)

ggplot(Fluegel_type, aes(Vater, Biegespannung.bei.max.Kraft)) + 
geom_boxplot() + 
cleanup + 
labs(x = "Vater" , y = "Biegespannung bei max. Kraft in [Mpa]") + 
scale_y_continuous(breaks = seq(0,300,20)) + 
stat_compare_means(method = aov)

数据示例:

Vater <- c(22010, 22010, 22010, 22010, 22010, 22010, 22010, 22010,
           22010, 22010, 22010, 22010, 22010, 22010, 22010, 22010,
           22010, 22010, 22010, 22056, 22056, 22056, 22056, 22056,
           22056, 22056, 22056, 22056, 22056 ,22099, 22099, 22099,
           22099, 22099, 22099, 22099, 22099, 22099, 22099, 22099,
           22099, 22099, 22099, 22099, 22099, 22104, 22104, 22104,
           22104, 22104, 22104, 22104, 22104, 22104, 22104, 22104,
           22104, 22104, 22104, 22104, 22104, 22104, 22104, 22104,
           22104, 22104, 22104, 22104, 22104, 22104, 22104)

Vater <- as.character(Vater)

Biegespannung.bei.max.Kraft <- c(101,12,107,92,121,86,99,19,65,45,164,27,
                                 80,33,73,19,101,41,85,97,62,96,104,34,
                                 71,39,87,68,86,86,57,03,74,52,57,48,
                                 75,2,77,53,61,69,56,2,70,22,52,84,
                                 75,25,71,86,55,46,72,82,72,41,92,38,
                                 84,72,74,37,76,6,113,87,61,4,76,5, 
                                 93,51,99,41,70,58,45,27,91,72,113,33,
                                 56,21,63,52,72,81,74,91,73,6,78,19,
                                 76,6,66,67,78,24,49,8,70,23,54,17,
                                 44,61,74,16,61,91,67,07,51,2,77,08,
                                 66,4,80,32,71,87,83,98,78,35,73,09,
                                 80,04,44,06,60,06,56,54,79,18)

Fluegel_type <- data.frame(Vater, Biegespannung.bei.max.Kraft)

我想知道显着性水平和p值。 有人有建议吗?

0 个答案:

没有答案