get_psi_iv_all {creditmodel}R Documentation

Calculate IV & PSI

Description

get_iv_psi is used to calculate Information Value (IV) and Population Stability Index (PSI) of an independent variable. get_iv_psi_all can loop through IV & PSI for all specified independent variables.

Usage

get_psi_iv_all(
  dat,
  dat_test = NULL,
  x_list = NULL,
  target,
  ex_cols = NULL,
  pos_flag = NULL,
  breaks_list = NULL,
  occur_time = NULL,
  oot_pct = 0.7,
  equal_bins = FALSE,
  cut_bin = "equal_depth",
  tree_control = NULL,
  bins_control = NULL,
  bins_total = FALSE,
  best = TRUE,
  g = 10,
  as_table = TRUE,
  note = FALSE,
  parallel = FALSE,
  bins_no = TRUE
)

get_psi_iv(
  dat,
  dat_test = NULL,
  x,
  target,
  pos_flag = NULL,
  breaks = NULL,
  breaks_list = NULL,
  occur_time = NULL,
  oot_pct = 0.7,
  equal_bins = FALSE,
  cut_bin = "equal_depth",
  tree_control = NULL,
  bins_control = NULL,
  bins_total = FALSE,
  best = TRUE,
  g = 10,
  as_table = TRUE,
  note = FALSE,
  bins_no = TRUE
)

Arguments

dat

A data.frame with independent variables and target variable.

dat_test

A data.frame of test data. Default is NULL.

x_list

Names of independent variables.

target

The name of target variable.

ex_cols

A list of excluded variables. Regular expressions can also be used to match variable names. Default is NULL.

pos_flag

The value of positive class of target variable, default: "1".

breaks_list

A table containing a list of splitting points for each independent variable. Default is NULL.

occur_time

The name of the variable that represents the time at which each observation takes place.

oot_pct

Percentage of observations retained for overtime test (especially to calculate PSI). Defualt is 0.7

equal_bins

Logical, generates initial breaks for equal frequency or width binning.

cut_bin

A string, if equal_bins is TRUE, 'equal_depth' or 'equal_width', default is 'equal_depth'.

tree_control

Parameters of using Decision Tree to segment initial breaks. See detials: get_tree_breaks

bins_control

Parameters used to control binning. See detials: select_best_class, select_best_breaks

bins_total

Logical, total sum for each variable.

best

Logical, merge initial breaks to get optimal breaks for binning.

g

Number of initial breakpoints for equal frequency binning.

as_table

Logical, output results in a table. Default is TRUE.

note

Logical, outputs info. Default is TRUE.

parallel

Logical, parallel computing. Default is FALSE.

bins_no

Logical, add serial numbers to bins. Default is FALSE.

x

The name of an independent variable.

breaks

Splitting points for an independent variable. Default is NULL.

See Also

get_iv,get_iv_all,get_psi,get_psi_all

Examples

iv_list = get_psi_iv_all(dat = UCICreditCard[1:1000, ],
x_list = names(UCICreditCard)[3:5], equal_bins = TRUE,
target = "default.payment.next.month", ex_cols = "ID|apply_date")
get_psi_iv(UCICreditCard, x = "PAY_3",
target = "default.payment.next.month",bins_total = TRUE)

[Package creditmodel version 1.3.1 Index]