File: plot.ci.Rd

package info (click to toggle)
r-cran-proc 1.18.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,260 kB
  • sloc: cpp: 144; sh: 14; makefile: 2
file content (116 lines) | stat: -rw-r--r-- 3,580 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
\encoding{UTF-8}
\name{plot.ci}
\alias{plot.ci}
\alias{plot.ci.thresholds}
\alias{plot.ci.se}
\alias{plot.ci.sp}

\title{
  Plot confidence intervals
}
\description{
  This function adds confidence intervals to a ROC curve plot, either as
  bars or as a confidence shape.
}
\usage{
\S3method{plot}{ci.thresholds}(x, length=.01*ifelse(attr(x,
  "roc")$percent, 100, 1), col=par("fg"), ...)
\S3method{plot}{ci.sp}(x, type=c("bars", "shape"), length=.01*ifelse(attr(x,
"roc")$percent, 100, 1), col=ifelse(type=="bars", par("fg"),
"gainsboro"), no.roc=FALSE, ...)
\S3method{plot}{ci.se}(x, type=c("bars", "shape"), length=.01*ifelse(attr(x,
"roc")$percent, 100, 1), col=ifelse(type=="bars", par("fg"),
"gainsboro"), no.roc=FALSE, ...)
}
		   
\arguments{
  \item{x}{a confidence interval object from the functions
    \code{\link{ci.thresholds}}, \code{\link{ci.se}} or \code{\link{ci.sp}}.
  }
  \item{type}{type of plot, \dQuote{bars} or \dQuote{shape}. Can be
    shortened to \dQuote{b} or \dQuote{s}. \dQuote{shape} is only available for
    \code{ci.se} and \code{ci.sp}, not for \code{ci.thresholds}.
  }
  \item{length}{the length (as plot coordinates) of the bar ticks. Only
    if \code{type="bars"}.
  }
  \item{no.roc}{
    if \code{FALSE}, the ROC line is re-added over the
    shape. Otherwise if \code{TRUE}, only the shape is plotted. Ignored
    if \code{type="bars"}
  }
  \item{col}{color of the bars or shape.}
  \item{\dots}{further arguments for \code{\link{segments}} (if
    \code{type="bars"}) or \code{\link{polygon}} (if
    \code{type="shape"}).
  }
}

\details{
  This function adds confidence intervals to a ROC curve plot, either as
  bars or as a confidence shape, depending on the state of the
  \code{type} argument. The shape is plotted over the ROC curve, so that
  the curve is re-plotted unless \code{no.roc=TRUE}.
  
  Graphical functions are called with \link{suppressWarnings}.
}

\section{Warnings}{
  With \code{type="shape"}, the warning \dQuote{Low definition shape} is
  issued when the shape is defined by less than 15 confidence
  intervals. In such a case, the shape is not well defined and the ROC
  curve could pass outside the shape. To get a better shape, increase
  the number of intervals, for example with:
  \preformatted{plot(ci.sp(rocobj, sensitivities=seq(0, 1, .01)), type="shape")}
}

\value{
This function returns the confidence interval object invisibly.
}

\references{
  Xavier Robin, Natacha Turck, Alexandre Hainard, \emph{et al.}
  (2011) ``pROC: an open-source package for R and S+ to analyze and
  compare ROC curves''. \emph{BMC Bioinformatics}, \bold{7}, 77.
  DOI: \doi{10.1186/1471-2105-12-77}.
}

\seealso{
\code{\link{plot.roc}}, \code{\link{ci.thresholds}}, \code{\link{ci.sp}}, \code{\link{ci.se}}
}
\examples{
data(aSAH)
\dontrun{
# Start a ROC plot
rocobj <- plot.roc(aSAH$outcome, aSAH$s100b)
plot(rocobj)
# Thresholds
ci.thresolds.obj <- ci.thresholds(rocobj)
plot(ci.thresolds.obj)
# Specificities
plot(rocobj) # restart a new plot
ci.sp.obj <- ci.sp(rocobj, boot.n=500)
plot(ci.sp.obj)
# Sensitivities
plot(rocobj) # restart a new plot
ci.se.obj <- ci(rocobj, of="se", boot.n=500)
plot(ci.se.obj)

# Plotting a shape. We need more
ci.sp.obj <- ci.sp(rocobj, sensitivities=seq(0, 1, .01), boot.n=100)
plot(rocobj) # restart a new plot
plot(ci.sp.obj, type="shape", col="blue")

# Direct syntax (response, predictor):
plot.roc(aSAH$outcome, aSAH$s100b,
         ci=TRUE, of="thresholds")
}
}

\keyword{univar}
\keyword{nonparametric}
\keyword{utilities}
\keyword{aplot}
\keyword{hplot}
\keyword{roc}