Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jarauh opened this issue Oct 29, 2020 · 2 comments
Open

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

jarauh opened this issue Oct 29, 2020 · 2 comments

Comments

@jarauh
Copy link

jarauh commented Oct 29, 2020

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.

@xrobin
Copy link
Owner

xrobin commented Oct 29, 2020

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.

@jarauh
Copy link
Author

jarauh commented Oct 30, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants