[R-SIG-Finance] termstrc: bond yields

Josef Hayden josef.hayden at wiwi.uni-regensburg.de
Mon Sep 28 11:05:29 CEST 2009


Hello

The function "create_cashflows_matrix" requires the cashflows of one 
group element (rating class, country etc.).
Try:

library(termstrc)
data(corpbonds)
create_cashflows_matrix(corpbonds[[1]])



For calculations for the complete group use lapply or mapply:
group <- c("AAA", "AA+", "AA")

lapply(corpbonds[group], create_cashflows_matrix)

The same holds for the "create_maturities_matrix" function.

Regards,
Josef

>
>> *Von: *sprohl at na.uni-tuebingen.de <mailto:sprohl at na.uni-tuebingen.de>
>> *Datum: *28 September 2009 08:32:17 GMT+02:00
>> *An: *r-sig-finance at stat.math.ethz.ch 
>> <mailto:r-sig-finance at stat.math.ethz.ch>
>> *Betreff: **[R-SIG-Finance] termstrc: bond yields*
>>
>> Hello,
>> by using termstrc package to compute bond yields using example 
>> considered
>> in "Zero-coupon yield curve estimation with the Package termstrc", I run
>> into following problems:
>>
>> data(corpbonds)
>>
>> group <- c("AAA", "AA+", "AA")
>>
>> cashflows<-create_cashflows_matrix(group, include_price = FALSE)
>> Fehler in as.vector(x, mode) : ungültiges Argument 'mode'
>> Zusätzlich: Warning message:
>> $ operator is deprecated for atomic vectors, returning NULL in:
>> group$CASHFLOWS
>>
>> cashflows<-create_maturities_matrix(group, include_price = FALSE)
>> Fehler in as.vector(x, mode) : ungültiges Argument 'mode'
>> Zusätzlich: Warning message:
>> $ operator is deprecated for atomic vectors, returning NULL in:
>> group$CASHFLOWS
>>
>> # compute bond yields
>> bond_yields(cashflows, m, searchint = c(-1, 1), tol = 1e-10)
>> Fehler in bond_yields(cashflows, m, searchint = c(-1, 1), tol = 1e-10) :
>>        unbenutzte(s) Argument(e) (searchint = c(-1, 1))
>>
>> Does anybody know how to solve this problem?
>> Best regards,
>> Sven
>>
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch 
>> <mailto:R-SIG-Finance at 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.
>>
>



More information about the R-SIG-Finance mailing list