Description Usage Arguments Value Examples
perf.decile
takes the actual status (actual), and the predicted
probability (pred) as inputs, divided the data into 10 decile dependent on
the ranking of the predicted values, and calculate the average predicted and
actual rates in each decile.
1 | perf.decile(actual, pred, plot = TRUE, add.legend = TRUE)
|
actual |
A vector containing the actual status for each record |
pred |
The predicted probability for each record |
plot |
Whether to show the ggplot figure |
add.legent |
Whether to add a legend for the decile color |
The predicted and actual rates in each decile and a ggplot
1 2 3 4 5 6 7 8 9 10 11 | data <- rpart::stagec
data <- data[sample(nrow(data), 10000, replace = TRUE), ]
data <- na.omit(data)
ind.train <- caret::createDataPartition(data$pgstat, p = .7, list = FALSE)
dt.train <- data[ind.train, ]
dt.test <- data[-ind.train, ]
mod <- glm(pgstat ~ ., dt.train, family=binomial(link='logit'))
pred.test <- predict(mod, newdata = dt.test, type = 'response')
perf.decile(actual = dt.test$pgstat, pred = pred.test)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.