[R-SIG-Finance] The challenge to fit the greek gov curve with termstrc R Package!

Enrico Schumann enricoschumann at yahoo.de
Thu Dec 8 17:46:24 CET 2011


[this goes to the list so that others may benefit as well, though I am 
not so sure about 'benefit'  :) ]

A good start would be to provide a small data set with 'dput', maybe 
attached as a txt-file, and the exact things you tried.

Again, I have never used the package, so you may look for help 
elsewhere. But here is what I see:

The function 'bond_yields' seems to set the limits for uniroot to -1 and 
1; I am not sure if they can be passed with your initial function call 
(I will not read the documentation for you). Since the package has a 
namespace, you cannot simply create a copy of the function. But you can 
use 'trace', with 'edit = TRUE'.

Thus,

 > trace(bond_yields, edit = TRUE)

and add the line (say)

searchint = c(-1, 20)

With this I got, with the data set you sent me off-list

$greece
      tau_min      tau_max gridstepsize
    0.2794521   28.8027397    0.2000000

[1] "Searching startparameters for  greece"
        beta0        beta1        beta2         tau1
2045.9677643   77.8918645   74.3183463    0.2795521
---------------------------------------------------
Estimated Nelson/Siegel parameters:
---------------------------------------------------

        greece
beta_0 2045.96776
beta_1   77.89186
beta_2   74.31835
tau_1     0.27951

This is all a bit dirty, and I cannot judge if it is meaningful at all.


Regards,
Enrico



Am 08.12.2011 17:11, schrieb ArvanitisCh at piraeusbank.gr:
> Yes I have searched and not able to find it out
>
> Can you provide some guidance?
>
> I have also send an image data in order to have easily reproducible results would you like to try out?
>
> Regards
> christos
>
> -----Original Message-----

