이 노트북은 RJafroc 패키지를 활용하여 MRMC(Multi-Reader Multi-Case) 연구 데이터를 시뮬레이션하고 분석하는 과정을 담고 있습니다. 자료에 따르면 RJafroc은 데이터 임포트, ROC/FROC 지표 계산, Hillis 수정안(refinements)이 적용된 ANOVA 분석까지 “완전한 파이프라인”을 제공합니다.
분석에 필요한 라이브러리를 로드합니다.
# 패키지 로드
if(!require(RJafroc)) install.packages("RJafroc")
if(!require(tidyverse)) install.packages("tidyverse")
library(RJafroc)
library(tidyverse)
library(ggplot2)
# 재현성을 위한 시드 설정
set.seed(2024)
TONY FROC dataset
이 데이터셋은 “TONY” 데이터셋이라고 불린다. 총 185건의 사례로 구성되어 있으며, 그중 89건은 질병이 있는 경우이다. 다섯 명의 영상의학과 전문의가 FROC 패러다임을 사용해 두 가지 검사 방식(“BT” = 유방 단층촬영, “DM” = 디지털 유방촬영술)으로 해석한 자료이다.
(https://dpc10ster.github.io/RJafroc/reference/dataset01.html)
dataset <- dataset01
# 데이터셋 구조 요약 확인
str(dataset)
## List of 3
## $ ratings :List of 3
## ..$ NL : num [1:2, 1:5, 1:185, 1:3] 3 -Inf 3 -Inf 4 ...
## ..$ LL : num [1:2, 1:5, 1:89, 1:2] 4 4 3 -Inf 3.5 ...
## ..$ LL_IL: logi NA
## $ lesions :List of 3
## ..$ perCase: int [1:89] 1 1 1 1 1 1 1 1 1 1 ...
## ..$ IDs : num [1:89, 1:2] 1 1 1 1 1 1 1 1 1 1 ...
## ..$ weights: num [1:89, 1:2] 1 1 1 1 1 1 1 1 1 1 ...
## $ descriptions:List of 7
## ..$ fileName : chr "dataset01"
## ..$ type : chr "FROC"
## ..$ name : chr "TONY"
## ..$ truthTableStr: num [1:2, 1:5, 1:185, 1:4] 1 1 1 1 1 1 1 1 1 1 ...
## ..$ design : chr "FCTRL"
## ..$ modalityID : Named chr [1:2] "BT" "DM"
## .. ..- attr(*, "names")= chr [1:2] "BT" "DM"
## ..$ readerID : Named chr [1:5] "1" "2" "3" "4" ...
## .. ..- attr(*, "names")= chr [1:5] "1" "2" "3" "4" ...
Obuchowski-Rockette (OR) 모델을 사용하여 분석을 수행합니다. 자료에 따르면 이 방법은 Hillis의 수정안(refinements)을 적용하여 MRMC 연구의 상관관계 구조를 적절히 처리하고 올바른 결론을 도출하는 데 필수적입니다.
result_or <- StSignificanceTesting(dataset,
method = "OR",
FOM = "AFROC",
alpha = 0.05)
# 1. AUC 추정치 (AUC Estimates)
print("--- AUC Estimates per Reader/Modality ---")
## [1] "--- AUC Estimates per Reader/Modality ---"
print(result_or$FOMs$foms)
## rdr1 rdr2 rdr3 rdr4 rdr5
## trtBT 0.75915570 0.83750000 0.81310307 0.80712719 0.82779605
## trtDM 0.64067982 0.70345395 0.73591009 0.76940789 0.68059211
# 2. 모달리티 간 차이 검정 (ANOVA Table)
print("--- Global Test for Treatment Effect ---")
## [1] "--- Global Test for Treatment Effect ---"
print(result_or$ANOVA$TRanova)
## SS DF MS
## T 0.0264852434 1 0.0264852434
## R 0.0094618134 4 0.0023654533
## TR 0.0040424476 4 0.0010106119
해석: 위 결과의
Pr(>F)값이 0.05 미만이면, 진단 성능 차이가 통계적으로 유의미하다고 볼 수 있습니다.
RJafroc 내장 함수를 사용하여 경험적 ROC 곡선을
그립니다.
n_readers <- 5
plots <- PlotEmpiricalOperatingCharacteristics(dataset, trts = 1:2, rdrs = 1:n_readers, "AFROC")
plots$Plot
모달리티 간의 성능 변화를 더 명확히 보기 위해 ggplot2를
사용하여 막대 그래프를 그립니다.
# 결과 객체에서 데이터 추출
df <- result_or$FOMs$foms
df_long <- df %>%
rownames_to_column("Modality") %>%
pivot_longer(cols = starts_with("rdr"), names_to = "Reader", values_to = "AUC")
# Plot
ggplot(df_long, aes(x = Reader, y = AUC, fill = Modality)) +
geom_bar(stat = "identity", position = position_dodge(width = 0.7), width = 0.6) +
geom_text(aes(label = round(AUC, 3)),
position = position_dodge(width = 0.7),
vjust = -0.5, size = 3.5) +
labs(title = "Impact of Data Modality on Reader Performance (AUC)",
subtitle = "Comparison: With BT vs. With DM",
y = "AUC (Area Under ROC Curve)",
x = "Reader ID") +
scale_fill_manual(values = c("trtBT" = "#999999", "trtDM" = "#E69F00")) +
theme_bw() +
coord_cartesian(ylim = c(0.5, 1.0))