Publications by Sang-Heon Lee

Numerical Calculation of FRN Duration in R

21.09.2021

The duration of a floating rate note (FRN) is the remaining time until the first next payment date. Using this fact, a duration of FRN has not been calculated explicitly but has been understood conceptually. Instead of this reasoning, this post tries to calculate it directly based on the numerical differentiation using R code. We have investi...

4291 sym 2 img 2 tbl

A Simple ALM Cash Flow Matching using Excel and R

26.09.2021

This post implements a simple asset-liability cash flow matching using Excel and R. This example is a linear programming (LP) model but will serve as a foundation for the advanced ALM modeling techniques such as two-stage or multi-stage stochastic linear programming (2SSLP, MSSLP). We borrow a basic asset-liability cash flow matching model as...

4128 sym 8 img 3 tbl

A Simple Two-Stage Stochastic Linear Programming using R

30.09.2021

This post explains a two-stage stochastic linear programming (SLP) in a simplified manner and implements this model using R. This exercise is for the clear understanding of SLP model and will be a solid basis for the advanced topics such as multi-stage SLP, scenario tree generation, and so on. For 2-stage SLP, we use the simple ALM cash flow ...

7847 sym 8 img 2 tbl

Using Java functions from JAR file in R using rJava

01.10.2021

This post explains how to call Java functions from jar file in R. This is useful especially when derivatives pricing or risk calculation engine already have been developed well in the form of Java in your company. It is more efficient to use time-tested existing module than to develop new module. Since we have made a sample jar file (aObba.ja...

1817 sym 2 img 3 tbl

Black-Derman-Toy Interest Rate model using R

09.10.2021

This post implements Black-Derman-Toy (BDT) interest rate tree using R. This implementation is based on the previous post for BDT model. R Implementation of BDT Interest Rate Tree We implement BDT tree according to the content of the previous post. The previous post below explains BDT model and provides Excel illustration for the clear unde...

3008 sym 2 img 2 tbl

Adams and Deventer Maximum Smoothness Forward Rate Curve using R code

13.10.2021

This post implements Adams and Deventer (1994) approach which generates the best fitting yield curve smoothing with the principle of maximum smoothness forward rate curve. This provides a powerful closed-form solution by which we can sidestep a kinked or zigzag problem of forward rate curve effectively. Computing Maximum Smoothness Forward R...

6717 sym 6 img 3 tbl

Maximum Smoothness Forward Rates by Inverse Matrix using R

16.10.2021

This post solves Adams and Deventer (1994) maximum smoothness forward rate curve as the matrix inversion of equality constrained quadratic programming problems. We implement R code for this model and elaborate on how to get monthly forward and spot rates from the calibrated parameters. Maximum Smoothness Forward Rates Using Adams and Deven...

10544 sym 14 img 4 tbl

Robustness Check for Maximum Smoothness Forward Rates using R

17.10.2021

This post makes a user-defined R function for Adams and Deventer (1994, revised 2010) maximum smoothness forward curve for the purpose of reusing and performs robustness checks for various initial term structures. We find that every time an initial term structure is changed, our procedure delivers correct output with different shapes of forward...

2496 sym 6 img 2 tbl

R : httr in R and MSXML2.ServerXMLHTTP in Excel VBA

27.10.2021

This post shows a R counterpart of Excel VBA’s MSXML2.ServerXMLHTTP related commands with which server APIs are called easily. In case of R, it is done by using httr R package. As an illustration, SQL query for retrieving swap date schedule is executed by calling this server API. Calling Server API in a simple manner This post is simple ...

1757 sym 2 img 3 tbl

Exclusive Lasso and Group Lasso using R code

28.10.2021

This post shows how to use the R packages for estimating an exclusive lasso and a group lasso. These lasso variants have a given grouping order in common but differ in how this grouping constraint is functioning when a variable selection is performed. Lasso, Group Lasso, and Exclusive Lasso While LASSO (least absolute shrinkage and select...

5197 sym 2 img 5 tbl