What does the forced inclusion of the "direction" argument in the roc function (pROC package in R) do?

I want to create a roc object using the roc function of the pROC package in R and build a roc object. However, I'm not sure what the "direction" argument is. the median predictor values ​​of my control are less than the median predictor values ​​for the cases. so I believe the correct direction should be "<". But if I build it with the direction argument '>'. he just flipped the ROC curve diagonally as a mirror image. I'm wondering in this situation that the data tells you one thing and the argument pushes the other direction, what is compared to what and how is the comparison obtained? I have read pROC's manual on this function for the direction argument and the explanation is very short and implicit.

Hope to hear some of your data!

+3


source to share


1 answer


What the argument direction

is is to define how the negativity (or positivity) of an observation is determined.

To calculate the sensitivity and specificity at the t threshold, you must compare it to each observation o_i. With direction="<"

o_i, it will be considered positive if o_i> = t, negative otherwise. With direction=">"

o_i it will be considered positive if o_i <= t, negative otherwise.



If you want to see the source code take a look roc.utils.perfs.all.safe

.

So, when you changed the direction of the ROC curve, you changed all the positive and negative predictions significantly, which is equivalent to changing the ROC curve.

+3


source







All Articles