Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7499965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:00:06+00:00 2026-05-29T20:00:06+00:00

Given such data: #Cutpoint SN (1-PPV) 5 0.56 0.01 7 0.78 0.19 9 0.91

  • 0

Given such data:

#Cutpoint         SN   (1-PPV)
5       0.56    0.01
7       0.78    0.19
9       0.91    0.58

How can I plot ROC curve with R that produce similar result like the
attached image?

I know ROCR package but it doesn’t take such input.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:00:11+00:00Added an answer on May 29, 2026 at 8:00 pm

    If you just want to create the plot (without that silly interpolation spline between points) then just plot the data you give in the standard way, prepending a point at (0,0) and appending one at (1,1) to give the end points of the curve.

    ## your data with different labels
    dat <- data.frame(cutpoint = c(5, 7, 9),
                      TPR = c(0.56, 0.78, 0.91),
                      FPR = c(0.01, 0.19, 0.58))
    
    ## plot version 1    
    op <- par(xaxs = "i", yaxs = "i")
    plot(TPR ~ FPR, data = dat, xlim = c(0,1), ylim = c(0,1), type = "n")
    with(dat, lines(c(0, FPR, 1), c(0, TPR, 1), type = "o", pch = 25, bg = "black"))
    text(TPR ~ FPR, data = dat, pos = 3, labels = dat$cutpoint)
    abline(0, 1)
    par(op)
    

    To explain the code: The first plot() call sets up the plotting region, without doing an plotting at all. Note that I force the plot to cover the range (0,1) in both axes. The par() call tells R to plot axes that cover the range of the data – the default extends them by 4 percent of the range on each axis.

    The next line, with(dat, lines(....)) draws the ROC curve and here we prepend and append the points at (0,0) and (1,1) to give the full curve. Here I use type = "o" to give both points and lines overplotted, the points are represented by character 25 which allows it to be filled with a colour, here black.

    Then I add labels to the points using text(....); the pos argument is used to position the label away from the actual plotting coordinates. I take the labels from the cutpoint object in the data frame.

    The abline() call draws the 1:1 line (here the 0, and 1 mean an intercept of 0 and a slope of 1 respectively.

    The final line resets the plotting parameters to the defaults we saved in op prior to plotting (in the first line).

    The resulting plot looks like this:

    enter image description here

    It isn’t an exact facsimile and I prefer the plot using the default for the axis ranges(adding 4 percent):

    plot(TPR ~ FPR, data = dat, xlim = c(0,1), ylim = c(0,1), type = "n")
    with(dat, lines(c(0, FPR, 1), c(0, TPR, 1), type = "o", pch = 25, bg = "black"))
    text(TPR ~ FPR, data = dat, pos = 3, labels = dat$cutpoint)
    abline(0, 1)
    

    enter image description here

    Again, not a true facsimile but close.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Another stupid question here regarding a SQL scenario. Given data such as: FieldKey DocumentKey
I am trying to sample a data frame from a given data frame such
Hey guys, given a data set in plain text such as the following: ==Events==
Given a string such as: 23,234,456 first second third How can I split string
Given a string such as: new/path - path/path/03 - filename.ext, how can I use
Given such data UserID, MovieType , year 1, 2, 2000 1, 3, 2000 1,
Given data such as : user, library ID, book ID, year 1,10, 100,2000 2,10,
Given data such as Type Value A This A is B Will A a
I have data in a table that looks like the following sample data: varchar(20)
I'm trying to rotate an array such that given a number and an array,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.