diff --git a/Rpackage/iMRMC/NAMESPACE b/Rpackage/iMRMC/NAMESPACE index bbcf0666..349cd6a8 100644 --- a/Rpackage/iMRMC/NAMESPACE +++ b/Rpackage/iMRMC/NAMESPACE @@ -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) diff --git a/Rpackage/iMRMC/R/limitsOfAgreement.R b/Rpackage/iMRMC/R/limitsOfAgreement.R index a2c374e4..97978e6d 100644 --- a/Rpackage/iMRMC/R/limitsOfAgreement.R +++ b/Rpackage/iMRMC/R/limitsOfAgreement.R @@ -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) @@ -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)) @@ -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) @@ -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 @@ -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 @@ -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 diff --git a/Rpackage/iMRMC/inst/extra/limitsOfAgreement/CompareSimulationModels.Rmd b/Rpackage/iMRMC/inst/extra/limitsOfAgreement/CompareSimulationModels.Rmd index 44bedac1..5b4d86d9 100644 --- a/Rpackage/iMRMC/inst/extra/limitsOfAgreement/CompareSimulationModels.Rmd +++ b/Rpackage/iMRMC/inst/extra/limitsOfAgreement/CompareSimulationModels.Rmd @@ -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. @@ -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. @@ -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), ]) + ``` diff --git a/Rpackage/iMRMC/inst/extra/limitsOfAgreement/CompareSimulationModels.pdf b/Rpackage/iMRMC/inst/extra/limitsOfAgreement/CompareSimulationModels.pdf index cc7f73d3..b89c1d37 100644 Binary files a/Rpackage/iMRMC/inst/extra/limitsOfAgreement/CompareSimulationModels.pdf and b/Rpackage/iMRMC/inst/extra/limitsOfAgreement/CompareSimulationModels.pdf differ diff --git a/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.R b/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.R index 485dad80..c30a23b3 100644 --- a/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.R +++ b/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.R @@ -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)) diff --git a/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.Rdata b/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.Rdata deleted file mode 100644 index 8f9a66c7..00000000 Binary files a/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.Rdata and /dev/null differ diff --git a/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.rda b/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.rda new file mode 100644 index 00000000..7b43834a Binary files /dev/null and b/Rpackage/iMRMC/tests/testthat/test_simNormalIGHierarchical.rda differ