Package 'rawKS'

Title: Easily Get True-Positive Rate and False-Positive Rate and KS Statistic
Description: The Kolmogorov-Smirnov (K-S) statistic is a standard method to measure the model strength for credit risk scoring models. This package calculates the K–S statistic and plots the true-positive rate and false-positive rate to measure the model strength. This package was written with the credit marketer, who uses risk models in conjunction with his campaigns. The users could read more details from Thrasher (1992) <doi:10.1002/dir.4000060408> and 'pyks' <https://pypi.org/project/pyks/>.
Authors: Jiaxiang Li [aut, cre]
Maintainer: Jiaxiang Li <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-04 04:03:56 UTC
Source: https://github.com/jiaxiangbu/rawks

Help Index


Plot KS chart

Description

Plot KS chart

Usage

ks_plot(df)

Arguments

df

data.frame created by ks_table

Value

The 'ggplot2' object

Examples

data("two_class_example_edited")
max(ks_table(two_class_example_edited$yhat, two_class_example_edited$y)$ks)
ks_table(two_class_example_edited$yhat, two_class_example_edited$y) %>%
  ks_plot()

Get KS statistics

Description

Output a data.frame with inputs (y, yhat) and tpr, fpr and ks.

Usage

ks_table(yhat, y)

Arguments

yhat

numeric the value predicted by your model.

y

numeric the target values.

Value

The data frame containing tpr, fpr and ks.

Examples

data("two_class_example_edited")
max(ks_table(two_class_example_edited$yhat, two_class_example_edited$y)$ks)

A sample with the target and predictions

Description

A dataset containing two columns, yhat and y as the inputs for the function ks_table.

Usage

two_class_example_edited

Format

A data frame with 500 rows and 2 variables:

yhat

predictions

y

target

Source

package yardstick::two_class_example