pROC icon indicating copy to clipboard operation
pROC copied to clipboard

Add roc/auc methods for lm/glm-etc. methods.

Open jarauh opened this issue 3 years ago • 2 comments

It would be nice if there would be roc/auc-methods for objects of class lm.

The methods could have signature:

roc.lm <- function(model, newdata = NULL, ...)

The function should run predict(model, newdata = newdata, ...) to obtain predictions, extract the observed outcome from either newdata or the model and then compute the roc or auc.

jarauh avatar Oct 29 '20 08:10 jarauh

Thanks for your suggestion!

I'm not a big fan, for a few reasons:

  • There's a virtually infinite number of methods to write for every modeling class out there. Not sure where to stop?
    • As a corollary, wherever we stop, it will make life harder for users of classes that aren't covered here as there will be less documentation - at the moment it's pretty straightforward and the behavior is consistent and predictable (pun intended).
  • I always wanted to keep this step explicit. There is no actual ROC curve of a model - only on some data predicted by a model. This forces the user to think about what data they are predicting (resubstitution vs test set, etc).

Unless you have a strong argument in favor of this proposal, I'd close it as a wontfix.

xrobin avatar Oct 29 '20 13:10 xrobin

Thanks for your quick answer.

  • Concerning your first point: I agree that one needs to stop somewhere. Still, many models are of class "lm", so I assume that having a method roc.lm would cover most cases (at least those cases that try to be consistent with "lm", such as "glm" and "gam"). Basically, you only need to extract/generate predictions and outcomes. I'm not sure about the outcomes, but most models have a predict method that could be called, so things should be rather straight-forward.
    • I don't see how adding another method would make it harder for unsupported models than it is now. I admit, it's not hard at the moment, adding another method would just be a convenience.
  • I agree, the ROC curve depends on the data. However, the in-sample ROC curve, in a sense, does not so much. In any case, one may argue that the ROC curve also depends on a model - no matter whether the model is given explicitly or implicitly in the form of predictions. Where do the predictions come from if not from a model? So it makes just as much sense to me to make the model explicit.

jarauh avatar Oct 30 '20 20:10 jarauh