What does coercing the “direction” argument input in roc function (package pROC in R) do exactly?

雨燕双飞 提交于 2020-01-03 16:46:27

问题


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 controls is smaller than the median predictor value of the cases. so I think the correct direction should be '<'. But if I plot it with direction argument '>'. it just flipped the ROC curve across the diagonal line as a mirror image. I am wondering in this situation that, data telling you 1 thing, and the argument is coercing a different direction, what is being compared to what, and how is the comparison made? I read through the pROC manual on this function for the argument 'direction', and the explanation is very brief and unclear.

Hope to hear some of your input!


回答1:


What the direction argument does is to determine how the negativity (or positivity) of an observation is determined.

To compute sensitivity and specificity at a threshold t, you must compare it with each of the observation o_i. With direction="<", o_i will be considered positive if o_i >= t, negative otherwise. With direction=">", o_i will be considered positive if o_i <= t, negative otherwise.

If you want to look at the source code, check out the roc.utils.perfs.all.safe function.

So when you changed the direction of your ROC curve, you essentially reversed all the positive and negative predictions, which is equivalent to reversing the ROC curve.



来源:https://stackoverflow.com/questions/31756682/what-does-coercing-the-direction-argument-input-in-roc-function-package-proc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!