ksplot.rocit {ROCit} | R Documentation |
KS Plot
Description
Generates cumulative density of diagnostic variable in positive and negative responses.
Usage
## S3 method for class 'rocit'
ksplot(
object,
col = c("#26484F", "#BEBEBE", "#FFA54F"),
lty = c(1, 1, 1),
legend = T,
legendpos = "bottomright",
values = T,
... = NULL
)
Arguments
object |
An object of class |
col |
Colors to be used for plot. Minimum three colors need to be supplied for F(c), G(c) and KS Stat mark. |
lty |
Line types of the plots. |
legend |
A logical value indicating whether legends to appear in the plot. |
legendpos |
Position of the legend. A single keyword from
|
values |
A logical value, indicating whether values to be returned. |
... |
|
Details
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)$.
Value
If values = TRUE
, then Cutoff, F(c), G(c), KS stat,
KS Cutoff are returned silently.
Note
Customized plots can be made by using the returned values of the function.
Examples
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`)