我尝试将 p 值添加到我ggplot使用的stat_compare_means函数中。然而,我在 ggplot 中得到的 p 值与基本 wilcox.test 的结果不同。
我在这两种情况下都使用了配对测试,并且还在 ggplot 中使用了 wilcoxon 测试。
\n\n我尝试搜索我的问题,但找不到确切的答案。\n我更新了 R(v. 3.5.2)、R-Studio(v. 1.1.463)和所有软件包。下面我添加了几行代码和示例。我对 R 和统计数据很陌生,所以如果我以新手的方式提问,请原谅我。
\n\nlibrary("ggplot2") \nlibrary("ggpubr")\n\n\nc1 <- c( 798.3686, 2560.9974, 688.3051, 669.8265, 2750.6638, 1136.3535, \n 1335.5696, 2347.2777, 1149.1940, 901.6880, 1569.0731 ,3915.6719, \n 3972.0250 ,5517.5016, 4616.6393, 3232.0120, 4020.9727, 2249.4150, \n 2226.4108, 2582.3705, 1653.4801, 3162.2784, 3199.1923, 4792.6118) \nc2 <- c(0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1) \n\ntest <-data.frame(c2,c1) \n\ntest$c2 <- as.factor(test$c2) \n\nggplot(test, aes(x=c2, y=c1)) + \n stat_compare_means(paired = TRUE) \n\nwilcox.test( test$c1~ test$c2, paired= TRUE) \n …Run Code Online (Sandbox Code Playgroud)