Generates cumulative density of diagnostic variable in positive and negative responses.
# S3 method for rocit
ksplot(
object,
col = c("#26484F", "#BEBEBE", "#FFA54F"),
lty = c(1, 1, 1),
legend = T,
legendpos = "bottomright",
values = T,
... = NULL
)
If values = TRUE
, then Cutoff, F(c), G(c), KS stat,
KS Cutoff are returned silently.
An object of class "rocit"
, returned by
rocit
function.
Colors to be used for plot. Minimum three colors need to be supplied for F(c), G(c) and KS Stat mark.
Line types of the plots.
A logical value indicating whether legends to appear in the plot.
Position of the legend. A single keyword from
"bottomright"
, "bottom"
,
"bottomleft"
, "left"
, "topleft"
,
"top"
, "topright"
, "right"
and "center"
,
as in legend
. Ignored if
legend
is FALSE
.
A logical value, indicating whether values to be returned.
NULL
. Used for S3 generic/method consistency.
This function plots the cumulative density functions $F(c)$ and $G(c) of the diagnostic variable in the negative and positive populations. If the positive population have higher value then negative curve ($F(c)$) ramps up quickly. The KS statistic is the maximum difference of $F(c)$ and $G(c)$.
data("Diabetes")
logistic.model <- glm(as.factor(dtest)~chol+age+bmi,
data = Diabetes,family = "binomial")
class <- logistic.model$y
score <- qlogis(logistic.model$fitted.values)
# -------------------------------------------------------------
roc_emp <- rocit(score = score, class = class) # default method empirical
# -------------------------------------------------------------
kplot1 <- ksplot(roc_emp)
message("KS Stat (empirical) : ", kplot1$`KS stat`)
message("KS Stat (empirical) cutoff : ", kplot1$`KS Cutoff`)
Run the code above in your browser using DataLab