R語言ggplot2添加統(tǒng)計(jì)學(xué)顯著性

用到

stat_compare_means

函數(shù)
兩種用法:

一、用aes函數(shù)映射

stat_compare_means(aes(group = group),
                       method = "wilcox.test",
                       hide.ns = F,na.rm = T,
                       label="p.signif")

這個(gè)方法可以在組內(nèi)進(jìn)行比較

二、用comparison添加

stat_compare_means(method="wilcox.test",
                     comparison=comparison,#必須是個(gè)List
                     hide.ns = F,
                     label="p.signif")

這個(gè)只能在組間進(jìn)行比較,comparison的賦值必須是x軸上的值
“長(zhǎng)度為2的向量列表。向量中的條目要么是x軸上2個(gè)值的名稱,要么是對(duì)應(yīng)于要比較的感興趣組索引的2個(gè)整數(shù)。”

A list of length-2 vectors. The entries in the vector are either the names of 2 values on the x-axis or the 2 integers that correspond to the index of the groups of interest, to be compared.
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容