Skip to content

Commit

Permalink
Minor fixes. Missing data problem is fixed. Version moved to 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dncR committed Dec 31, 2018
1 parent dccebe5 commit 6dbecaa
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
40 changes: 21 additions & 19 deletions mROC.R
Expand Up @@ -7,41 +7,43 @@ mROC <- function(data, statusName = NULL, markerName = NULL, eventValue=NULL, di

require(dplyr)

if (!is.null(markerName)){warnings("Marker variable is not specified.")}
if (!is.null(markerName)){
warnings("Marker variable is not specified.")
}

if (!is.null(markerName)){
mrknames = markerName
marker = data.frame(data[,markerName])
colnames(marker) = mrknames
mrknames <- markerName
marker <- data.frame(data[ ,markerName])
colnames(marker) <- mrknames
}

ROCstats = list()
ROCplotdata = list()
ROCstats <- list()
ROCplotdata <- list()

#if (is.null(markerName)) marker = data.frame(data[,colnames(data)[!(colnames(data) %in% statusName)]])
#if (!is.null(markerName)) {marker = data.frame(data[,markerName]); colnames(marker) = mrknames}

status = data[,statusName]
status <- data[ ,statusName]
nms <- colnames(marker)

nms = colnames(marker)
for (i in 1:dim(marker)[2]){
roc.results = rocdata(status=status,marker=marker[,i],event=eventValue,higherValuesDiseased=diseaseHigher,
roc.results <- rocdata(status = status, marker = marker[ ,i],event = eventValue, higherValuesDiseased = diseaseHigher,
ci.method = ci.method, se.method = se.method, advanced = advanced, alpha = alpha)
ROCstats[[i]] = roc.results$stats
ROCplotdata[[i]] = roc.results$roc
ROCstats[[i]] <- roc.results$stats
ROCplotdata[[i]] <- roc.results$roc
}

names(ROCstats) = names(ROCplotdata) = nms
ROCstats = ldply(ROCstats, rbind)
ROCplotdataframe = ldply(ROCplotdata, rbind)
names(ROCstats) <- names(ROCplotdata) <- nms
ROCstats <- ldply(ROCstats, rbind)
ROCplotdataframe <- ldply(ROCplotdata, rbind)

rownames(ROCstats) = NULL
colnames(ROCstats) = c("Marker", "AUC", "SE.AUC", "LowerLimit", paste("UpperLimit (*)", sep=""), "z", "p-value")
colnames(ROCplotdataframe)[1] = "Marker"
rownames(ROCstats) <- NULL
colnames(ROCstats) <- c("Marker", "AUC", "SE.AUC", "LowerLimit", paste("UpperLimit (*)", sep=""), "z", "p-value")
colnames(ROCplotdataframe)[1] <- "Marker"

ROCplotdataframe[,c("FPR","TPR")] = round(ROCplotdataframe[,c("FPR","TPR")], 4)
ROCplotdataframe[ ,c("FPR","TPR")] <- round(ROCplotdataframe[ ,c("FPR","TPR")], 4)

ROCplotdataframe <- dplyr:::arrange(ROCplotdataframe, Marker, Cutpoint)
results = list(plotdata = ROCplotdataframe, stats = ROCstats)
results <- list(plotdata = ROCplotdataframe, stats = ROCstats)
return(results)
}
5 changes: 5 additions & 0 deletions rocdata.R
Expand Up @@ -10,6 +10,11 @@ rocdata <- function(status, marker, event, higherValuesDiseased, alpha=0.05,
# roc = data.frame with x and y co-ordinates of plot
# stats = data.frame containing: area under ROC curve, p value, upper and lower 95% confidence interval

## Complete cases.
completeIdx <- complete.cases(status, marker)
status <- status[completeIdx]
marker <- marker[completeIdx]

se.method = match.arg(se.method)
ci.method = match.arg(ci.method)

Expand Down
6 changes: 5 additions & 1 deletion ui.R
@@ -1,6 +1,6 @@
shinyUI(pageWithSidebar(

titlePanel("easyROC: a web-tool for ROC curve analysis (ver. 1.3)"),
titlePanel("easyROC: a web-tool for ROC curve analysis (ver. 1.3.1)"),

sidebarPanel(width = 3,
conditionalPanel(condition="input.tabs1=='Introduction'",
Expand Down Expand Up @@ -1094,6 +1094,10 @@ shinyUI(pageWithSidebar(
HTML('<br>'),

h4("News"),
HTML('<br>'),
HTML('<p><b> Version 1.3.1 (July 25, 2016)</b><p>'),
HTML('<p> (1) Minor fixes: Added feature to keep only pairwise complete data. Missing cases are now removed before ROC curve analysis which causes to null return in ROC statistics.<p>'),

HTML('<br>'),
HTML('<p><b> Version 1.3 (July 25, 2016)</b><p>'),
HTML('<p> (1) Support for prametric ROC curve approximation.<p>'),
Expand Down

0 comments on commit 6dbecaa

Please sign in to comment.