ksplot.rocit | R Documentation |
Generates cumulative density of diagnostic variable in positive and negative responses.
## S3 method for class 'rocit'
ksplot(
object,
col = c("#26484F", "#BEBEBE", "#FFA54F"),
lty = c(1, 1, 1),
legend = T,
legendpos = "bottomright",
values = T,
... = NULL
)
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. |
... |
|
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)$.
If values = TRUE
, then Cutoff, F(c), G(c), KS stat,
KS Cutoff are returned silently.
Customized plots can be made by using the returned values of the function.
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`)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.