Publications by Sang-Heon Lee
lambda.min, lambda.1se and Cross Validation in Lasso : Binomial Response
This post explains more details regarding cross validation of Lasso in the case of a binomial response. We implement a R code for a lasso model’s cross validation. In addition, We calculate lambda.min and lambda.1se manually. Finally we compare these two cross validation results with that of cv.glmnet(). Cross Validation in Lasso : Bino...
4318 sym 6 img 4 tbl
lambda.min, lambda.1se and Cross Validation in Lasso : Continuous Response
This post presents a R code for a k-fold cross validation of Lasso in the case of a gaussian regression (continuous Y). This work easily can be done by using a mean squared error. Cross Validation in Lasso : Gaussian Regression We have implemented a R code for the K-fold cross validation of lasso model with the binomial response in the pr...
2453 sym 2 img 2 tbl
Bond Forward Pricing using R code
This post presents a R code for pricing a bond forward. It is well known that insurance companies use it as the instrument of a duration management with lower cost. Here, a pricing formula and its implementation are provided with delta sensitivity using a zero curve bump-and-reprice approach. Bond Forward Pricing The bond forward contrac...
3038 sym 8 img 1 tbl
Vector Autoregressive Model (VAR) using R
This post gives a brief introduction to the estimation and forecasting of a Vector Autoregressive Model (VAR) model using R . We use vars and tsDyn R package and compare these two estimated coefficients. We also consider VAR in level and VAR in difference and compare these two forecasts. VAR Model VAR and VECM model For a vector times ser...
7922 sym 10 img 3 tbl
Augmented Dickey-Fuller (ADF) Test in R
This post explains how to use the augmented Dickey-Fuller (ADF) test in R. The ADF Test is a common statistical test to determine whether a given time series is stationary or not. We explain the interpretation of ADF test results from R package by making the meaning of the alphanumeric name of test statistics clear. ADF test We have impl...
8155 sym 6 img 3 tbl
Easy Interpretations of ADF Test in R
This post shows how to interpret the results of the augmented Dickey-Fuller (ADF) test easily with the help of Hank Roark’s R function. His R function provides kind descriptions of the results of a unit root ADF test. I explains why this description is consistent with the ADF hypothesis test. Easy Interpretations of ADF Test The purpose o...
3358 sym 6 img 2 tbl
Pastor and Stambaugh (2003) Liquidity Measure – Individual Stock
This post shows how to calculate the liquidity measure (gamma) of Pastor and Stambaugh (2003) using R code. For exposition purposes we use only two individual series : small firm index and ESG firm index. As expected, a PS liquidity measure for small firms is more volatile than that of ESG firms. Pastor and Stambaugh (2003) Liquidity Measure...
5192 sym 12 img 1 tbl
Vector Error Correction Model (VECM) using R
This post explains how to estimate and forecast a Vector Error Correction Model (VECM) model using R. The VECM model consists of VAR model (short-term dynamics) and cointegration (long-term comovement). We use the Johansen cointegration test. The coverage of this post is just a small island of the vast VECM modeling world. Vector Error Corr...
14318 sym 16 img 9 tbl
Some Interesting Issues in VECM using R
This post deals with some interesting issues regarding the VECM model. Among them are the VAR representation of VECM, the weak exogeniety restrictions and user-defined cointegrating vectors and so on. With the help of useful R packages, these issues are discussed. Some Interesting Issues in VECM In this post, we will cover some issues rega...
12155 sym 12 img 6 tbl
Uncovered Interest Rate Parity and F-test on Regression Parameters using R
This post explains how to perform the F-test of joint parameter restrictions on a linear regression model. As an example, we use the data in Chen and Tsang (2013), who introduce so called relative Nelson-Siegel factor model to predict exchange rates. We test whether data support uncovered interest rate parity (UIP) restrictions. Uncovered I...
7057 sym 8 img 7 tbl