Learn R Programming

Generate interactive ROC plots from R using ggplot

Most ROC curve plots obscure the cutoff values and inhibit interpretation and comparison of multiple curves. This attempts to address those shortcomings by providing plotting and interactive tools. Functions are provided to generate an interactive ROC curve plot for web use, and print versions. An interactive Shiny application is also included.

Installation

This is the development version of the package. It can be installed from github with

remotes::install_github("sachsmc/plotROC")

Basic usage

See examples live here

Acknowledgements

This package would not be possible without the following:

Citation

Read the code snippet article at JSS!

Michael C. Sachs (2017). plotROC: A Tool for Plotting ROC Curves. Journal of Statistical Software, Code Snippets, 79(2), 1-19. doi:10.18637/jss.v079.c02

A BibTeX entry for LaTeX users is

@Article{sachs2017plotROC,
    title = {{plotROC}: A Tool for Plotting ROC Curves},
    author = {Michael C. Sachs},
    journal = {Journal of Statistical Software, Code Snippets},
    year = {2017},
    volume = {79},
    number = {2},
    pages = {1--19},
    doi = {10.18637/jss.v079.c02},
  }

License

The MIT License (MIT)

Copyright (c) 2022 Michael C Sachs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copy Link

Version

Install

install.packages('plotROC')

Monthly Downloads

3,312

Version

2.3.1

License

MIT + file LICENSE

Maintainer

Last Published

October 6th, 2023

Functions in plotROC (2.3.1)

verify_d

Check that D is suitable for using as binary disease status
calc_auc

Calculate the Area under the ROC curve
melt_roc

Transform biomarkers stored as wide to long
export_interactive_roc

Generate svg code for an ROC curve object
ggroc

Plot an ROC curve
calculate_roc

Calculate the Empirical ROC curve
getD3

Reads included JavaScript functions and returns them as a string for pasting into a webpage
calculate_multi_roc

Calculate the Empirical ROC curves for multiple biomarkers
direct_label

Add direct labels to a ROC plot
plot_journal_roc

Plot an ROC curve for use in print
plot_interactive_roc

Generate a standalone html document displaying an interactive ROC curve
style_roc

Add guides and annotations to a ROC plot
multi_ggroc

Plot multiple ROC curves
shiny_plotROC

Start the plotROC Shiny app
GeomRoc

Empirical Receiver Operating Characteristic Curve
geom_rocci

Confidence regions for the ROC curve
StatRocci

Calculate confidence regions for the empirical ROC curve
StatRoc

Calculate the empirical Receiver Operating Characteristic curve
roc_key

Key for ROC geom
plotROC

Tools for plotting ROC Curves