Skip to content

Commit

Permalink
Merge pull request #10 from DIDSR/LOA
Browse files Browse the repository at this point in the history
LOA name changes to reduce dependencies
  • Loading branch information
SiWen314 authored Aug 9, 2024
2 parents 43595a5 + c43ce3e commit 698d8cf
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 59 deletions.
92 changes: 46 additions & 46 deletions Rpackage/iMRMC/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
# Generated by roxygen2: do not edit by hand
export(convertDFtoDesignMatrix)
export(convertDFtoScoreMatrix)
export(createGroups)
export(createIMRMCdf)
export(deleteCol)
export(doAUCmrmc)
export(doIMRMC)
export(doIMRMC_java)
export(doROCavg)
export(doROCxy)
export(extractPairedComparisonsBRBM)
export(extractPairedComparisonsWRBM)
export(getBRBM)
export(getMRMCdataset)
export(getMRMCscore)
export(getWRBM)
export(init.lecuyerRNG)
export(laBRBM)
export(laBRWM)
export(laWRBM)
export(laWRWM)
export(renameCol)
export(roc2binary)
export(sim.NormalIG.Hierarchical)
export(sim.NormalIG.Hierarchical.config)
export(sim.gRoeMetz)
export(sim.gRoeMetz.config)
export(simMRMC)
export(simRoeMetz.example)
export(successDFtoROCdf)
export(uStat11.conditionalD)
export(uStat11.jointD)
export(undoIMRMCdf)
import(Matrix)
import(parallel)
import(utils)
importFrom(methods,as)
importFrom(stats,aov)
importFrom(stats,model.matrix)
importFrom(stats,qnorm)
importFrom(stats,rbeta)
importFrom(stats,rgamma)
importFrom(stats,rnorm)
importFrom(stats,var)
# Generated by roxygen2: do not edit by hand

