Skip to content

Commit

Permalink
removed SPLIT-PLOT A, C; working on X versions of St functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dpc10ster committed Aug 12, 2023
1 parent 9218e8c commit 444e514
Show file tree
Hide file tree
Showing 44 changed files with 880 additions and 1,908 deletions.
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export(SsPowerTable)
export(SsSampleSizeKGivenJ)
export(StSignificanceTesting)
export(StSignificanceTestingCadVsRad)
export(StSignificanceTestingCrossedModalities)
export(Util2Intrinsic)
export(Util2Physical)
export(UtilAnalyticalAucsRSM)
Expand All @@ -53,6 +52,7 @@ export(UtilAucCBM)
export(UtilAucPROPROC)
export(UtilDBM2ORVarCom)
export(UtilFigureOfMerit)
export(UtilFigureOfMeritX)
export(UtilLesDistr)
export(UtilLesWghtsDS)
export(UtilLesWghtsLD)
Expand Down Expand Up @@ -85,7 +85,6 @@ importFrom(numDeriv,hessian)
importFrom(numDeriv,jacobian)
importFrom(stats,approx)
importFrom(stats,cor)
importFrom(stats,cov)
importFrom(stats,dbinom)
importFrom(stats,dnorm)
importFrom(stats,integrate)
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ title: "NEWS"
* Bug fix, Issue 89, see below
* Fixed entry errors in Excel file (check column names and data type)
* TODO: `QuickStart`, new chapter on recommended FOMs and those to avoid at all costs
* Removed SPLIT-PLOT-A and SPLIT-PLOT-C analyses: no one is using it and I have no dataset or statistician involvement to validate the implementation. It is still available on previous versions, i.e., versions < 2.1.3.


### Issue 90
Expand All @@ -26,7 +27,7 @@ title: "NEWS"
* Added a sorting step to both worksheets: order by modality, then reader, then case and then rating.
* Also ALWAYS use `TP_Rating` and `FP_Rating` in these sheets; do not use LL_Rating and/or NL_Rating as this will break the code.
* Some `goodValues` had to be regenerated.
* TODO: Not sure about the split plot codes; these have never been used and I should consider removing them.
* TODO: Not sure about the split plot codes; these have never been used and I should consider removing them. Done: 8/11/23


