Package 'DeRezende.Ferreira'

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

Help Index


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.

Details

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(s)

Author: Oleksandr Castello [aut, cre]
Marina Resta [ctb, cre]

Maintainer: Oleksandr Castello <[email protected]>

References

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.


Estimation of spot rates with the De Rezende-Ferreira 5 Factor model

Description

The command estimates the spot rates using the De Rezende-Ferreira 5 Factor model

Usage

DRF.5F.rates(beta, maturity)

Arguments

beta

Matrix or Vector of class "zoo", which contains the coefficients of the De Rezende-Ferreira 5 Factor model: (β0t,β1t,β2t,β3t,β4t,τ1t,τ2t)\left( \beta_{0t},\beta_{1t}, \beta_{2t}, \beta_{3t}, \beta_{4t}, \tau_{1t}, \tau_{2t} \right)

maturity

Vector of class "numeric", wich contains the maturities

Value

An object of class "xts" - "zoo", which contains fitted interest rates

Examples

#
# 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)

Estimation of the De Rezende-Ferreira 5 Factor model's parameters with fixed  τ\ \tau

Description

The command estimates the parameters of the De Rezende-Ferreira 5 Factor model using fixed  τ1\ \tau_{1} and  τ2\ \tau_{2}

Usage

DRF.5F.tFix(rate, maturity, fixed_tau1, fixed_tau2)

Arguments

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)

Value

An object of class "zoo", that contains  (β0t, β1t, β2t, β3t, β4t, τ1t, τ2t, SSRt, Rt2)\ \left (\beta_{0t},\ \beta_{1t},\ \beta_{2t},\ \beta_{3t},\ \beta_{4t},\ \tau_{1t},\ \tau_{2t},\ SSR_{t},\ R^{2}_{t} \right)

Examples

#
# 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))

Estimation of the De Rezende-Ferreira 5 Factor model's parameters with variable  τ\ \tau

Description

The command estimates the parameters of the De Rezende-Ferreira 5 Factor model using variable  τ1\ \tau_{1} and  τ2\ \tau_{2}

Usage

DRF.5F.tVar(rate, maturity)

Arguments

rate

Vector or matrix of class "zoo", which contains interest rates

maturity

Vector of class "numeric", wich contains the maturities

Details

The De Rezende-Ferreira model used to fit the forward rates is:

ft(m)=β0t+β1temτ1t+β2temτ2t+β3t(mτ1temτ1t)+β4t(mτ2temτ2t)f_{t}\left(m\right) = \beta_{0t} + \beta_{1t} e^{-\frac{m}{\tau_{1t}}} + \beta_{2t} e^{-\frac{m}{\tau_{2t}}} + \beta_{3t} \left ( {\frac{m}{\tau_{1t}}} e^{-\frac{m}{\tau_{1t}}} \right ) + \beta_{4t} \left ( {\frac{m}{\tau_{2t}}} e^{-\frac{m}{\tau_{2t}}} \right )


The spot rates, derived from the forward rates ft(m)f_{t}\left(m\right), are given by:

yt(m)=β0t+β1t(1emτ1tmτ1t)+β2t(1emτ2tmτ2t)+β3t(1emτ1tmτ1temτ1t)+β4t(1emτ2tmτ2temτ2t)y_{t}\left ( m \right ) = \beta_{0t} + \beta_{1t} \left (\frac{1 - e^{-\frac{m}{\tau_{1t}}}}{\frac{m}{\tau_{1t}}}\right) + \beta_{2t} \left (\frac{1 - e^{-\frac{m}{\tau_{2t}}}}{\frac{m}{\tau_{2t}}}\right) + \beta_{3t} \left (\frac{1 - e^{-\frac{m}{\tau_{1t}}}}{\frac{m}{\tau_{1t}}} - e^{-\frac{m}{\tau_{1t}}}\right ) + \beta_{4t} \left (\frac{1 - e^{-\frac{m}{\tau_{2t}}}}{\frac{m}{\tau_{2t}}} - e^{-\frac{m}{\tau_{2t}}}\right )


The set of optimal parameters will be chosen according to the lowest RMSE value:

(τ^1t,τ^2t)=argmin{1Nt=1N1Tt=1T[yt(tn)y^t(tn,τ1t,τ2t,βt^)]2}\left (\widehat{\tau}_{1t},\widehat{\tau}_{2t} \right) = argmin\left \{\frac{1}{N}\sum_{t=1}^{N} \sqrt{\frac{1}{T}\sum_{t=1}^{T}\left [ y_{t}\left (t_{n} \right ) - \widehat{y}_{t}\left (t_{n},\tau_{1t}, \tau_{2t},\widehat{\beta_{t}}\right )\right ]^{2} } \right \}


Value

An object of class "zoo", that contains  (β0t, β1t, β2t, β3t, β4t, τ1t, τ2t, SSRt, Rt2)\ \left (\beta_{0t},\ \beta_{1t},\ \beta_{2t},\ \beta_{3t},\ \beta_{4t},\ \tau_{1t},\ \tau_{2t},\ SSR_{t},\ R^{2}_{t} \right)

Examples

#
# 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))

Zero-Coupon interest rates

Description

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.

Usage

data(ZC_Brazil)

Format

A data frame (txt file) with 12 daily interest rates at different maturities and 10 observed days.


Zero-Coupon interest rates

Description

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.

Usage

data(ZC_China)

Format

A data frame (txt file) with 14 daily interest rates at different maturities and 10 observed days.


Zero-Coupon interest rates

Description

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.

Usage

data(ZC_India)

Format

A data frame (txt file) with 18 daily interest rates at different maturities and 10 observed days.


Zero-Coupon interest rates

Description

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.

Usage

data(ZC_Russia)

Format

A data frame (txt file) with 12 daily interest rates at different maturities and 10 observed days.


Zero-Coupon interest rates

Description

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.

Usage

data(ZC_SouthAfrica)

Format

A data frame (txt file) with 16 daily interest rates at different maturities and 10 observed days.