smbinning.metrics.plot: Visualization of a Classification Matrix

Description Usage Arguments Examples

View source: R/smbinning.R

Description

It generates four plots after running and saving the output report from smbinning.metrics.

Usage

1
smbinning.metrics.plot(df, cutoff = NA, plot = "cmactual")

Arguments

df

Data frame generated with smbinning.metrics.

cutoff

Value of the classifier that splits the data between positive (>=) and negative (<).

plot

Plot to be drawn. Options are: 'cmactual' (default),'cmactualrates','cmmodel','cmmodelrates'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Load library and its dataset
library(smbinning)
smbmetricsdf=smbinning.metrics(dataset=smbsimdf1, prediction="cbs1",
                               actualclass="fgood", returndf=1)

# Example 1: Plots based on optimal cutoff
smbinning.metrics.plot(df=smbmetricsdf,plot='cmactual')

# Example 2: Plots using user defined cutoff
smbinning.metrics.plot(df=smbmetricsdf,cutoff=600,plot='cmactual')
smbinning.metrics.plot(df=smbmetricsdf,cutoff=600,plot='cmactualrates')
smbinning.metrics.plot(df=smbmetricsdf,cutoff=600,plot='cmmodel')
smbinning.metrics.plot(df=smbmetricsdf,cutoff=600,plot='cmmodelrates')

Example output

Loading required package: sqldf
Loading required package: gsubfn
Loading required package: proto
Loading required package: RSQLite
Loading required package: partykit
Loading required package: grid
Loading required package: libcoin
Loading required package: mvtnorm
Loading required package: Formula
Warning message:
no DISPLAY variable so Tk is not available 

  Overall Performance Metrics 
  -------------------------------------------------- 
                    KS : 0.3010 (Fair)
                   AUC : 0.6990 (Poor)

  Classification Matrix 
  -------------------------------------------------- 
           Cutoff (>=) : 51.78 (Optimal)
   True Positives (TP) : 1044
  False Positives (FP) : 126
  False Negatives (FN) : 751
   True Negatives (TN) : 323
   Total Positives (P) : 1795
   Total Negatives (N) : 449

  Business/Performance Metrics 
  -------------------------------------------------- 
      %Records>=Cutoff : 0.5214
             Good Rate : 0.8923 (Vs 0.7999 Overall)
              Bad Rate : 0.1077 (Vs 0.2001 Overall)
        Accuracy (ACC) : 0.6092
     Sensitivity (TPR) : 0.5816
 False Neg. Rate (FNR) : 0.4184
 False Pos. Rate (FPR) : 0.2806
     Specificity (TNR) : 0.7194
       Precision (PPV) : 0.8923
  False Discovery Rate : 0.1077
    False Omision Rate : 0.6993
  Inv. Precision (NPV) : 0.3007

  Note: 256 rows deleted due to missing data.

smbinning documentation built on May 1, 2019, 10:06 p.m.