[Yield-curve-commits] r46 - pkg/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 3 20:10:18 CET 2012


Author: guirreri
Date: 2012-11-03 20:10:17 +0100 (Sat, 03 Nov 2012)
New Revision: 46

Modified:
   pkg/man/NSrates.Rd
   pkg/man/Nelson.Siegel.Rd
   pkg/man/Srates.Rd
   pkg/man/Svensson.Rd
   pkg/man/YieldCurve-package.Rd
Log:


Modified: pkg/man/NSrates.Rd
===================================================================
--- pkg/man/NSrates.Rd	2012-11-01 16:28:33 UTC (rev 45)
+++ pkg/man/NSrates.Rd	2012-11-03 19:10:17 UTC (rev 46)
@@ -29,14 +29,11 @@
 
 \examples{ 
 data(FedYieldCurve)
-tau <- c(3, 6, 12, 60, 84, 120)
-mediumTerm <- c(12,60,84)
-NSParameters <- Nelson.Siegel( rate=FedYieldCurve[1:10,],
-			maturity=tau, MidTau=mediumTerm )
-Coeff <- NSParameters[10,]
-y <- NSrates( Coeff, tau)
-plot(tau,FedYieldCurve[10,],main="Fitting Nelson-Siegel yield curve", type="o")
-lines(tau,y, col=2)
+maturity.Fed <- c(3, 6, 12, 60, 84, 120)
+NSParameters <- Nelson.Siegel( rate=FedYieldCurve[1:10,], maturity=maturity.Fed )
+y <- NSrates(NSParameters[5,],maturity.Fed)
+plot(maturity.Fed,FedYieldCurve[10,],main="Fitting Nelson-Siegel yield curve", type="o")
+lines(maturity.Fed,y, col=2)
 legend("topleft",legend=c("observed yield curve","fitted yield curve"),
 col=c(1,2),lty=1)
 grid()

Modified: pkg/man/Nelson.Siegel.Rd
===================================================================
--- pkg/man/Nelson.Siegel.Rd	2012-11-01 16:28:33 UTC (rev 45)
+++ pkg/man/Nelson.Siegel.Rd	2012-11-03 19:10:17 UTC (rev 46)
@@ -7,14 +7,13 @@
 }
 
 \usage{
-Nelson.Siegel(rate, maturity, MidTau)
+Nelson.Siegel( rate, maturity )
 }
 
 \arguments{
   \item{rate}{vector or matrix which contains the interest rates.}
   \item{maturity}{vector wich contains the maturity ( in months) of the \code{rate}. The vector's length must be the same 
 		of the number of columns of the \code{rate}.} 
-  \item{MidTau}{vector which indicates medium term maturity to maximize the beta_2 factor. }
 }
 \details{
 The Nelson-Siegel's model to describe the yield curve is:
@@ -38,13 +37,12 @@
 \seealso{ NelsonSiegel, Svensson}
 \examples{
 data(FedYieldCurve)
-tau <- c(3, 6, 12, 60, 84, 120)
-mediumTerm <- c(12,60,84)
-NSParameters <- Nelson.Siegel( rate=FedYieldCurve[1:10,], 
-			maturity=tau, MidTau=mediumTerm )
-y <- NSrates(NSParameters[5,], tau)
-plot(tau,FedYieldCurve[5,],main="Fitting Nelson-Siegel yield curve", type="o")
-lines(tau,y, col=2)
+maturity.Fed <- c(3, 6, 12, 60, 84, 120)
+NSParameters <- Nelson.Siegel( rate=FedYieldCurve[1:10,],	maturity=maturity.Fed)
+y <- NSrates(NSParameters[5,], maturity.Fed)
+plot(maturity.Fed,FedYieldCurve[5,],main="Fitting Nelson-Siegel yield curve",
+  xlab=c("Pillars in months"), type="o")
+lines(maturity.Fed,y, col=2)
 legend("topleft",legend=c("observed yield curve","fitted yield curve"),
 col=c(1,2),lty=1)
 grid()

Modified: pkg/man/Srates.Rd
===================================================================
--- pkg/man/Srates.Rd	2012-11-01 16:28:33 UTC (rev 45)
+++ pkg/man/Srates.Rd	2012-11-03 19:10:17 UTC (rev 46)
@@ -28,12 +28,15 @@
 
 \examples{
 data(ECBYieldCurve)
-tauECB <- c(0.25,0.5,1:30)
-Y <- Svensson(ECBYieldCurve[1:10,], tauECB, c(1,4), c(5,8) )
-B <- Srates(Y, tauECB, whichRate="Spot")
-plot(tauECB,ECBYieldCurve[10,],main="Fitting Svensson's yield curve", type="o")
-lines(tauECB,B[10,], col=2)
-legend("topleft",legend=c("observed yield curve","fitted yield curve"),col=c(1,2),lty=1)
+rate.ECB = ECBYieldCurve[1:5,]
+maturity.ECB = c(0.25,0.5,seq(1,30,by=1))
+SvenssonParameters <- Svensson(rate.ECB, maturity.ECB)
+Svensson.rate <- Srates( SvenssonParameters ,maturity.ECB,"Spot")
+
+plot(maturity.ECB, rate.ECB[5,],main="Fitting Svensson yield curve", type="o")
+lines(maturity.ECB, Svensson.rate[5,], col=2)
+legend("topleft",legend=c("observed yield curve","fitted yield curve"),
+col=c(1,2),lty=1)
 grid()
 }
 

Modified: pkg/man/Svensson.Rd
===================================================================
--- pkg/man/Svensson.Rd	2012-11-01 16:28:33 UTC (rev 45)
+++ pkg/man/Svensson.Rd	2012-11-03 19:10:17 UTC (rev 46)
@@ -5,15 +5,13 @@
   Returns the estimated coefficients of the Svensson's model.
 }
 \usage{
-Svensson(rate, maturity, Tau1 = c(3, 12), Tau2 = c(60, 120))
+Svensson(rate, maturity )
 }
 %- maybe also 'usage' for other objects documented here.
 \arguments{
   \item{rate}{ vector or matrix which contains the interest rates.}
   \item{maturity}{ vector wich contains the maturity ( in months) of the \code{rate}. The vector's length must be the same 
 		of the number of columns of the \code{rate}.}
-  \item{Tau1}{ vector of short-term maturity }
-  \item{Tau2}{ vector of long-term maturity }
 }
 \details{
 The Svensson's model to describe the forward rate is:
@@ -42,9 +40,16 @@
 }
 \author{ Sergio Salvino Guirreri}
 \examples{
-data(FedYieldCurve)
-tau <- c(3,6,12,60,84,120)
-A <- Svensson(FedYieldCurve[1:10,], tau, c(3,12), c(60,120) )
+data(ECBYieldCurve)
+maturity.ECB <- c(0.25,0.5,seq(1,30,by=1))
+A <- Svensson(ECBYieldCurve[1:10,], maturity.ECB )
+Svensson.rate <- Srates( A, maturity.ECB, "Spot" )
+plot(maturity.ECB, Svensson.rate[5,],main="Fitting Svensson yield curve",
+ xlab=c("Pillars in years"), type="l", col=3)
+lines( maturity.ECB, ECBYieldCurve[5,],col=2)
+legend("topleft",legend=c("fitted yield curve","observed yield curve"),
+col=c(1,2),lty=1)
+grid()
 }
 \keyword{models}
 \keyword{htest}

Modified: pkg/man/YieldCurve-package.Rd
===================================================================
--- pkg/man/YieldCurve-package.Rd	2012-11-01 16:28:33 UTC (rev 45)
+++ pkg/man/YieldCurve-package.Rd	2012-11-03 19:10:17 UTC (rev 46)
@@ -15,8 +15,8 @@
 \tabular{ll}{
 Package: \tab YieldCurve\cr
 Type: \tab Package\cr
-Version: \tab 2.0\cr
-Date: \tab 2009-11-03\cr
+Version: \tab 4.0\cr
+Date: \tab 2012-11-03\cr
 License: \tab GPL (>= 2)\cr
 LazyLoad: \tab yes\cr
 }
@@ -44,14 +44,27 @@
 
 
 \examples{
+### Nelson.Siegel function and Fed data-set ###
 data(FedYieldCurve)
-tau <- c(3, 6, 12, 60, 84, 120)
-mediumTerm <- c(12,60,84)
-NSParameters <- Nelson.Siegel( rate=FedYieldCurve[1:10,], 
-			maturity=tau, MidTau=mediumTerm )
-y <- NSrates(NSParameters[5,],tau)
-plot(tau,FedYieldCurve[5,],main="Fitting Nelson-Siegel yield curve", type="o")
-lines(tau,y, col=2)
+rate.Fed = FedYieldCurve[1:5,]
+maturity.Fed <- c(3, 6, 12, 60, 84, 120)
+NSParameters <- Nelson.Siegel( rate= rate.Fed, maturity=maturity.Fed )
+y <- NSrates(NSParameters[5,], maturity.Fed)
+plot(maturity.Fed,rate.Fed[5,],main="Fitting Nelson-Siegel yield curve", type="o")
+lines(maturity.Fed,y, col=2)
 legend("topleft",legend=c("observed yield curve","fitted yield curve"),
 col=c(1,2),lty=1)
+
+### Svensson function and ECB data-set ###
+data(ECBYieldCurve)
+rate.ECB = ECBYieldCurve[1:5,]
+maturity.ECB = c(0.25,0.5,seq(1,30,by=1))
+SvenssonParameters <- Svensson(rate.ECB, maturity.ECB)
+Svensson.rate <- Srates( SvenssonParameters ,maturity.ECB,"Spot")
+
+plot(maturity.ECB, rate.ECB[5,],main="Fitting Svensson yield curve", type="o")
+lines(maturity.ECB, Svensson.rate[5,], col=2)
+legend("topleft",legend=c("observed yield curve","fitted yield curve"),
+col=c(1,2),lty=1)
 }
+



More information about the Yield-curve-commits mailing list