1
# pROC: Tools Receiver operating characteristic (ROC curves) with
2
# (partial) area under the curve, confidence intervals and comparison. 
3
# Copyright (C) 2010-2014 Xavier Robin, Alexandre Hainard, Natacha Turck,
4
# Natalia Tiberti, Frédérique Lisacek, Jean-Charles Sanchez
5
# and Markus Müller
6
#
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19

20
lines.roc <- function(x, ...) {
21 16
  UseMethod("lines.roc")
22
}
23

24
lines.roc.formula <- function(x, data, subset, na.action, ...) {
25 16
	data.missing <- missing(data)
26 16
	call <- match.call()
27 16
	names(call)[2] <- "formula" # forced to be x by definition of lines
28 16
	roc.data <- roc.utils.extract.formula(formula=x, data, subset, na.action, ..., 
29 16
										  data.missing = data.missing,
30 16
										  call = call)
31 16
	if (length(roc.data$predictor.name) > 1) {
32 0
		stop("Only one predictor supported in 'lines.roc'.")
33
	}
34 16
	response <- roc.data$response
35 16
	predictor <- roc.data$predictors[, 1]
36 16
	roc <- roc(response, predictor, ...)
37 16
	lines.roc.roc(roc, ...)
38 16
	roc$call <- match.call()
39 16
	invisible(roc)
40
}
41

42
lines.roc.default <- function(x, predictor, ...) {
43 0
  roc <- roc(x, predictor, ...)
44 0
  lines.roc.roc(roc, ...)
45 0
  roc$call <- match.call()
46 0
  invisible(roc)
47
}
48

49
lines.roc.smooth.roc <- lines.smooth.roc <- function(x, ...) {
50 16
  lines.roc.roc(x, ...) # force usage of lines.roc.roc
51
}
52

53
lines.roc.roc <- function(x, lwd=2, ...) {
54 16
  suppressWarnings(lines(x$sp, x$se, lwd=lwd, ...))
55 16
  invisible(x)
56
}

Read our documentation on viewing source code .

Loading