> Sent: Thursday, December 08, 2011 6:06 PM
> To: Αρβανίτης Χρήστος; r-sig-finance at r-project.org
[[elided Yahoo spam]]
>
>
> Hi Christos
>
> first, I don't use the termstrc package, so this is all guess work.
>
> If the bonds mature reasonably soon (say, next year), and have a price
> of 30 or so, they will have a high yield-to-maturity.
>
> Now, 'uniroot' could be used to compute a yield to maturity. But
> 'uniroot' requires a search interval. I would not be unreasonable to
> suspect that this interval does not include yields of, say, 150%.
>
> So, if all these guesses are right, you need to figure out where this
> interval is set, and just increase its width (to, say, 300% or so).
>
> I hope that I am not completely off-track here ... ;)
>
> Regards,
> Enrico
>
>
>
> Am 08.12.2011 16:27, schrieb ArvanitisCh at piraeusbank.gr:
[[elided Yahoo spam]]
>>
>> I am trying to calculate ZC Greek Govt curve using the termstrc R package.
>>
>> I have list arrange my dataset as prescribed in the termstrc package
>>
>> When I run cs_res<- estim_nss(cbonds,"greece")  I am getting the following error:
>>
>> Error in uniroot(pvcashflows, searchint, tol = tol, maxiter = 3000) :
>>     f() values at end points not of opposite sign
>>
[[elided Yahoo spam]]
>>
>> http://r.789695.n4.nabble.com/Library-termstrc-td3057745.html
>>
>> But I am sure that my data set is arranged properly
>>
[[elided Yahoo spam]]
>>
[[elided Yahoo spam]]
>>
>> Is there any way to fix this issue and calculate the Curve??
>>
>> Tnks in advance for your help
>>
>> Regards
>> Christos
>>
>> PS The structure of my datasets is:
>>
>> List of 5
>>    $ greece :List of 8
>>     ..$ ISIN        : chr [1:11] "GR0114020457" "GR0114022479" "GR0114023485" "GR0124028623" ...
>>     ..$ MATURITYDATE:Class 'Date'  num [1:11] 15571 16301 16666 17001 17366 ...
>>     ..$ ISSUEDATE   :Class 'Date'  num [1:11] 13573 14271 14641 13165 13529 ...
>>     ..$ COUPONRATE  : num [1:11] 4.1 5.5 6.1 3.6 4.3 4.6 6 6.5 6.25 5.3 ...
>>     ..$ PRICE       : num [1:11] 29.7 20.9 24.5 19.8 19.5 ...
>>     ..$ ACCRUED     : num [1:11] 1.29 1.73 1.92 1.44 1.72 ...
>>     ..$ CASHFLOWS   :List of 3
>>     .. ..$ ISIN: chr [1:96] "GR0114020457" "GR0114022479" "GR0114022479" "GR0114022479" ...
>>     .. ..$ CF  : num [1:96] 104.1 5.5 5.5 105.5 6.1 ...
>>     .. ..$ DATE:Class 'Date'  num [1:96] 15571 15571 15936 16301 15571 ...
>>     ..$ TODAY       :Class 'Date'  num 15316
>>    $ germany:List of 8
>>     ..$ ISIN        : chr [1:11] "DE0001137321" "DE0001141547" "DE0001141562" "DE0001141596" ...
>>     ..$ MATURITYDATE:Class 'Date'  num [1:11] 15687 16170 16492 16856 17169 ...
>>     ..$ ISSUEDATE   :Class 'Date'  num [1:11] 14924 14329 14623 14987 13468 ...
>>     ..$ COUPONRATE  : num [1:11] 1 2.25 2.5 2 3.75 4 3.75 3.25 2.5 6.25 ...
>>     ..$ PRICE       : num [1:11] 101 105 106 105 113 ...
>>     ..$ ACCRUED     : num [1:11] 1.08 1.51 1.98 1.82 3.52 ...
>>     ..$ CASHFLOWS   :List of 3
>>     .. ..$ ISIN: chr [1:98] "DE0001137321" "DE0001137321" "DE0001141547" "DE0001141547" ...
>>     .. ..$ CF  : num [1:98] 1.09 101 2.25 2.25 102.25 ...
>>     .. ..$ DATE:Class 'Date'  num [1:98] 15321 15687 15440 15805 16170 ...
>>     ..$ TODAY       :Class 'Date'  num 15316
>>    $ us     :List of 8
>>     ..$ ISIN        : chr [1:6] "US912828PW43" "US912810PZ57" "US912828PM60" "US912828PN44" ...
>>     ..$ MATURITYDATE:Class 'Date'  num [1:6] 15704 21563 16799 17530 18488 ...
>>     ..$ ISSUEDATE   :Class 'Date'  num [1:6] 14973 14273 14973 14973 14836 ...
>>     ..$ COUPONRATE  : num [1:6] 0.625 2.5 2.125 2.75 2.625 ...
>>     ..$ PRICE       : num [1:6] 100 132 106 109 106 ...
>>     ..$ ACCRUED     : num [1:6] 0.275 0.999 0.935 1.211 0.827 ...
>>     ..$ CASHFLOWS   :List of 3
>>     .. ..$ ISIN: chr [1:136] "US912828PW43" "US912828PW43" "US912828PW43" "US912810PZ57" ...
>>     .. ..$ CF  : num [1:136] 0.312 0.312 100.312 1.32 1.345 ...
>>     .. ..$ DATE:Class 'Date'  num [1:136] 15338 15520 15704 15353 15535 ...
>>     ..$ TODAY       :Class 'Date'  num 15316
>>    $ ote    :List of 8
>>     ..$ ISIN        : chr [1:3] "XS0173549659" "XS0275776283" "XS0346402463"
>>     ..$ MATURITYDATE:Class 'Date'  num [1:3] 15921 16940 16477
>>     ..$ ISSUEDATE   :Class 'Date'  num [1:3] 12268 13472 13920
>>     ..$ COUPONRATE  : num [1:3] 5 4.62 6
>>     ..$ PRICE       : num [1:3] 72.2 57.7 62
>>     ..$ ACCRUED     : num [1:3] 1.78 2.62 5
>>     ..$ CASHFLOWS   :List of 3
>>     .. ..$ ISIN: chr [1:11] "XS0173549659" "XS0173549659" "XS0275776283" "XS0275776283" ...
>>     .. ..$ CF  : num [1:11] 5 105 4.62 4.62 4.62 ...
>>     .. ..$ DATE:Class 'Date'  num [1:11] 15556 15921 15479 15844 16209 ...
>>     ..$ TODAY       :Class 'Date'  num 15316
>>    $ eurob  :List of 8
>>     ..$ ISIN        : chr [1:3] "XS0443680052" "XS0291422979" "XS0284635702"
>>     ..$ MATURITYDATE:Class 'Date'  num [1:3] 15746 15426 16105
>>     ..$ ISSUEDATE   :Class 'Date'  num [1:3] 14466 13599 13548
>>     ..$ COUPONRATE  : num [1:3] 4.38 1.68 1.78
>>     ..$ PRICE       : num [1:3] 56.4 80.7 55.3
>>     ..$ ACCRUED     : num [1:3] 3.656 0.356 0.178
>>     ..$ CASHFLOWS   :List of 3
>>     .. ..$ ISIN: chr [1:13] "XS0443680052" "XS0443680052" "XS0291422979" "XS0291422979" ...
>>     .. ..$ CF  : num [1:13] 4.375 104.375 0.426 100.404 0.45 ...
>>     .. ..$ DATE:Class 'Date'  num [1:13] 15380 15746 15335 15426 15375 ...
>>     ..$ TODAY       :Class 'Date'  num 15316
>>    - attr(*, "class")= chr "couponbonds"
>>
>> ____________________________________
>> Christos Arvanitis
>> Assistant Manager
>> Treasury Support Operations
>> PIRAEUS BANK S.A.
>> 5 Korai str., Athens, GR 10564
>>
>> Tel:         •   +30 210 3288678
>> Mobile:     Ë    +30 6936114432
>> e-mail:            ArvanitisCh at piraeusbank.gr<mailto:ArvanitisCh at piraeusbank.gr>
>>
>>
>>
>> MESSAGE CONFIDENTIALITY&   SECURITY NOTICE
>>
>> =========================================
>>
>> This message and/or its attachments may contain confidential and privileged information and is intended for the named person or entity to which it is addressed. Any use, copying or distribution of this information by anyone other than the intended recipient(s) is prohibited by law. If you receive this in error, please immediately delete it from your system and notify the sender.
>>
>> The contents of this message contain personal opinions of the sender, which are not the official views of Piraeus Bank nor do they consist a provision of financial or advisory services unless expressly stated otherwise. This message is not a solicitation and/or an offer or acceptance of any proposal in relation to any contract or transaction unless expressly otherwise indicated in the message itself.
>>
>> The Internet is not a secure or error-free environment, and Piraeus Bank does not accept liability for any loss or damage arising from the use of this message or from delayed, intercepted, corrupted or virus-infected e-mail transmission.
>>
>>
>>
>> 	[[alternative HTML version deleted]]
>>
>>
>>
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions should go.
>

-- 
Enrico Schumann
Lucerne, Switzerland
http://nmof.net/



More information about the R-SIG-Finance mailing list