Title: | Zero Coupon Yield Curve Modelling |
---|---|
Description: | Modeling the zero coupon yield curve using the dynamic De Rezende and Ferreira (2011) <doi:10.1002/for.1256> five factor model with variable or fixed decaying parameters. For explanatory purposes, the package also includes various short datasets of interest rates for the BRICS countries. |
Authors: | Oleksandr Castello [aut, cre] Marina Resta [ctb, cre] |
Maintainer: | Oleksandr Castello <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.0 |
Built: | 2025-03-04 05:02:53 UTC |
Source: | https://github.com/cran/DeRezende.Ferreira |
Modeling the zero coupon yield curve using the dynamic De Rezende and Ferreira (2011) <doi:10.1002/for.1256> five factor model with variable or fixed decaying parameters. For explanatory purposes, the package also includes various short datasets of interest rates for the BRICS countries.
Package: | DeRezende.Ferreira |
Type: | Package |
Version: | 4.1 |
Date: | 2019-04-26 |
Depends: | R (>= 3.5.0), xts, stats |
License: | GPL (>= 2) |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.1.1 |
Author: Oleksandr Castello [aut, cre]
Marina Resta [ctb, cre]
Maintainer: Oleksandr Castello <[email protected]>
De Rezende R.B., Ferreira M.S., “Modeling and Forecasting the Brazilian Term Structure of Interest Rates by an Extended Nelson-Siegel Class of Models: A Quantile Autoregression Approach” (2008).
De Rezende R.B., Ferreira M.S. (2011), “Modeling and Forecasting the Yield Curve by an Extended Nelson-Siegel Class of Models: A Quantile Autoregression Approach”, Journal of Forecasting , J. Forecast. n. 32, p. 111–123 (2013).
De Rezende R.B., “Giving Flexibility to The Nelson-Siegel Class of Term Structure Models”, Revista Brasileira de Financas Vol. 9, N. 1 (2011), p. 27–49.
Caldeira. J. F., Moura G. V., Portugal M.S., “Efficient Yield Curve Estimation and Forecasting in Brazil”, Revista EconomiA (Brasilia) (January/April 2009) ,v.11, n.1, p.27–51.
Nelson C. R., Siegel A.F., “Parsimonious Modeling of Yield Curves”, The Journal of Business (1987), 60, 473-489.
Diebold F.X., Li C.,” Forecasting the term structure of government bond yields”, Journal of Econometrics n. 130, 337-364 (2005).
Diebold, F.X., Ji, L. and Li, C. , A Three-Factor Yield Curve Model: Non-Affine Structure, Systematic Risk Sources, and Generalized Duration, in L.R. Klein (ed.), Long-Run Growth and Short-Run Stabilization: Essays in Memory of Albert Ando. Cheltenham, U.K.: Edward Elgar, p. 240-274 (2006).
Guirreri S.S., "Modelling and estimation of the yield curve", Package "YieldCurve" - February 19, 2015, CRAN.
The command estimates the spot rates using the De Rezende-Ferreira 5 Factor model
DRF.5F.rates(beta, maturity)
DRF.5F.rates(beta, maturity)
beta |
Matrix or Vector of class "zoo", which contains the coefficients of the De Rezende-Ferreira 5 Factor model:
|
maturity |
Vector of class "numeric", wich contains the maturities |
An object of class "xts" - "zoo", which contains fitted interest rates
# # Fitting the Chinese spot rates using the De Rezende-Ferreira 5F moodel with Variable tau # data(ZC_China) real.rate = ZC_China ZC_China[["Date"]] = NULL rate = zoo(ZC_China) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(1,2,3,4,5,6,7,8,9,10,12,15,20,30) RF.5F.Parameters <- DRF.5F.tVar(rate, maturity) RF.5F.Rates <- DRF.5F.rates(RF.5F.Parameters, maturity ) plot(maturity,rate[5,],xlab="Maturity",ylab="Yields",ylim=c(3.5,4.7),col="black",lwd = 1) lines(maturity, RF.5F.Rates[5,], col = "blue", lwd = 1) grid(nx = 12, ny = 12) # # # # # Fitting the South African spot rates using the De Rezende-Ferreira 5F model with fixed tau # data(ZC_SouthAfrica) real.rate = ZC_SouthAfrica ZC_SouthAfrica[["Date"]] = NULL rate = zoo(ZC_SouthAfrica) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(0.25, 1,2,3,4,5,6,7,8,9,10,12,15,20,25,30) fixed_tau1 = (1.07612) fixed_tau2 = (6.23293) RF.5F.Parameters <- DRF.5F.tFix(rate, maturity, fixed_tau1, fixed_tau2) RF.5F.Rates <- DRF.5F.rates(RF.5F.Parameters, maturity ) plot(maturity,rate[5,],xlab="Maturity",ylab="Yields",ylim=c(6.5,10.0),col="black",lwd = 1) lines(maturity, RF.5F.Rates[5,], col = "blue", lwd = 1) grid(nx = 12, ny = 12)
# # Fitting the Chinese spot rates using the De Rezende-Ferreira 5F moodel with Variable tau # data(ZC_China) real.rate = ZC_China ZC_China[["Date"]] = NULL rate = zoo(ZC_China) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(1,2,3,4,5,6,7,8,9,10,12,15,20,30) RF.5F.Parameters <- DRF.5F.tVar(rate, maturity) RF.5F.Rates <- DRF.5F.rates(RF.5F.Parameters, maturity ) plot(maturity,rate[5,],xlab="Maturity",ylab="Yields",ylim=c(3.5,4.7),col="black",lwd = 1) lines(maturity, RF.5F.Rates[5,], col = "blue", lwd = 1) grid(nx = 12, ny = 12) # # # # # Fitting the South African spot rates using the De Rezende-Ferreira 5F model with fixed tau # data(ZC_SouthAfrica) real.rate = ZC_SouthAfrica ZC_SouthAfrica[["Date"]] = NULL rate = zoo(ZC_SouthAfrica) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(0.25, 1,2,3,4,5,6,7,8,9,10,12,15,20,25,30) fixed_tau1 = (1.07612) fixed_tau2 = (6.23293) RF.5F.Parameters <- DRF.5F.tFix(rate, maturity, fixed_tau1, fixed_tau2) RF.5F.Rates <- DRF.5F.rates(RF.5F.Parameters, maturity ) plot(maturity,rate[5,],xlab="Maturity",ylab="Yields",ylim=c(6.5,10.0),col="black",lwd = 1) lines(maturity, RF.5F.Rates[5,], col = "blue", lwd = 1) grid(nx = 12, ny = 12)
The command estimates the parameters of the De Rezende-Ferreira 5 Factor model
using fixed and
DRF.5F.tFix(rate, maturity, fixed_tau1, fixed_tau2)
DRF.5F.tFix(rate, maturity, fixed_tau1, fixed_tau2)
rate |
Vector or matrix of class "zoo", which contains interest rates |
maturity |
Vector of class "numeric", wich contains the maturities |
fixed_tau1 |
Decaying parameter of class "numeric" (Slope) |
fixed_tau2 |
Decaying parameter of class "numeric" (Curvature) |
An object of class "zoo", that contains
# # De Rezende-Ferreira 5F model on the Indian Data-Set # data(ZC_India) real.rate = ZC_India ZC_India[["Date"]] = NULL rate = zoo(ZC_India) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(0.25, 0.5, 0.75, 1,2,3,4,5,6,7,8,9,10,12,15,20,25,30) fixed_tau1 = (1.07612) fixed_tau2 = (6.23293) RF.5F.Parameters <- DRF.5F.tFix(rate, maturity, fixed_tau1, fixed_tau2) par(mfrow=c(3,2)) plot(RF.5F.Parameters[,"beta0"],xlab="Date",ylab="BETA0",ylim=c(7.0,9.0),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta1"],xlab="Date",ylab="BETA1",ylim=c(-3.5,0.2),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta2"],xlab="Date",ylab="BETA2",ylim=c(-1.5,1.0),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta3"],xlab="Date",ylab="BETA3",ylim=c(-2.0,0.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta4"],xlab="Date",ylab="BETA4",ylim=c(-2.5,5.0),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1))
# # De Rezende-Ferreira 5F model on the Indian Data-Set # data(ZC_India) real.rate = ZC_India ZC_India[["Date"]] = NULL rate = zoo(ZC_India) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(0.25, 0.5, 0.75, 1,2,3,4,5,6,7,8,9,10,12,15,20,25,30) fixed_tau1 = (1.07612) fixed_tau2 = (6.23293) RF.5F.Parameters <- DRF.5F.tFix(rate, maturity, fixed_tau1, fixed_tau2) par(mfrow=c(3,2)) plot(RF.5F.Parameters[,"beta0"],xlab="Date",ylab="BETA0",ylim=c(7.0,9.0),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta1"],xlab="Date",ylab="BETA1",ylim=c(-3.5,0.2),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta2"],xlab="Date",ylab="BETA2",ylim=c(-1.5,1.0),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta3"],xlab="Date",ylab="BETA3",ylim=c(-2.0,0.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta4"],xlab="Date",ylab="BETA4",ylim=c(-2.5,5.0),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1))
The command estimates the parameters of the De Rezende-Ferreira 5 Factor model
using variable and
DRF.5F.tVar(rate, maturity)
DRF.5F.tVar(rate, maturity)
rate |
Vector or matrix of class "zoo", which contains interest rates |
maturity |
Vector of class "numeric", wich contains the maturities |
The De Rezende-Ferreira model used to fit the forward rates is:
The spot rates, derived from the forward rates , are given by:
The set of optimal parameters will be chosen according to the lowest RMSE value:
An object of class "zoo", that contains
# # De Rezende-Ferreira 5F model on the Brazilian Data-Set # data(ZC_Brazil) real.rate = ZC_Brazil ZC_Brazil[["Date"]] = NULL rate = zoo(ZC_Brazil) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(0.5, 0.75, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) RF.5F.Parameters <- DRF.5F.tVar(rate, maturity) par(mfrow=c(3,2)) plot(RF.5F.Parameters[,"beta0"],xlab="Date",ylab="BETA0",ylim=c(9.5,12.0),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta1"],xlab="Date",ylab="BETA1",ylim=c(-18.0,2.3),col= "blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta2"],xlab="Date",ylab="BETA2",ylim=c(-6.0,13.0),col= "blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta3"],xlab="Date",ylab="BETA3",ylim=c(-10.0,0.0),col= "blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta4"],xlab="Date",ylab="BETA4",ylim=c(-5.0,5.0),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1)) par(mfrow=c(2,1)) plot(RF.5F.Parameters[,"tau1"],xlab="Date",ylab="TAU1",ylim=c(0.2,1.3),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"tau2"],xlab="Date",ylab="TAU2",ylim=c(2.5,5.5),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1)) # # De Rezende-Ferreira 5F on the Russian Data-Set # data(ZC_Russia) real.rate = ZC_Russia ZC_Russia[["Date"]] = NULL rate = zoo(ZC_Russia) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(0.25, 0.5, 0.75, 1,2,3,5,7,10,15,20,30) RF.5F.Parameters <- DRF.5F.tVar(rate, maturity) par(mfrow=c(3,2)) plot(RF.5F.Parameters[,"beta0"],xlab="",ylab="BETA0",ylim=c(10.5,12.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta1"],xlab="Date",ylab="BETA1",ylim=c(-1.5,0.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta2"],xlab="Date",ylab="BETA2",ylim=c(-7.0,-3.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta3"],xlab="Date",ylab="BETA3",ylim=c(-1.5,3.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta4"],xlab="Date",ylab="BETA4",ylim=c(-5.5,-0.1),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1)) par(mfrow=c(2,1)) plot(RF.5F.Parameters[,"tau1"],xlab="Date",ylab="TAU1",ylim=c(0.1,1.9),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"tau2"],xlab="Date",ylab="TAU2",ylim=c(7.5,16.8),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1))
# # De Rezende-Ferreira 5F model on the Brazilian Data-Set # data(ZC_Brazil) real.rate = ZC_Brazil ZC_Brazil[["Date"]] = NULL rate = zoo(ZC_Brazil) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(0.5, 0.75, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) RF.5F.Parameters <- DRF.5F.tVar(rate, maturity) par(mfrow=c(3,2)) plot(RF.5F.Parameters[,"beta0"],xlab="Date",ylab="BETA0",ylim=c(9.5,12.0),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta1"],xlab="Date",ylab="BETA1",ylim=c(-18.0,2.3),col= "blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta2"],xlab="Date",ylab="BETA2",ylim=c(-6.0,13.0),col= "blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta3"],xlab="Date",ylab="BETA3",ylim=c(-10.0,0.0),col= "blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta4"],xlab="Date",ylab="BETA4",ylim=c(-5.0,5.0),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1)) par(mfrow=c(2,1)) plot(RF.5F.Parameters[,"tau1"],xlab="Date",ylab="TAU1",ylim=c(0.2,1.3),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"tau2"],xlab="Date",ylab="TAU2",ylim=c(2.5,5.5),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1)) # # De Rezende-Ferreira 5F on the Russian Data-Set # data(ZC_Russia) real.rate = ZC_Russia ZC_Russia[["Date"]] = NULL rate = zoo(ZC_Russia) index(rate) = as.POSIXct(paste(real.rate[["Date"]])) maturity <- c(0.25, 0.5, 0.75, 1,2,3,5,7,10,15,20,30) RF.5F.Parameters <- DRF.5F.tVar(rate, maturity) par(mfrow=c(3,2)) plot(RF.5F.Parameters[,"beta0"],xlab="",ylab="BETA0",ylim=c(10.5,12.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta1"],xlab="Date",ylab="BETA1",ylim=c(-1.5,0.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta2"],xlab="Date",ylab="BETA2",ylim=c(-7.0,-3.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta3"],xlab="Date",ylab="BETA3",ylim=c(-1.5,3.5),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"beta4"],xlab="Date",ylab="BETA4",ylim=c(-5.5,-0.1),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1)) par(mfrow=c(2,1)) plot(RF.5F.Parameters[,"tau1"],xlab="Date",ylab="TAU1",ylim=c(0.1,1.9),col="blue",lwd=1) grid(nx=12, ny=12) plot(RF.5F.Parameters[,"tau2"],xlab="Date",ylab="TAU2",ylim=c(7.5,16.8),col="blue",lwd=1) grid(nx=12, ny=12) par(mfrow=c(1,1))
ZC Government bonds with maturities (0.5, 0.75, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) expressed in years and with business day frequency, source: Thomson Reuters Datastream. The range date is from 2018-01-01 to 2018-01-12.
data(ZC_Brazil)
data(ZC_Brazil)
A data frame (txt file) with 12 daily interest rates at different maturities and 10 observed days.
ZC Government bonds with maturities (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30) expressed in years and with business day frequency, source: Thomson Reuters Datastream. The range date is from 2018-01-02 to 2018-01-15.
data(ZC_China)
data(ZC_China)
A data frame (txt file) with 14 daily interest rates at different maturities and 10 observed days.
ZC Government bonds with maturities (0.25 , 0.5, 0.75, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 25, 30) expressed in years and with business day frequency, source: Thomson Reuters Datastream. The range date is from 2018-01-01 to 2018-01-12.
data(ZC_India)
data(ZC_India)
A data frame (txt file) with 18 daily interest rates at different maturities and 10 observed days.
ZC Government bonds with maturities (0.25, 0.5, 0.75, 1,2,3,5,7,10,15,20,30) expressed in years and with business day frequency, source: the Central Bank of the Russian Federation web site. The range date is from 2018-01-03 to 2018-01-17.
data(ZC_Russia)
data(ZC_Russia)
A data frame (txt file) with 12 daily interest rates at different maturities and 10 observed days.
ZC Government bonds with maturities (0.25, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 25, 30) expressed in years and with business day frequency, source: Thomson Reuters Datastream. The range date is from 2018-01-01 to 2018-01-12.
data(ZC_SouthAfrica)
data(ZC_SouthAfrica)
A data frame (txt file) with 16 daily interest rates at different maturities and 10 observed days.