How ANZ uses R for credit risk analysis

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

At last month's R user group meeting in Melbourne, the theme was “Experiences with using SAS and R in insurance and banking”. There, Hong Ooi from ANZ (Australia and New Zealand Banking Group) gave a presentation on “Experiences with using R in credit risk”. I didn't get to see the presentation myself, but the slides tell a great story about implementing R for financial analysis at a major bank. In the slides, you'll see:

  • How R is used to fit models for mortgage loss at ANZ. A custom model is created to estimate probability of default for individual loans, with a heavy-tailed T distribution for volatility. (Slide 12 shows how the standard lm function for regression is adapted for a non-Gaussian error distribution — one of the many benefits of having the source code available in R.)
  • A comparison between R and SAS for fitting such non-standard models. Ooi notes that SAS does have various options for modeling variance (e.g. SAS PROC MIXED, PRIC NLIN), but “none of these are as flexible or powerful as R”. The key difference, Ooi says, is that R modeling functions return an object (as opposed to merely text output) which can be modified and manipulated by the R programmer to adapt to new modeling situations and generate predictions, summaries, etc.
  • How cohort modeling is used to aggregate the point estimates of default into an overall risk for the portfolio, as shown in the chart below:

Nameless portfolios

  • How ANZ implemented a stress-testing simulation, made available to business users via an Excel interface. The main computation is done in R in just two minutes (compared to an original all-SAS version that “took ~4 hours to run, often crashed due to lack of disk space”). Since the data is stored in SAS, SAS code is still used to generate the source data … although an R script (seen on slide 25) is used to automate the process of writing the SAS code to do so (neatly stepping around the flexibility limitations of SAS).
  • A comparison of using R and SAS's IML language for implementing algorithms, on slide 33. (Ooi's R code uses a neat trick of making a matrix of R list objects, which is impossible with IML's matrix-only data structures.)
  • Some resources for accessing SAS data from R, on slide 34.
  • An overall comparison of R and SAS for capital risk applications, on slides 37-38.
  • On slide 34, some of the challenges of deploying open-source R in commercial organizations, such as “who do I yell at if things go wrong”. (As noted on slide 35, Revolution Analytics provides commercial support for R.)
  • Finally, there's a collection of generally useful R resources on slide 40.

If you work in a bank and you need help adopting R there, this presentation should be a great resource. Download it from the Melbourne Users of R Network user group at the link below.

Melbourne Users of R Network (files): R and SAS in Banking (685Kb PPT) (PDF format – 783Kb)

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)