matlab绘制bland-altman,Bland-Altman Plots(一致性评价)在R中的实现
假設(shè)有reader1 和reader2,分別對一定數(shù)量病人的某一影像指標(biāo)進(jìn)行評分,現(xiàn)在想看一下這兩位研究者評分的一致性,繪制Bland-Altman圖是一種較為直觀、簡單的方式。代碼實(shí)現(xiàn)方法如下:
顯示分組信息的B-A plot
library(BlandAltmanLeh)
library(ggplot2)
reader1
reader2
# bland.altman.plot(reader1, reader2) #普通B-A plot
MVI
ba.stats
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里的值對應(yīng)
# Notes: MVI里賦值時(shí)不要賦0和1,因?yàn)樗麄兇砗诤桶?#xff0c;圖片上顯示不出來
B-A plot_1.png
帶直方圖的B-A plot:
library(ggExtra)
print(ggMarginal(bland.altman.plot(reader1, reader2, graph.sys = "ggplot2"),
type = "histogram", size=4))
B-A plot_2.png
臨床上還會有一種情況,比如一個(gè)量表只有1-10分,2個(gè)評價(jià)者對100個(gè)患者評分的話,必然很多人的評分是相同的。如果用普通的B-A圖展示的話,有些點(diǎn)就會被覆蓋住,無法展現(xiàn)評分差異的全貌。以下代碼就是解決這種情況的:
B-A圖里的重復(fù)值
A
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
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
ggplot2 給出的解決方案:
print( bland.altman.plot(A, B, graph.sys = "ggplot2", geom_count = TRUE) )
B-A plot_5.png
總結(jié)
以上是生活随笔為你收集整理的matlab绘制bland-altman,Bland-Altman Plots(一致性评价)在R中的实现的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何通过扫码自动复制口令 并打开抖音时自
- 下一篇: Android仿网易云鲸云音效动效