### Changes 05/19/2023
Expand Down
1 change: 0 additions & 1 deletion R/DfFroc2Roc.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#'
#' @examples
#' rocDataSet <- DfFroc2Roc(dataset05)
#' rocSpDataSet <- DfFroc2Roc(datasetFROCSpC)
#'
#' ## in the following example, because of the smaller number of cases,
#' ## it is easy to see the process at work:
Expand Down
87 changes: 6 additions & 81 deletions R/DfReadDataFile.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
#' treatment and reader IDs (i.e., names). Otherwise, treatment
#' and reader IDs in the original data file will be used.
#'
#' @note WARNING: SPLIT-PLOT-A and SPLIT-PLOT-C have not been tested with real datasets.
#' Contact the maintainer if you desire this funtionality.
#' The \code{"MRMC"} format is deprecated. For non-JAFROC formats four file
#' @note The \code{"MRMC"} format is deprecated. For non-JAFROC formats four file
#' extensions (\code{.csv}, \code{.txt}, \code{.lrc} and \code{.imrmc}) are possible,
#' all of which are restricted to ROC data. Only the \code{iMRMC} format is actively
#' supported, i.e, files with extension \code{.imrmc}. Other formats (\code{.csv},
Expand Down Expand Up @@ -181,8 +179,8 @@ preCheck4BadEntries <- function(truthTable) {



# SPLIT-PLOT-A: Reader nested within test; Hillis 2014 Table VII part (a)
# SPLIT-PLOT-C: Case nested within reader; Hillis 2014 Table VII part (c)


checkTruthTable <- function (truthTable, lrocForcedMark)
{

Expand All @@ -192,7 +190,7 @@ checkTruthTable <- function (truthTable, lrocForcedMark)
design <- (toupper(truthTable[,6][which(!is.na(truthTable[,6]))]))[2]
if (design == "CROSSED") design <- "FCTRL"
if (!(type %in% c("FROC", "ROC", "LROC"))) stop("Unsupported data type: must be ROC, FROC or LROC.\n")
if (!(design %in% c("FCTRL", "SPLIT-PLOT-A", "SPLIT-PLOT-C"))) stop("Study design must be FCTRL, SPLIT-PLOT-A or SPLIT-PLOT-C\n")
if (!(design %in% c("FCTRL"))) stop("Study design must be FCTRL.\n")

if (type == "LROC") {
if (is.na(lrocForcedMark)) stop("For LROC dataset one must set the lrocForcedMark flag to a logical")
Expand Down Expand Up @@ -227,64 +225,7 @@ checkTruthTable <- function (truthTable, lrocForcedMark)
K2 <- length(abnormalCases)
K <- (K1 + K2)

if (design == "SPLIT-PLOT-A") {

# for this design the length is twice what it needs to be
caseIDCol <- as.integer(truthTable$CaseID)[1:(L/2)]
# lesionIDCol <- as.integer(truthTable$LesionID)[1:(L/2)]
weightsCol <- truthTable$Weight[1:(L/2)]
# preserve the strings; DO NOT convert to integers
J <- 0 # find max number of readers, given that his data has 3 readers in one group and 4 in the other group
for (el in 1:length(readerIDCol)) {
if (length(strsplit(readerIDCol[el], split = ",")[[1]]) > J) J <- length(strsplit(readerIDCol[el], split = ",")[[1]])
}
rdrArr <- array(dim = c(L,J))
for (l in 1:L) {
val <- strsplit(readerIDCol[l], split = ",|\\s")[[1]]
val <- val[val != ""]
for (i in 1:length(val)) {
rdrArr[l,i] <- val[i]
}
}
# preserve the strings; DO NOT convert to integers
I <- length(strsplit(modalityIDCol[1], split = ",")[[1]])
trtArr <- array(dim = c(L,I))
for (l in 1:L) {
if (grep("^\\(.\\)", modalityIDCol[l]) == 1) { # match found to something like (1), i.e., one nested factor
val <- grep("^\\(.\\)", modalityIDCol[l], value = T)
val <- strsplit(val, split = "\\(|\\)")[[1]]
val <- val[val != ""]
for (i in 1:length(val)) {
trtArr[l] <- val[i]
}
} else stop("Was expecting nested notation, using () brackets ...")
}
} else if (design == "SPLIT-PLOT-C") {

# preserve the strings; DO NOT convert to integers
J <- length(strsplit(readerIDCol[1], split = ",")[[1]])
rdrArr <- array(dim = c(L,J))
for (l in 1:L) {
if (grep("^\\(.\\)", readerIDCol[l]) == 1) { # match found to something like (1), i.e., one nested factor
val <- grep("^\\(.\\)", readerIDCol[l], value = T)
val <- strsplit(val, split = "\\(|\\)")[[1]]
val <- val[val != ""]
for (i in 1:length(val)) {
rdrArr[l] <- val[i]
}
} else stop("Was expecting nested notation, using () brackets ...")
# preserve the strings; DO NOT convert to integers
I <- length(strsplit(modalityIDCol[1], split = ",")[[1]])
trtArr <- array(dim = c(L,I))
for (l in 1:L) {
val <- strsplit(modalityIDCol[l], split = ",|\\s")[[1]]
val <- val[val != ""]
for (i in 1:length(val)) {
trtArr[l,i] <- val[i]
}
}
}
} else if (design == "FCTRL") {
if (design == "FCTRL") {
# preserve the strings; DO NOT convert to integers
J <- length(strsplit(readerIDCol[1], split = ",")[[1]]) # bug non-character input error for HUGE dataset
rdrArr <- array(dim = c(L,J))
Expand All @@ -307,13 +248,8 @@ checkTruthTable <- function (truthTable, lrocForcedMark)
}
} else stop("incorrect design value")

if (design == "SPLIT-PLOT-A") {
rdrArr1D <- t(unique(rdrArr)) # rdrArr is 2-dimensional; rdrArr1D is a one-dimensional array of all the readers in the study
rdrArr1D <- rdrArr1D[!is.na(rdrArr1D)] # this modification is needed for HYK dataset with 3 readers in one group and 4 in the other
} else {
if (any(is.na(rdrArr))) stop("Illegal value in ReaderID column in Truth sheet")
rdrArr1D <- as.vector(unique(rdrArr)) # rdrArr is 2-dimensional; rdrArr1D is a one-dimensional array of all the readers in the study
}
if (any(is.na(trtArr))) stop("Illegal value in ModalityID column in Truth sheet")
trtArr1D <- as.vector(unique(trtArr))

Expand All @@ -324,18 +260,7 @@ checkTruthTable <- function (truthTable, lrocForcedMark)
for (l in 1:L) {
k <- which(unique(truthTableSort$CaseID) == truthTable$CaseID[l])
el <- lesionIDCol[l] + 1
if (design == "SPLIT-PLOT-A") {
i <- which(unique(trtArr) == trtArr[l])
for (j1 in 1:length(rdrArr[l,])) {
j <- which(rdrArr1D == rdrArr[l,j1])
truthTableStr[i, j, k, el] <- 1
}
}
else if (design == "SPLIT-PLOT-C") {
i <- which(unique(trtArr) == trtArr[l,])
j <- which(rdrArr1D == rdrArr[l])
truthTableStr[i, j, k, el] <- 1
} else if (design == "FCTRL") {
if (design == "FCTRL") {
i <- which(unique(trtArr) == trtArr[l,])
j <- which(rdrArr1D == rdrArr[l,])
truthTableStr[i, j, k, el] <- 1
Expand Down
6 changes: 1 addition & 5 deletions R/ORAnalysisFactorial.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ ORAnalysisFactorial <- function(dataset, FOM, FPFValue, alpha = 0.05, covEstMeth
}


# 5/30/20 returning zeroes instead of NAs; simplifies handling of SPLIT-PLOT-C dataseets
FOMijk2VarCov <- function(resampleFOMijk, varInflFactor) {

I <- dim(resampleFOMijk)[1]
Expand All @@ -119,8 +118,6 @@ FOMijk2VarCov <- function(resampleFOMijk, varInflFactor) {

Var <- 0
count <- 0
I <- dim(covariances)[1]
J <- dim(covariances)[3]
for (i in 1:I) {
for (j in 1:J) {
Var <- Var + covariances[i, i, j, j]
Expand Down Expand Up @@ -179,8 +176,7 @@ FOMijk2VarCov <- function(resampleFOMijk, varInflFactor) {
Var = Var,
Cov1 = Cov1,
Cov2 = Cov2,
Cov3 = Cov3,
CovMatrix = covariances
Cov3 = Cov3
))

}
Expand Down
Loading

0 comments on commit 444e514

Please sign in to comment.