export(convertDFtoDesignMatrix)
export(convertDFtoScoreMatrix)
export(createGroups)
export(createIMRMCdf)
export(deleteCol)
export(doAUCmrmc)
export(doIMRMC)
export(doIMRMC_java)
export(doROCavg)
export(doROCxy)
export(extractPairedComparisonsBRBM)
export(extractPairedComparisonsWRBM)
export(getBRBM)
export(getMRMCdataset)
export(getMRMCscore)
export(getWRBM)
export(init.lecuyerRNG)
export(laBRBM)
export(laBRWM)
export(laWRBM)
export(laWRWM)
export(renameCol)
export(roc2binary)
export(sim.NormalIG.Hierarchical)
export(sim.NormalIG.Hierarchical.config)
export(sim.gRoeMetz)
export(sim.gRoeMetz.config)
export(simMRMC)
export(simRoeMetz.example)
export(successDFtoROCdf)
export(uStat11.conditionalD)
export(uStat11.jointD)
export(undoIMRMCdf)
import(Matrix)
import(parallel)
import(utils)
importFrom(methods,as)
importFrom(stats,aov)
importFrom(stats,model.matrix)
importFrom(stats,qnorm)
importFrom(stats,rbeta)
importFrom(stats,rgamma)
importFrom(stats,rnorm)
importFrom(stats,var)
12 changes: 6 additions & 6 deletions Rpackage/iMRMC/R/limitsOfAgreement.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ laWRBM <- function(df, modalitiesToCompare = c("testA","testB"),
diff.df <- droplevels(subset(diff.df.all, select = c("readerID","caseID","score")))

# Two-way ANOVA model
fit <- anova.2way(diff.df, if.aov = if.aov, type = type, reader.first = reader.first)
fit <- anova2(diff.df, if.aov = if.aov, type = type, reader.first = reader.first)

# size of study
N <- nrow(diff.df)
Expand Down Expand Up @@ -193,7 +193,7 @@ laBRWM <- function(df, modality = c("testA"),
df <- droplevels(df[df$modalityID == modality[1], ])

# Two-way ANOVA model
fit <- anova.2way(df, if.aov = if.aov, type = type, reader.first = reader.first)
fit <- anova2(df, if.aov = if.aov, type = type, reader.first = reader.first)

# size of study
nRperC <- array(table(df$caseID))
Expand Down Expand Up @@ -259,7 +259,7 @@ laWRWM <- function(df, replicatesToCompare = c("testA","testB"),
diff.df <- droplevels(subset(diff.df.all, select = c("readerID","caseID","score")))

# Two-way ANOVA model
fit <- anova.2way(diff.df, if.aov = if.aov, type = type, reader.first = reader.first)
fit <- anova2(diff.df, if.aov = if.aov, type = type, reader.first = reader.first)

# size of study
N <- nrow(diff.df)
Expand Down Expand Up @@ -316,7 +316,7 @@ laBRBM <- function(df, modalitiesToCompare = c("testA","testB"),
df.B <- df[df$modalityID == modalitiesToCompare[2], ]
df_2Modality <- droplevels(rbind(df.A, df.B))

fit <- anova.3way(df.A, df.B, if.aov = if.aov, type = type, reader.first = reader.first,
fit <- anova3(df.A, df.B, if.aov = if.aov, type = type, reader.first = reader.first,
is.sparseQR = is.sparseQR)

# Limit of agreement result
Expand Down Expand Up @@ -360,7 +360,7 @@ laBRBM <- function(df, modalitiesToCompare = c("testA","testB"),
}


anova.2way <- function(df, if.aov = TRUE, type = 1, reader.first = TRUE
anova2 <- function(df, if.aov = TRUE, type = 1, reader.first = TRUE
){
df <- droplevels(df)
is.incomplete <- F # whether the computation is completed
Expand Down Expand Up @@ -518,7 +518,7 @@ RSS_2w <- function(X, Y, Xr=NULL, Xc=NULL, Xe=diag(length(Y))){
df=length(Y)-k))
}

anova.3way <- function(df.A, df.B, if.aov = TRUE, type = 1, reader.first = TRUE,
anova3 <- function(df.A, df.B, if.aov = TRUE, type = 1, reader.first = TRUE,
is.sparseQR = T
){
is.incomplete <- F # whether the computation is completed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ set.seed(1, kind = "L'Ecuyer-CMRG")
dFrame.newH <- sim.NormalIG.Hierarchical(config)
# check the first and last few lines of the simulated dataframe
head(dFrame.newH)
tail(dFrame.newH)
print(dFrame.newH[1:6, ])
print(dFrame.newH[(nrow(dFrame.newH) - 5):nrow(dFrame.newH), ])
```

We simulated 5 readers and 100 cases for 2 modalities, so the total number of scores is 5x100x2=1000.
Expand All @@ -56,8 +57,9 @@ set.seed(1, kind = "L'Ecuyer-CMRG")
dFrame.gRM <- sim.gRoeMetz(config)
# check the first and last few lines of the simulated dataframe
head(dFrame.gRM)
tail(dFrame.gRM)
print(dFrame.gRM[1:6, ])
print(dFrame.gRM[(nrow(dFrame.gRM) - 5):nrow(dFrame.gRM), ])
```

The simulated data starts with truth state of each case, and followed by the reading scores from each of the readers. Since we simulate 50 positive cases and 50 negative cases, there are 100 lines for the truth and 100x5x2 = 1000 lines for the scores from 5 readers for 2 modalities.
Expand All @@ -67,6 +69,7 @@ To combine the truth data and the reader scores and change the data to a datafra
dFrame.gRM.2 <- undoIMRMCdf(dFrame.gRM)
# check the first and last few lines of the simulated dataframe
head(dFrame.gRM.2)
tail(dFrame.gRM.2)
print(dFrame.gRM.2[1:6, ])
print(dFrame.gRM.2[(nrow(dFrame.gRM.2) - 5):nrow(dFrame.gRM.2), ])
```
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ str(result)
#### TEST ####

# Save the result to a file for future comparisons
fileName <- "test_simNormalIGHierarchical.Rdata"
fileName <- "test_simNormalIGHierarchical.rda"
if (flagSave) {
saveResult <- result
save(saveResult, file = file.path("tests", "testthat", fileName))
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 698d8cf

Please sign in to comment.