Hello,

Does somebody knows if Diebold and Li model (http://www.ssc.upenn.edu/~fdiebold/papers/paper49/Diebold-Li.pdf) which allows to recast the term structure of interest rates has been implemented in Gauss by somebody and the code is available?

Thanks,

Miguel

## 1 Answer

0

Dear Miguel,

I do not know of any GAUSS code implementing the yield code prediction methodology presented by Diebold and Li (2006). However, the simple example and procedure below will allow you to estimate the factor loadings β

_{1t}, β_{2t}, and β_{3t}from yield curve data. The procedure is based on the least squares methodology outlined in section 3.2 of the paper cited in your original question.//Data should be stored as a K x T matrix //Each column represents a month and each row represents //yield for a given maturity at that month new; cls; //User specified lambda lambda = .0609; //Vector of observed maturities TimeToMat = {3,6,9,24,36,60,84,120,240,360}; //Read data from .xls file yields = xlsReadM("examples\\dailyTreasuryYields.xlsx","b2",1,""); yields=yields'; //Call procedure to estimated betas bta =findBetaDieboldLi(yields/100,lambda,TimeToMat); //This defines the procedure which estimates the factor loading proc(1) =findBetaDieboldLi(y,lambda,timeToMaturity); local x,bta,numMaturities,numMonths; numMaturities = rows(y); numMonths = cols(y); x = ones(numMaturities,1)~(1-exp(-lambda*timeToMaturity)./(lambda*time ToMaturity))~((1-exp(-lambda*timeToMaturity)./(lambda*timeToMaturity)) -exp(-lambda*timeToMaturity)); bta = y/x; retp(bta); endp;

## Your Answer

## 1 Answer

Dear Miguel,

I do not know of any GAUSS code implementing the yield code prediction methodology presented by Diebold and Li (2006). However, the simple example and procedure below will allow you to estimate the factor loadings β

_{1t}, β_{2t}, and β_{3t}from yield curve data. The procedure is based on the least squares methodology outlined in section 3.2 of the paper cited in your original question.//Data should be stored as a K x T matrix //Each column represents a month and each row represents //yield for a given maturity at that month new; cls; //User specified lambda lambda = .0609; //Vector of observed maturities TimeToMat = {3,6,9,24,36,60,84,120,240,360}; //Read data from .xls file yields = xlsReadM("examples\\dailyTreasuryYields.xlsx","b2",1,""); yields=yields'; //Call procedure to estimated betas bta =findBetaDieboldLi(yields/100,lambda,TimeToMat); //This defines the procedure which estimates the factor loading proc(1) =findBetaDieboldLi(y,lambda,timeToMaturity); local x,bta,numMaturities,numMonths; numMaturities = rows(y); numMonths = cols(y); x = ones(numMaturities,1)~(1-exp(-lambda*timeToMaturity)./(lambda*time ToMaturity))~((1-exp(-lambda*timeToMaturity)./(lambda*timeToMaturity)) -exp(-lambda*timeToMaturity)); bta = y/x; retp(bta); endp;