Thanks, Josef. I can invoke it now.
However, I found all spot_rates are computed as 0 and all discount_factors
as 1.
That is, when I do the following:
library(termstrc)data(eurobonds)
b <- matrix(rep(c(0,0,0, 1),1),nrow=1,byrow=TRUE)
group<-c("GERMANY")
colnames(b) <- c("beta0","beta1","beta2","tau1")
germaturities<-create_maturities_matrix(eurobonds$GERMANY)

cf <- create_cashflows_matrix(eurobonds$GERMANY)

bp <- bond_prices(method ="Nelson/Siegel",b,germaturities,cf)

str(bp)

The output is:

List of 3
 $ spot_rates      : num [1:32, 1:29] 0 0 0 0 0 0 0 0 0 0 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : NULL
  .. ..$ : chr [1:29] "DE0001134468" "DE0001134922" "DE0001135028"
"DE0001135036" ...
 $ discount_factors: num [1:32, 1:29] 1 1 1 1 1 1 1 1 1 1 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : NULL
  .. ..$ : chr [1:29] "DE0001134468" "DE0001134922" "DE0001135028"
"DE0001135036" ...
 $ bond_prices     : Named num [1:29] 166 219 112 112 243 ...
  ..- attr(*, "names")= chr [1:29] "DE0001134468" "DE0001134922"
"DE0001135028" "DE0001135036" ...

Any idea if I should do something to get proper spot_rates &
discount_factors?

Regards.


On Thu, Apr 9, 2009 at 2:19 PM, Josef Hayden <josef.hayden@wu-wien.ac.at>wrote:

> Hello,you also have to create the matrix of cashfows before you can
> calculate the bond prices (function: create_cashflows_matrix).
> In order to get useful bond prices you should use appropriate Nelson/Siegel
> parameters (b).
>
>
> The modified code snippet:
>
> library(termstrc)
> data(eurobonds)
> b <- matrix(rep(c(0,0,0, 1),1),nrow=1,byrow=TRUE)
> group<-c("GERMANY")
> colnames(b) <- c("beta0","beta1","beta2","tau1")
> germaturities<-create_maturities_matrix(eurobonds$GERMANY)
>
> cf <- create_cashflows_matrix(eurobonds$GERMANY)
>
> (bp <- bond_prices(method =
> "Nelson/Siegel",b,germaturities,cf)$bond_prices)
>
>
>
> Best regards,
> Josef
>
> Am 9 Apr 2009 um 10:15 schrieb Chirantan Kundu:
>
> Hi,
> I'm trying to invoke the function bond_prices from termstrc package.
>
> Here is the code snippet:
>
> library(termstrc)
> data(eurobonds)
> b <- matrix(rep(c(0,0,0, 1),1),nrow=1,byrow=TRUE)
> group<-c("GERMANY")
> colnames(b) <- c("beta0","beta1","beta2","tau1")
> germaturities<-create_maturities_matrix(eurobonds$GERMANY)
> bp<-bond_prices(method =
> "Nelson/Siegel",b,germaturities,eurobonds$GERMANY$CASHFLOWS$CF)
> bp
>
> Running this, I get the following warning message:
> In cf * discount_factors :
>  longer object length is not a multiple of shorter object length
>
> Also the values I get (bp) seems not correct (way too high). I'm not sure
> if
> I need to change b.
>
> I'm on Windows XP and using R-2.7.2 + *termstrc* 1.1.
>
> Any help will be appreciated.
> Regards,
> Chirantan
>
> ____________________________________
> Visit us at http://www.2pirad.com
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>
>
>

____________________________________
Visit us at http://www.2pirad.com

	[[alternative HTML version deleted]]

