% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/calc_roc.R
\name{calc_roc.rfsrc}
\alias{calc_roc.rfsrc}
\alias{calc_roc.randomForest}
\alias{calc_roc}
\title{Receiver Operator Characteristic calculator}
\usage{
\method{calc_roc}{rfsrc}(object, dta, which_outcome = "all", oob = TRUE, ...)
}
\arguments{
\item{object}{A fitted \code{\link[randomForestSRC]{rfsrc}},
\code{\link[randomForestSRC]{predict.rfsrc}}, or
\code{\link[randomForest]{randomForest}} classification object containing
predicted class probabilities.}

\item{dta}{A factor (or coercible to factor) of the true observed class
labels, one per observation. Typically \code{object$yvar} for rfsrc or
\code{object$y} for randomForest.}

\item{which_outcome}{Integer index of the class for which the ROC curve is
computed (e.g. \code{1} for the first class, \code{2} for the second).
Use \code{"all"} to request all classes (currently falls back to class 1
with a warning).}

\item{oob}{Logical; if \code{TRUE} (default for rfsrc) use OOB predicted
probabilities. Forced to \code{FALSE} for \code{randomForest} objects.}

\item{...}{Extra arguments passed to helper functions (currently unused).}
}
\value{
A \code{gg_roc} \code{data.frame} with columns \code{sens}
  (sensitivity), \code{spec} (specificity), and \code{pct} (the probability
  threshold), with one row per unique prediction value. Suitable for passing
  to \code{\link{calc_auc}} or \code{\link{plot.gg_roc}}.
}
\description{
Receiver Operator Characteristic calculator
}
\details{
For a randomForestSRC prediction and the actual
response value, calculate the specificity (1-False Positive Rate) and
sensitivity (True Positive Rate) of a predictor.

This is a helper function for the \code{\link{gg_roc}} functions, and
not intended for use by the end user.
}
\examples{
## Taken from the gg_roc example
rfsrc_iris <- rfsrc(Species ~ ., data = iris)

gg_dta <- calc_roc(rfsrc_iris, rfsrc_iris$yvar,
  which_outcome = 1, oob = TRUE
)
gg_dta <- calc_roc(rfsrc_iris, rfsrc_iris$yvar,
  which_outcome = 1, oob = FALSE
)

rf_iris <- randomForest(Species ~ ., data = iris)
gg_dta <- calc_roc(rf_iris, rf_iris$yvar,
  which_outcome = 1
)
gg_dta <- calc_roc(rf_iris, rf_iris$yvar,
  which_outcome = 2
)

}
\seealso{
\code{\link{calc_auc}} \code{\link{gg_roc}}

\code{\link{plot.gg_roc}}
}
