is_monotonic: Verify monotonicity condition of default rates

Description Usage Arguments Details Value Examples

View source: R/utilities.R

Description

Verify if a list of bins is monotonic in terms of default rates. The function is_monotonic returns a boolean indicating TRUE if the default rates exhibit a monotonic trend.

Usage

1
is_monotonic(list_of_bins, decreasing = TRUE, verbose = FALSE)

Arguments

list_of_bins

A list of bins. Every bin object contains a default rate.

decreasing

A boolean. Should the monotonicity test verify a decrease or increase in default rates?

verbose

A boolean. If set to TRUE, prints a matrix of default rates along with a binary indicator displaying 1 where the monotonic relationships fails to hold.

Details

A list of bins of length N contains N default rates. The monotonic condition tested by this function examines whether the N default rates decrease (or increase) for each consecutive default rate in the list. The test is non-strict, meaning that if the default rates between any two adjacent bins are equal this is not considered a breach of monotonicity.

Value

A boolean. TRUE indicates a monotonic development in default rates across all bins in list_of_bins.

Examples

1
2
3
# create a set of initial bins and verify where monotonicity fails
bins <- create_initial_bins(bin_data, 30, "score", "default")
is_monotonic(bins, verbose = TRUE)

rrunner/binsmlr documentation built on July 19, 2020, 12:41 a.m.