\HeaderA{rocdemo.sca}{function to build objects of class 'rocc'}{rocdemo.sca}
\aliasA{dxrule.sca}{rocdemo.sca}{dxrule.sca}
\keyword{models}{rocdemo.sca}
\begin{Description}\relax
rocdemo.sca -- demonstrate 'rocc' class construction
using a scalar marker and simple functional rule
\end{Description}
\begin{Usage}
\begin{verbatim}
rocdemo.sca(truth, data, rule=NULL, 
       cutpts=NA,
       markerLabel="unnamed marker", caseLabel="unnamed diagnosis")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{truth}] true classification of objects. Must take values 0 or 1.
\item[\code{data}] quantitative markers used to classify
\item[\code{rule}] rule: a function with arguments (x, thresh) returning 0
or 1. If no rule is provided the standard rule \code{dxrule.sca} is
assumed and a faster implementation utilized.
\item[\code{cutpts}] values of thresholds
\item[\code{markerLabel}] textual label describing marker
\item[\code{caseLabel}] textual label describing classification
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
dxrule.sca is function (x, thresh) ifelse(x > thresh, 1, 0)

The default value of argument cutpts is a point less than min(data), points
separating the unique values of data and a point greater than max(data).
\end{Details}
\begin{Value}
an object of S4 class rocc
\end{Value}
\begin{Note}\relax
\end{Note}
\begin{Author}\relax
Vince Carey (stvjc@channing.harvard.edu)
\end{Author}
\begin{References}\relax
\end{References}
\begin{SeeAlso}\relax
AUC
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
set.seed(123)
R1 <- rocdemo.sca( rbinom(40,1,.3), rnorm(40), caseLabel="new case", markerLabel="demo Marker" )
plot(R1, line=TRUE, show.thresh=TRUE)

truth <- c(0, 1, 0, 1, 1, 0, 1, 1)
data <- c(2, 3, 4, 4, 5, 6, 7, 8)
R2 <- rocdemo.sca(truth, data, dxrule.sca)
plot(R2, line=TRUE, show.thresh=TRUE)
R3 <- rocdemo.sca(truth, data, function(x, thresh) 1 - dxrule.sca(x, thresh))
if (AUC(R2) + AUC(R3) != 1) stop('Sum of AUCs should be 1.')
\end{ExampleCode}
\end{Examples}


