library(irks)
knitr::opts_chunk$set(
  collapse = TRUE,
  warning = FALSE,
  message = FALSE,
  comment = "#>",
  # fig.path = "man/figures/README-",
  out.width = "100%"
)

library(ggplot2)
theme_set(jbkmisc::theme_jbk())

Travis build status AppVeyor build status

irks

Is a set of tools for credit risk modelling.

Installation

You can install the released version of irks from CRAN with:

install.packages("irks")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("jbkunst/irks")

Descriptive

library(irks)
library(dplyr)
data("german_credit")

german_credit <- select(german_credit, good_bad, status_of_existing_checking_account,
                        duration_in_month, savings_account_or_bonds, credit_amount,
                        purpose, age_in_years)

duni <- describe(german_credit)
duni

dbiv <- describe_bivariate(german_credit, target = good_bad, verbose = FALSE)

arrange(dbiv, desc(iv))

Binning

x <- german_credit$duration_in_month
y <- german_credit$good_bad

bin <- binning(x, y)
bin

# plot(bin)

Model helpers

var_importance

german_credit <- mutate_if(german_credit, is.character, as.factor)

rf <- randomForest::randomForest(factor(good_bad) ~ ., data = german_credit)
var_importance(rf)

rrf <- RRF::RRF(factor(good_bad) ~ ., data = german_credit)
var_importance(rrf)

library(partykit)
ct <- ctree(Species ~ ., data = iris)
ct_rules(ct)


jbkunst/irks documentation built on May 22, 2021, 2:09 p.m.