Learn R Programming

rcppmlpackexamples (version 0.0.1)

loanDefaultPrediction: loanDefaultPrediction

Description

Predict loan default using a decision tree model

Usage

loanDefaultPrediction(loanDataFeatures, loanDataTargets, pct = 0.25)

Value

A list object with predictions, probabilities, accuracy and a report matrix

Arguments

loanDataFeatures

A matrix of dimension 3 by N, i.e. transposed relative to what R uses, with the three explanantory variables

loanDataTargets

A vector of (integer-valued) binary variables loan repayment or default

pct

A numeric variable with the percentage of data to be used for testing, defaults to 25%

Details

This functions performs a loan default prediction based on three variables on employment, bank balance and annual salary to predict loan repayment or default

Examples

Run this code
data(loanData)
res <- loanDefaultPrediction(t(as.matrix(loanData[,-4])),  # col 1 to 3, transposed
                             loanData[, 4],                # col 4 is the target
                             0.25)                         # retain 25% for testing
str(res)
res$report

Run the code above in your browser using DataLab