Questions tagged [proc-r-package]
pROC is an R package for ROC curves.
80
questions
8
votes
2
answers
8k
views
Get optimal threshold with at least 75% sensitivity with pROC in R
I have a dataframe with two columns : score1 which is numeric and truth1 which is boolean.
I want to predict truth1 using score1. To do that, I want a simple linear model, and then ask for a good ...
7
votes
2
answers
8k
views
Changing scale of the ROC chart
I am using the following code to plot the ROC curve after having run the logistic regression.
fit1 <- glm(formula=GB160M3~Behvscore, data=eflscr,family="binomial", na.action = na.exclude)
prob1=...
6
votes
3
answers
14k
views
How to deal with multiple class ROC analysis in R (pROC package)?
When I use multiclass.roc function in R (pROC package), for instance, I trained a data set by random forest, here is my code:
# randomForest & pROC packages should be installed:
# install....
5
votes
1
answer
5k
views
What does coercing the "direction" argument input in roc function (package pROC in R) do exactly?
I want to create a roc object by using the function 'roc' of pROC package in R, and plot the roc object. However, I am uncertain what the 'direction' argument does. the median predictor values of my ...
4
votes
3
answers
20k
views
ROC function error "Predictor must be numeric or ordered."
I am not able to get ROC function to work, I get the error "Predictor must be numeric or ordered".
I've looked through other posts, but nothing solves my problem. Any help is highly appreciated.
"...
4
votes
1
answer
4k
views
R - ROC Curves/AUC Specificity vs 1-Specificity
I have created a few predictive models and I am in the process of evaluating them by looking at the ROC Curve and AUC.
Currently, I have Specificity on X axis, however, when I researched ROC Curves, ...
4
votes
3
answers
3k
views
pROC ROC curves remove empty space
I want to draw ROC curves with pRoC.
However for some reason there is extra empty space on either side of the x-axis and I cannot remove it with xlim. Some example code:
library(pROC)
n = c(4, 3, 5)
...
4
votes
1
answer
4k
views
How to draw multiple roc curves with confidence interval in pROC?
This code can draw a roc curve with confidence interval:
ciobj <- ci.se(obj, specificities=seq(0, 1, l=25))
dat.ci <- data.frame(x = as.numeric(rownames(ciobj)),
lower = ...
4
votes
1
answer
4k
views
How to get p value after ROC analysis with pRoc package?
After ROC analysis of a set of data, how to calculate p-value? With the same statistics, I saw that the p-value can be output in SPSS.
The sample code is as follows:
library(pROC)
data(aSAH)
head(...
4
votes
1
answer
120
views
Use pROC package with h2o
I'm doing a binary classification with a GBM using the h2o package. I want to assess the predictive power of a certain variable, and if I'm correct I can do so by comparing the AUC of a model with the ...
4
votes
1
answer
2k
views
faced_wrap plot with pROC package in R (several variables)
I have three independent variable and a single binary outcome variable. I'm using pROC package for the analysis and would like to present all three ROC plots next to each other, similar to face_wrap ...
3
votes
1
answer
1k
views
Difference in average AUC computation using ROCR and pROC (R)
I am working with cross-validation data (10-fold repeated 5 times) from a SVM-RFE model generated with the caret package. I know that caret package works with pROC package when computing metrics but I ...
3
votes
2
answers
2k
views
Is it possible to insert a line of no discrimination in ROC plot using ggroc?
I have created a ROC plot with multiple ROC-curves using ggroc based on pROC. How can I insert a line of no discrimination?
I would like to have a line of no discrimination from 0,0 to 1,1 in my plot,...
3
votes
2
answers
4k
views
Error running pROC in R: Response and predictor must be vectors of the same length
I've called a multiple logistic regression as follows:
step_1 <- glm(CD3LR ~ alb + surg + ASA_opt + BMI + bil + Hb_cat + MDRD + sex + DM
+ age + Path + Smoking,
na....
3
votes
2
answers
853
views
Calculating multiple ROC curves in R using a for loop and pROC package. What variable to use in the predictor field?
I am using the pROC package and I want to calculate multiple ROC curve plots using a for loop.
My variables are specific column names that are included as string in a vector and I want pROC to read ...
3
votes
1
answer
6k
views
Specificity/Sensitivity vs cut-off points using pROC package
I need to plot the following graph so I can choose the optimal threshold for a logistic regression model.
However I can't use the packages (epi and roc) which are used in many of the research I have ...
3
votes
1
answer
2k
views
White margins within R plot using plot.roc() function
I was trying to create a figure similar to one on a website. However, I encountered a more basic issue: there is some white space within my R plot that I would like to get rid of. This is using the ...
3
votes
1
answer
11k
views
SVM in R: "Predictor must be numeric or ordered."
I'm new to R and I've ran into this problem: I want to compare two prediction techniques (Support Vector Machines and Neural Networks) applying them to some data and I would like to compare their ...
3
votes
3
answers
5k
views
roc() function in pROC package: usage of controls and cases with its context
Can someone explain what the controls and cases arguments mean in the roc() function from the pROC package in R, and how to use them? How to check the number of controls and cases available in the ...
3
votes
1
answer
195
views
Change default arguments of ROC computation (pROC) in the RFE process (caret) - R
I am computing a SVM-RFE model using "ROC" as the metric, with the rfe function (caret package). To my knowledge, the rfe algorithm optimizes the AUC values using the roc function of the pROC package, ...
3
votes
2
answers
6k
views
pROC R package with customized cutoff values?
Can I use some pre-specified cutoff values (thresholds) to plot a ROC curve with the pROC package? For example, can I input control/case values and my own threshold points where to calculate ...
3
votes
1
answer
4k
views
How to add AUC to a multiple ROC graph with pROC's ggroc
I have a list of elements of the class "roc" (l_rocs) which I want to plot with ggroc from the package pROC
library("ggplot2")
library("pROC")
#inside a bigger loop
...
3
votes
1
answer
13k
views
ROC curves for Random Forest fit objects using pROC in R, to use positve or negative "votes" as predictor
Obese is a binary response var with 1 indicating obese and 0 not obese.
Weight is a continuous predictor.
using a RF to classify obese:
library(randomFores)
rf <- randomForest(factor(obese)~...
3
votes
1
answer
1k
views
CI of PPV and NPV using pROC
I've been using the pROC package in R to generate bootstrapped confidence intervals for SP and SN values corresponding to specific thresholds. However, I've been unable to find a way to generate CI's ...
3
votes
1
answer
2k
views
R multiclass/multinomial classification ROC using multiclass.roc (Package ‘pROC’)
I am having difficulties understanding how the multiclass.roc parameters should look like.
Here a snapshot of my data:
> head(testing.logist$cut.rank)
[1] 3 3 3 3 1 3
Levels: 1 2 3
> head(mnm....
2
votes
1
answer
27k
views
How can I draw a ROC curve for a randomForest model with three classes in R?
I'm using the R package, randomForest, to create a model that classifies into three groups.
model = randomForest(formula = condition ~ ., data = train, ntree = 2000,
...
2
votes
1
answer
3k
views
pROC package to compute AUC
Looking at the pROC package I am a bit confused about response and predictor:
response: a factor, numeric or character vector of responses, typically encoded with 0
(controls) and 1 (cases). The ...
2
votes
1
answer
1k
views
Using pROC package in R to obtain CI for SP and SN from specific threshold
Using the pROC package, is anyone aware of a way to get confidence intervals for SP and SN with an input of a specific threshold value, rather than a specific SP or SN value? ci() appears to only ...
2
votes
2
answers
411
views
Issue computing AUC with pROC package
I'm trying to use a function that calls on the pROC package in R to calculate the area under the curve for a number of different outcomes.
# Function used to compute area under the curve
proc_auc <-...
2
votes
1
answer
1k
views
Limiting decimals of AUC to be printed with with ROC curve in pROC
I have successfully created a plot with multiple ROC curves of different prediction models in the same plot and the numerical value of the AUC and CI is printed nicely on the side.
However it makes no ...
2
votes
2
answers
523
views
How does pROC handle multi-level factor labels?
I am calculating the AUC of a model in R. The model has been trained to predict a two-level factor (good/bad). It has been applied to data that have a three-level outcome (good/bad/missing). I am fine ...
2
votes
2
answers
1k
views
R: pROC package: plot ROC curve across specific range?
I would like to plot a segment of an ROC curve over a specific range of x values, instead of plotting the entire curve. I don't want to change the range of the x axis itself. I just want to plot ...
2
votes
1
answer
488
views
R: pROC package: entering data as hit rates and false alarm rates?
Q: Is there a way to import data in the form of hit rates and false alarm rates into a roc object with the pROC R package?
Background: In cognitive psychology we use the term "hit rate" which is ...
2
votes
2
answers
1k
views
R: how to plot ROC for logistic regression model whit missing values
I have a logistic regression model and I'd like to plot ROC curve. All variables have some missing data. Here's the summary:
X<-cbind(outcome, var1, var2)
summary(X)
# outcome var1 ...
2
votes
1
answer
829
views
What are the algorithms used in the pROC package for ROC analysis?
I am trying to figure out what algorithms are used within the pROC package to conduct ROC analysis. For instance what algorithm corresponds to the condition 'algorithm==2'? I only recently started ...
2
votes
1
answer
511
views
What prediction format should be the input for ROC function
I am trying to calculate the ROC of a target variable that is binary(0,1) versus a decision tree prediction.
When I set the prediction value to be binary, it gives me the following error:
> roc(...
2
votes
1
answer
385
views
pROC package with pre-specified cutoff values with two decimals
In the roc function of pROC package I would like to print my specific cutoff values (print.thres parameter) with two decimal digits, because one cutoff is 0.05 and in the plot appears as 0.0 Any ...
1
vote
1
answer
937
views
ROC Curve in Shiny
I am trying to render roc curve using shiny. I tried using both pROC and ROCR packages, and using renderPlot, but the outputplot showing NULL. Is there any way to render ROC Curve in shiny app?
1
vote
2
answers
2k
views
R and Random Forest: How caret and pROC deal with positive and negative class?
In the past days, I've been analyzing the performance of R's implementation of Random Forest and the different tools available in order to obtain:
AUC
Sensitivity
Specificity
Thus, I've used two ...
1
vote
1
answer
2k
views
Specying the positive class in pROC package
I want to calculate different classification metrics (sensitivity, specificity) using pROC package. For that, I can use coords function in pROC package as:
# Load library
library(pROC)
# Load data
...
1
vote
1
answer
635
views
Why the 95%CI value calculated by different functions of pROC Package were different?
I'm using the pROC package to calculate the specificity value and the 95%CI for the "best" threshold, my program code is as
data(aSAH)
myroc <- roc(aSAH$outcome, aSAH$s100b)
ci.thresholds(...
1
vote
1
answer
2k
views
Adding text to AUC labels using pROC
I wonder if there is a way to annotate the printed AUCs further on my ROC plots?
Currently, it's not clear which line the AUCs belong to in my plot (below). I would like to add more description so ...
1
vote
1
answer
1k
views
Able to specify thresholds for calculating TPR and FPR? using pROC
Calculating TPR and FPR using pROC package. Am i able to specify the thresholds i want in the calculation using the package?
I am to get calculate TPR and FPR for thresholds from 0 to 1, with 0.05 ...
1
vote
1
answer
1k
views
pROC plot as object?
I would like to construct a rPOC plot OBJECT that I can pass to a function and plot later. In the example below (taken from here), I can certainly plot my roc curve. But I would like to create a plot ...
1
vote
1
answer
730
views
Why is the roc function not determining cases and controls properly?
Under the default direction = "auto" setting of the roc function, it appears that cases and controls should be automatically configured such that the ROC curve for a predictor is above the ...
1
vote
1
answer
644
views
ROC Curve Plot using R (Error code: Predictor must be numeric or ordered)
I am trying to make a ROC Curve using pROC with the 2 columns as below: (the list goes on to over >300 entries)
Actual_Findings_%
Predicted_Finding_Prob
0.23
0.6
0.48
0.3
0.26
0.62
0.23
0.6
0....
1
vote
1
answer
156
views
Using a contingency table as input for pROC Package
For pROC Package. I wonder how can I use a 2x2 contingency table (TP/TN/FP/FN) instead of predictor/response input.
1
vote
1
answer
314
views
pROC median Sensitivity vs. manual Sensitivity calculation - different Results
Calculating the sensitivity manually from the confusion matrix, gives the value 0.853.
TN = 16
FP = 7
FN = 5
TP = 29
The output of pROC is different (median = 0.8235).
y_test = c(1, 1, 1, 1, 0, 1, 0,...
1
vote
1
answer
540
views
pROC test difference from AUC = 0.5
I would like to know how can I use pROC package to test whether a given AUC value is statistically significantly different from an AUC = 0.5. I can get confidence intervals but I would also like to ...
1
vote
1
answer
251
views
Confidence Interval Formula of ci.se of pROC library (R)
I have searched at the documentation of the library and I dont find what type of CI Formula uses the function ci.se for calculating the interval.
In this article https://ncss-wpengine.netdna-ssl.com/...