Skip to content

Commit

Permalink
WIP: Fix bug issue 190: Add new test ... also WIP. Update BCK and dfB…
Browse files Browse the repository at this point in the history
…DG to address study with unpaired readers.
  • Loading branch information
brandon-gallas committed Jan 29, 2025
1 parent d8fccad commit 4cb4f11
Show file tree
Hide file tree
Showing 4 changed files with 353 additions and 19 deletions.
18 changes: 15 additions & 3 deletions Rpackage/iMRMC/R/doAUCMRMC.R
Original file line number Diff line number Diff line change
Expand Up @@ -825,9 +825,11 @@ doAUCmrmcCov <- function(perReaderPair.1) {
####
#### Biased moments
####
m.biased <- numer / denom

index.TF <- denom != 0
m.biased <- numer
m.biased[index.TF] <- m.biased[index.TF] / denom[index.TF]



####
#### Transformation: map biased sums to unbiased sums
Expand Down Expand Up @@ -856,7 +858,9 @@ doAUCmrmcCov <- function(perReaderPair.1) {
####
#### Unbiased moments
####
m <- numer.U / denom.U
index.TF <- denom.U != 0
m <- numer.U
m[index.TF] <- m[index.TF] / denom.U[index.TF]



Expand Down Expand Up @@ -951,6 +955,14 @@ doAUCmrmcCov <- function(perReaderPair.1) {
"BCK.NR.coeff", "BCK.DR.coeff", "BCK.RND.coeff")



# Manage studies that do not pair readers or cases across modalities
index <- BCK.coeff[1, ] == 0
BCK[1, index] <- 0
BCK.biased[1, index] <- 0



####
#### Degrees of freedom
####
Expand Down
36 changes: 20 additions & 16 deletions Rpackage/iMRMC/R/iMRMC_R.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,27 @@ origPerReader <- function(result_AUC_MRMC) {

# When the modalities are different, fill them appropriately
index.TF <- current$modalityA != current$modalityB
current.12 <- current[index.TF, ]
if (nM > 1) {
for (i in 1:sum(index.TF)) {
current.i <- current[
(current$readerID == current.12$readerID[i]) &
(current$modalityA == current.12$modalityA[i]) &
(current$modalityB == current.12$modalityA[i]),
]
current.12$varAUCA[i] <- current.i$varAUCA
current.i <- current[
(current$readerID == current.12$readerID[i]) &
(current$modalityA == current.12$modalityB[i]) &
(current$modalityB == current.12$modalityB[i]),
]
current.12$varAUCB[i] <- current.i$varAUCB
if (sum(index.TF) > 0) {

current.12 <- current[index.TF, ]
if (nM > 1) {
for (i in 1:sum(index.TF)) {
current.i <- current[
(current$readerID == current.12$readerID[i]) &
(current$modalityA == current.12$modalityA[i]) &
(current$modalityB == current.12$modalityA[i]),
]
current.12$varAUCA[i] <- current.i$varAUCA
current.i <- current[
(current$readerID == current.12$readerID[i]) &
(current$modalityA == current.12$modalityB[i]) &
(current$modalityB == current.12$modalityB[i]),
]
current.12$varAUCB[i] <- current.i$varAUCB
}
current[index.TF, c("varAUCA", "varAUCB")] <- current.12[, c("varAUCA", "varAUCB")]
}
current[index.TF, c("varAUCA", "varAUCB")] <- current.12[, c("varAUCA", "varAUCB")]

}

# Add columns for AUCAminusAUCB and varAUCAminusAUCB
Expand Down
Loading

0 comments on commit 4cb4f11

Please sign in to comment.