Bland-Altman Plots(一致性評(píng)價(jià))在R中的實(shí)現(xiàn)

假設(shè)有reader1 和reader2,分別對(duì)一定數(shù)量病人的某一影像指標(biāo)進(jìn)行評(píng)分,現(xiàn)在想看一下這兩位研究者評(píng)分的一致性,繪制Bland-Altman圖是一種較為直觀、簡單的方式。代碼實(shí)現(xiàn)方法如下:

  1. 顯示分組信息的B-A plot
library(BlandAltmanLeh)
library(ggplot2)

reader1 <- ap_reader1$Elongation  # numeric
reader2 <- ap_reader2$Elongation

# bland.altman.plot(reader1, reader2)  #普通B-A plot

MVI <- rep(c(1,2), 63, length.out = 125) # new knowledge; "each = 63"

ba.stats <- bland.altman.stats(reader1, reader2)

plot(ba.stats$means, ba.stats$diffs, col= MVI, 
     sub=paste("critical difference is", round(ba.stats$critical.diff,4)),
     main="Bland-Altman Plot", ylim=c(-0.6,0.6), pch=18-MVI)
abline(h = ba.stats$lines, lty=c(2,3,2), col=c("lightblue","blue","lightblue"), 
       lwd=c(3,2,3))
legend(x = "topright", legend = c("MVI-","MVI+"), fill = 1:2) # 這里的fill和MVI里的值對(duì)應(yīng)
# Notes: MVI里賦值時(shí)不要賦0和1,因?yàn)樗麄兇砗诤桶?,圖片上顯示不出來
B-A plot_1.png
  1. 帶直方圖的B-A plot:
library(ggExtra)
print(ggMarginal(bland.altman.plot(reader1, reader2, graph.sys = "ggplot2"),
                 type = "histogram", size=4))
B-A plot_2.png

臨床上還會(huì)有一種情況,比如一個(gè)量表只有1-10分,2個(gè)評(píng)價(jià)者對(duì)100個(gè)患者評(píng)分的話,必然很多人的評(píng)分是相同的。如果用普通的B-A圖展示的話,有些點(diǎn)就會(huì)被覆蓋住,無法展現(xiàn)評(píng)分差異的全貌。以下代碼就是解決這種情況的:

  1. B-A圖里的重復(fù)值
A <- c(7, 8, 4, 6, 4, 5, 9, 7, 5, 8, 1, 4, 5, 7, 3, 4, 4, 9, 3, 3, 
1, 4, 5, 6, 4, 7, 4, 7, 7, 5, 4, 6, 3, 4, 6, 4, 7, 4, 6, 5, 1, 1, 1, 1, 1, 1)
B <- c(8, 7, 4, 6, 3, 6, 9, 8, 4, 9, 0, 5, 5, 9, 3, 5, 5, 8, 3, 3, 
1, 4, 4, 7, 4, 8, 3, 7, 7, 5, 6, 7, 3, 3, 7, 3, 6, 5, 9, 5, 1, 1, 1, 1, 1, 1)

bland.altman.plot(A, B)
B-A plot_3.png
bland.altman.plot(A, B, sunflower=TRUE) # 不同形狀代表不同的重復(fù)值
B-A plot_4.png
  1. ggplot2 給出的解決方案:
print( bland.altman.plot(A, B, graph.sys = "ggplot2", geom_count = TRUE) )
B-A plot_5.png

參考資料:
BlandAltmanLeh Intro

最后編輯于
?著作權(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),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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

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