我想用简单的(但很糟糕的)数据集做一个简单的成对wilcox测试。 我有8个组和5个值(见下面的数据)。 这些组在“id”列中,并且感兴趣的变量(在这种情况下是重量)处于“重量”中。 我试过的是:
pairwise.wilcox.test(dat$weight,dat$id, p.adj = "bonf")这给了我以下结果:
286x306 286x339 286x574 547x286 574x519 574x542 574x547 587x210 589x286 286x339 0.36 - - - - - - - - 286x574 1.00 1.00 - - - - - - - 547x286 0.36 1.00 0.36 - - - - - - 574x519 0.36 0.36 0.36 0.72 - - - - - 574x542 0.36 0.36 0.36 0.36 0.36 - - - - 574x547 0.36 0.36 0.36 1.00 0.36 0.36 - - - 587x210 1.00 1.00 1.00 0.36 0.36 1.00 0.36 - - 589x286 1.00 0.36 1.00 0.36 0.36 0.36 0.36 1.00 - WC 0.36 0.36 0.36 1.00 0.36 0.36 1.00 0.36 0.36我不明白 - 我相信我应该得到的是p值? 我不相信组图之间没有区别,因为图表清楚地显示了它们。 有没有人有一个想法我做错了什么? 我会非常感谢每一个帮助!
id weight V3 1 286x306 110 1 2 286x306 126 1 3 286x306 121 1 4 286x306 115 1 5 286x306 105 1 6 286x339 194 2 7 286x339 181 2 8 286x339 200 2 9 286x339 140 2 10 286x339 142 2 11 286x574 143 3 12 286x574 136 3 13 286x574 118 3 14 286x574 151 3 15 286x574 124 3 16 547x286 280 4 17 547x286 225 4 18 547x286 192 4 19 547x286 273 4 20 547x286 221 4 21 574x519 331 5 22 574x519 332 5 23 574x519 301 5 24 574x519 320 5 25 574x519 280 5 26 574x542 81 6 27 574x542 89 6 28 574x542 103 6 29 574x542 94 6 30 574x542 93 6 31 574x547 222 7 32 574x547 203 7 33 574x547 243 7 34 574x547 223 7 35 574x547 227 7 36 587x210 140 8 37 587x210 145 8 38 587x210 103 8 39 587x210 137 8 40 587x210 95 8 41 589x286 125 9 42 589x286 120 9 43 589x286 108 9 44 589x286 126 9 45 589x286 119 9 46 WC 227 10 47 WC 228 10 48 WC 232 10 49 WC 221 10 50 WC 229 10I would like to do a simple pairwise wilcox test with an easy (but crappy) data set. I have 8 groups and 5 values for each group (See data below). The groups are in the column "id" and the variable of interest, in this case weight, is in "weight". What I tried is:
pairwise.wilcox.test(dat$weight,dat$id, p.adj = "bonf")which gives me the following result:
286x306 286x339 286x574 547x286 574x519 574x542 574x547 587x210 589x286 286x339 0.36 - - - - - - - - 286x574 1.00 1.00 - - - - - - - 547x286 0.36 1.00 0.36 - - - - - - 574x519 0.36 0.36 0.36 0.72 - - - - - 574x542 0.36 0.36 0.36 0.36 0.36 - - - - 574x547 0.36 0.36 0.36 1.00 0.36 0.36 - - - 587x210 1.00 1.00 1.00 0.36 0.36 1.00 0.36 - - 589x286 1.00 0.36 1.00 0.36 0.36 0.36 0.36 1.00 - WC 0.36 0.36 0.36 1.00 0.36 0.36 1.00 0.36 0.36I do not understand that - I believe what I should get are p-values? I do not believe that there are no differences between the groups as the graph clearly shows them. Does anyone have an idea what am I doing wrong? I would greatly appreciate every help!
id weight V3 1 286x306 110 1 2 286x306 126 1 3 286x306 121 1 4 286x306 115 1 5 286x306 105 1 6 286x339 194 2 7 286x339 181 2 8 286x339 200 2 9 286x339 140 2 10 286x339 142 2 11 286x574 143 3 12 286x574 136 3 13 286x574 118 3 14 286x574 151 3 15 286x574 124 3 16 547x286 280 4 17 547x286 225 4 18 547x286 192 4 19 547x286 273 4 20 547x286 221 4 21 574x519 331 5 22 574x519 332 5 23 574x519 301 5 24 574x519 320 5 25 574x519 280 5 26 574x542 81 6 27 574x542 89 6 28 574x542 103 6 29 574x542 94 6 30 574x542 93 6 31 574x547 222 7 32 574x547 203 7 33 574x547 243 7 34 574x547 223 7 35 574x547 227 7 36 587x210 140 8 37 587x210 145 8 38 587x210 103 8 39 587x210 137 8 40 587x210 95 8 41 589x286 125 9 42 589x286 120 9 43 589x286 108 9 44 589x286 126 9 45 589x286 119 9 46 WC 227 10 47 WC 228 10 48 WC 232 10 49 WC 221 10 50 WC 229 10最满意答案
这是由于Bonferoni修正,它会根据您进行的测试次数调整p值。 例:
airquality$Month <- factor(airquality$Month, labels = month.abb[5:9]) #test without correction for multiple testing res0 <- pairwise.wilcox.test(airquality$Ozone,airquality$Month, p.adj = "none") # May Jun Jul Aug #Jun 0.19250 - - - #Jul 3e-05 0.01414 - - #Aug 0.00012 0.02591 0.86195 - #Sep 0.11859 0.95887 0.00074 0.00325 # #P value adjustment method: none #manual correction m <- length(na.omit(c(res0$p.value))) matrix(pmin(1, res0$p.value*m), ncol=ncol(res0$p.value)) # [,1] [,2] [,3] [,4] #[1,] 1.000000000 NA NA NA #[2,] 0.000299639 0.1413625 NA NA #[3,] 0.001208078 0.2590776 1.000000000 NA #[4,] 1.000000000 1.0000000 0.007442604 0.03247955 #this gives the same pairwise.wilcox.test(airquality$Ozone, airquality$Month, p.adj = "bonf") # May Jun Jul Aug #Jun 1.0000 - - - #Jul 0.0003 0.1414 - - #Aug 0.0012 0.2591 1.0000 - #Sep 1.0000 1.0000 0.0074 0.0325 # #P value adjustment method: bonferroni您可能想要使用较不保守的更正(请参阅help("p.adjust") )。 也许你可以调整虚假发现率?
This is due to the Bonferoni correction, which adjusts p-values for the number of tests you conduct. Example:
airquality$Month <- factor(airquality$Month, labels = month.abb[5:9]) #test without correction for multiple testing res0 <- pairwise.wilcox.test(airquality$Ozone,airquality$Month, p.adj = "none") # May Jun Jul Aug #Jun 0.19250 - - - #Jul 3e-05 0.01414 - - #Aug 0.00012 0.02591 0.86195 - #Sep 0.11859 0.95887 0.00074 0.00325 # #P value adjustment method: none #manual correction m <- length(na.omit(c(res0$p.value))) matrix(pmin(1, res0$p.value*m), ncol=ncol(res0$p.value)) # [,1] [,2] [,3] [,4] #[1,] 1.000000000 NA NA NA #[2,] 0.000299639 0.1413625 NA NA #[3,] 0.001208078 0.2590776 1.000000000 NA #[4,] 1.000000000 1.0000000 0.007442604 0.03247955 #this gives the same pairwise.wilcox.test(airquality$Ozone, airquality$Month, p.adj = "bonf") # May Jun Jul Aug #Jun 1.0000 - - - #Jul 0.0003 0.1414 - - #Aug 0.0012 0.2591 1.0000 - #Sep 1.0000 1.0000 0.0074 0.0325 # #P value adjustment method: bonferroniYou might want to use a less conservative correction (see help("p.adjust") for alternatives). Maybe you could adjust the false discovery rate?
更多推荐
发布评论