Articles by sang-heon lee

Smith-Wilson Extrapolation with R code

May 25, 2021 | sang-heon lee

This post explains how to implement the Smith-Wilson extrapolation by which deterministic DNS shock scenarios are generated. Smith-Wilson Extrapolation Deterministic DNS shock scenarios under ICS (K-ICS) are the term structure of annually compounding spot rates which spans from 1-month to 1440-month (120-year) or longer. This is used to discount the ...
[Read more...]

Construction of SOFR Index from SOFR Rates

May 24, 2021 | sang-heon lee

This post replicates the construction process of the SOFR index from daily SOFR rates. Since this index is published in a daily basis officially, there is no need to make it. But in the process of pricing SOFR swaps and floating rate notes, this sort of calculation is needed. SOFR ...
[Read more...]

Markowitz v.s. Michaud Portfolio Optimization with R code

May 22, 2021 | sang-heon lee

This post shows how to perform asset allocation based on the Markowitz's mean-variance (MV) portfolio model which is the benchmark framework. This model is based on the diversification effect. Another alternative Michaud's Resampled Efficiency (RE) portfolio model is also discussed. These two models are implemented using a quadratic optimization R ...
[Read more...]

Review of IAIS DNS Shock Generating Algorithm Update

May 19, 2021 | sang-heon lee

This post reviews the update of IAIS DNS Shock Generating Algorithm of IAIS(2018, 2019). This update have some modificatoin which is related to the expression of conditional covariance. But this expression needs to be more refined in the mathematical manner. This post try to explain it. IAIS DNS Shock Generating Algorithm : ... [Read more...]

Sign Constrained Lasso with R code

May 19, 2021 | sang-heon lee

This post explains how to implement the sign constrained lasso with ridge, and linear regression model. The restrictions of expected sign is of great importance in the case when building an econometric model with meaningful interpretation. We can easily incorporate sign restrictions to the above regression models using glmnet R ...
[Read more...]

Lasso Regression Model with R code

May 19, 2021 | sang-heon lee

Tibshirani (1996) introduces the so called LASSO (Least Absolute Shrinkage and Selection Operator) model for the selection and shrinkage of parameters. This model is very useful when we analyze big data. In this post, we learn how to set up the Lasso model and estimate it using glmnet R package. Tibshirani (1996) ...
[Read more...]

BOK ECOS Open API using R code

May 13, 2021 | sang-heon lee

BOK (Bank of Korea) administrates ECOS database for economic ststistics/market data and provides Open API for this database. ECOS API also supports several popular programming language such as R, Python. In this post, we use R programming to download data through ECOS API. This work can really help you ...
[Read more...]

Retrieving Stock Price using R

May 11, 2021 | sang-heon lee

Let's download stock prices using getSymbols() function in quantmod R library. I hope he will come back soon. It is easy to download. The first thing is to find the ticker for the security. The second thing is to run the following R code with ticker. Tickers are easily found ...
[Read more...]

Bayesian Linear Regression with Gibbs Sampling using R code

May 8, 2021 | sang-heon lee

Sang-Heon Lee This article explains how to estimate parameters of the linear regression model using the Bayesian inference. Our focus centers on user-friendly intuitive understanding of Bayesian estimation. From some radical point of view, we regard the Bayesian model as the average of multiple models generated with slightly different parameter ...
[Read more...]

Black Lognormal model for Swaption with R code

May 8, 2021 | sang-heon lee

Sang-Heon Lee This article derives the swaption pricing formula using Black model, which is a lognormal model. We present the detailed calculation example using R code. This work is a prerequisite for the calibratiion of Hull-White or LGM (Linear Gaussian Markov) model. The calibration of parameters of no-aritrage term structure ...
[Read more...]

IAIS DNS Shock Generating Algorithm with R code

May 8, 2021 | sang-heon lee

Sang-Heon Lee This article explains how to calculate DNS shock scenarios based on IAIS (2019). We implement DNS shock generating algorithm using R code with some modification. IAIS DNS Shock Generating Algorithm Risk-based Global Insurance Capital Standard is for the regulatory capital requirements against the unexpected loss of insurance companies. Especially ...
[Read more...]

Dynamic Nelson-Siegel model with R code

May 8, 2021 | sang-heon lee

Sang-Heon Lee This article explains how to estimate parameters of the dynamic Nelson-Siegel (DNS) model (Diebold and Li;2006, Diebold, Rudebusch, and Aruoba;2006) using Kalman filter. We estimate not only parameters but also filtered latent factor estimates such as level, slope, and curvature using R code. Dynamic Nelson-Siegel model 1. DNS modelThe ...
[Read more...]

Arbitrage-free Nelson Siegel model with R code

May 8, 2021 | sang-heon lee

Sang-Heon Lee This article explains how to estimate parameters of the Arbitrage-Free dynamic Nelson-Siegel (AFNS) model (Christensen, Diebold, and Rudebusch; 2009, Christensen, Diebold, and Rudebusch; 2011) using Kalman filter. We estimate not only parameters but also filtered latent factor estimates such as level, slope, and curvature using R code. 1. AFNS modelAFNS model ...
[Read more...]
1 2

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)