Hi Everyone (x-posted to -users and -dev), seasonality for inflation term structures is currently in the advanced design stage with Piero Del Boca doing most of the coding work (commentaries provided by Luigi, Nando, Marco Bianchetti and myself). So far the discussion has been off-line but it seemed to everyone involved that we've got to a stage where public comments would accelerate the process. Below is an introduction to seasonality in inflation, the proposed interface changes and additions, and a (brief) summary of the discussion so far. The DRAFT code is attached. This post is quite long - I've put a set of feedback questions at the end, so just scroll down if you want to see them. N.B. - the usual disclaimers apply! Introduction Zero and YoY inflation term structures are generally built from ZCIIS and YYIIS quotes respectively. These are available on, e.g. Bloomberg from a variety of providers. They are generally only available at integer yearly maturities hence the bits-in-between need to be filled in somehow. Unlike nominal term structures, there is evidence of yearly patterns in, e.g. historical monthly CPI fixings. This is important for the mark-to-market of instruments priced from these term structures that pay off at different points to the quotes. Clearly this fill-in is not on a no-arbitrage basis. It is generally small. A good introduction is available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=583642, Impact of Seasonality in Inflation Derivatives Pricing, by Belgrade and Benhamou. Theoretically: - if seasonality is multiplicative for the zero inflation curve then the seasonality correction required for the year-on-year curve is very, very small (effects from changes of measure). - if seasonality is additive for zero inflation then it is non-stationary for year-on-year. Empirically: - if you are interested then get the UK RPI series (it goes back to 1947) and try using X11 to remove the trend (the current X12 takes much longer to implement ... ), or use the seasonality estimator in any number of time-series packages, e.g. R. Then see what you think it looks like. Arguably seasonality could be additive for the last few years but multiplicative over longer horizons. Up to you! - seasonality is also a way of getting in future expected one-off events into the term structure, when these do not occur at integer year points. QuantLib: Inflation Term Structures + Seasonality We want to give users with the ability to provide a seasonality correction to the term structures. The aim is for this to be as non-invasive as possible (does not break existing code) but for seasonality to be an inherent part of the term structures using a bridge-like design pattern, with an addin class called Seasonality. Thus, e.g. for ZeroInflationTermStructure a constructor becomes: ZeroInflationTermStructure(const DayCounter& dayCounter, const Period& lag, Frequency frequency, Rate baseZeroRate, const Handle<YieldTermStructure>& yTS, const boost::shared_ptr<Seasonality> &seasonality = boost::shared_ptr<Seasonality>()); The get/set is defined in the base InflationTermStructure class as: public: void setSeasonality(const boost::shared_ptr<Seasonality> &seasonality = boost::shared_ptr<Seasonality>()); boost::shared_ptr<Seasonality> seasonality() const; bool hasSeasonalityCorrection() const; If seasonality is present it is used. If you setSeasonality() then you remove it. Setting will interact correctly with observability. The interface for Seasonality is very simple. A class derived from seasonality class must provide implementations for correcting both rates - note that these can, of course, be dummies returning the rate they were given. Note also that when these methods are called they are given "this" and the method can downcast it to a Zero- or YoY- term structure safely because it will only be called from the respective class. class Seasonality { public: //! \name Seasonality interface //@{ virtual Rate correctZeroRate(const Date &d, const Rate r, const InflationTermStructure *iTS) const = 0; virtual Rate correctYoYRate(const Date &d, const Rate r, const InflationTermStructure *iTS) const = 0; //@} virtual ~Seasonality() {} }; There are obviously details missing, these are provided in the concrete constructors for the derived classes, see attached files. Hierarchy: (abstract) Seasonality (abstract) MultiplicativeSeasonality and (abstract) AdditiveSeasonality (concrete) StationaryMultiplicativeSeasonality as on left/tbd and (concrete) NonStationaryMultiplicativeSeasonality as on left/tbd Current DRAFT implementations for the Multiplicative versions and updated term structures are attached. Discussion 1) Alternative design: by inheritance (... please let me know if you feel I've misquoted you!) <Luigi> No, I wasn't suggesting to use a spread. I was just saying that we could use the same pattern as for other curves, as in: class InflationCurve { // no seasonality correction embedded here }; class SeasonalityCorrectedInflationCurve { // terrible name, just to make myself clear SeasonalityCorrectedInflationCurve(Handle<InflationCurve>, shared_ptr<Seasonality>); Real inflationImpl { /* adds correction to the underlying curve */ } }; </Luigi> response <Chris> as currently implemented, the seasonality doesn't cause much extra complexity in the base class, so I suggest leaving it in. I don't think that the added complexity of an extra class specifically including it adds enough to be worth having (seasonality is intrinsic to inflation too). ... and you know some specific properties (e.g. effect sums to unity over a year, repeats, etc.), that doesn't seem like the right way to do it. </Chris> 2) Alternative design: for govt bonds This does assume that you are bootstraping from either YYIIS or ZCIIS. To bootstrap a govt inflation curve with seasonality would require a design update. Anybody have any comments on this? E.g. "I really need this", "not now", ... Note - this is not a why-not-have-it-anyway because the bootstrapping for govt linkers is very different as later bonds can have an effect on earlier parts of the TS. Summary / Questions Seasonality can be important in pricing inflation structures (especially derivatives) so we propose to add it. Given that it is intrinsic to inflation we feel that it should be inherent to the term structures (although ignore-able), also since it is relatively simple to add in. Currently the Multiplicative version is nearly ready. Alternative designs (that we decided against) would include seasonality via inheritance, or provide for bootstrapping using govt inflation linkers. Given that the govt market and swap market are fairly separate we don't aim to cover the govt market now, also for technical reasons. Note that we essentially view seasonality as an empirical, non-parametric, add-in. We do not provide methods or models to calculate it from data - this is out of scope. Q1 - What is missing/wrong for the current objectives (seasonality for swap curves)? Q2 - What other objectives are important for you? (e.g. parametric models, govt mkt) ALL SUGGESTIONS WELCOME ... especially if they come with code examples! N.B. - the usual disclaimers apply! ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev DRAFT_seasonality_files.tar (151K) Download Attachment |
On Tue, 2008-04-29 at 01:50 -0700, Chris Kenyon wrote:
> We want to give users with the ability to provide a seasonality > correction to the term structures. > > The get/set is defined in the base InflationTermStructure class as: > > public: > void setSeasonality(const boost::shared_ptr<Seasonality> > &seasonality = boost::shared_ptr<Seasonality>()); > boost::shared_ptr<Seasonality> seasonality() const; > bool hasSeasonalityCorrection() const; I'm not sure that I like the setter. Of course observability can be implemented correctly, but I'd prefer curves to be immutables. What I'm worried about is the following scenario: Handle<InflationTermStructure> ts; InflationInstrument I1(..., ts); InflationInstrument I2(..., ts); I1.someResult(...); // for some reason, calls setSeasonality() at which point the value of I2 changes. We had such a bug in the past when calculating the implied volatility of an option would modify the underlying equity process for other instruments. It wasn't pretty. My proposal of adding seasonality by wrapping the curve was so that I1 could (if needed) take the passed term structure, wrap it, and use the wrapped curve without modifying the original one. Thoughts? Later, Luigi -- All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. -- IBM maintenance manual, 1925 ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Chris Kenyon-2
I like the idea that curves are immutable. However, I'm not keen on introducing another level of coding structure. A simple solution would be to remove the setter. This way curves are immutable, and if a user wants different seasonalities they can just provide different curves ... this does seem like a normal way to go about things (to me). I don't favor using Quotes for seasonality data since seasonality should not be changing on short timescales (there are no market quotes - this is exactly why this feature was invented). Comments anyone? Regards, Chris ----- Original Message ---- From: Luigi Ballabio <[hidden email]> To: Chris Kenyon <[hidden email]> Cc: [hidden email]; [hidden email] Sent: Wednesday, April 30, 2008 12:19:00 PM Subject: Re: [Quantlib-dev] seasonality for inflation term structures On Tue, 2008-04-29 at 01:50 -0700, Chris Kenyon wrote: > We want to give users with the ability to provide a seasonality > correction to the term structures. > > The get/set is defined in the base InflationTermStructure class as: > > public: > void setSeasonality(const boost::shared_ptr<Seasonality> > &seasonality = boost::shared_ptr<Seasonality>()); > boost::shared_ptr<Seasonality> seasonality() const; > bool hasSeasonalityCorrection() const; I'm not sure that I like the setter. Of course observability can be implemented correctly, but I'd prefer curves to be immutables. What I'm worried about is the following scenario: Handle<InflationTermStructure> ts; InflationInstrument I1(..., ts); InflationInstrument I2(..., ts); I1.someResult(...); // for some reason, calls setSeasonality() at which point the value of I2 changes. We had such a bug in the past when calculating the implied volatility of an option would modify the underlying equity process for other instruments. It wasn't pretty. My proposal of adding seasonality by wrapping the curve was so that I1 could (if needed) take the passed term structure, wrap it, and use the wrapped curve without modifying the original one. Thoughts? Later, Luigi -- All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. -- IBM maintenance manual, 1925 ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Chris
On Thu, May 1, 2008 at 10:01 AM, Chris Kenyon <[hidden email]> wrote: > I don't favor using Quotes for seasonality data since seasonality > should not be changing on short timescales (there are no market > quotes - this is exactly why this feature was invented). > Comments anyone? I understand your reasons but I am in favor of Quotes, especially since they would be the main hook for sensitivity analysis, i.e. in order to calculate sensitivity with finite differences you just tweak the Quote value, recalculate the NPV of your portfolio, then restore the original value. The observability combined with the lazyness ensure optimal performances and general easiness for this approach, which is probably one of best features of the QuantLib design. ciao -- Nando ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Chris Kenyon-2
Hi Nando, that makes sense. This also makes setSeasonality methods safer because if you are using Quotes it is a signal that you may be changing all sorts of other things. OK lets go that way because: 1) helps avoids unexpected side effects (i.e. given the QuantLib setup you know that if you change a quote, or if you have to make new ones, then you are doing something drastic); 2) permits sensitivity analysis (which is also what get/set are about). This implies: 1) Instead of vector<Real> we use a vector<Handle<Quote> > for seasonality factors. Have I understood what you meant? Any objections anyone? Regards, Chris ----- Original Message ---- From: Ferdinando Ametrano <[hidden email]> To: Chris Kenyon <[hidden email]> Cc: [hidden email]; [hidden email]; [hidden email] Sent: Thursday, May 1, 2008 6:19:32 PM Subject: Re: [Quantlib-dev] seasonality for inflation term structures Hi Chris On Thu, May 1, 2008 at 10:01 AM, Chris Kenyon <[hidden email]> wrote: > I don't favor using Quotes for seasonality data since seasonality > should not be changing on short timescales (there are no market > quotes - this is exactly why this feature was invented). > Comments anyone? I understand your reasons but I am in favor of Quotes, especially since they would be the main hook for sensitivity analysis, i.e. in order to calculate sensitivity with finite differences you just tweak the Quote value, recalculate the NPV of your portfolio, then restore the original value. The observability combined with the lazyness ensure optimal performances and general easiness for this approach, which is probably one of best features of the QuantLib design. ciao -- Nando ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Fri, 2008-05-02 at 00:57 -0700, Chris Kenyon wrote:
> This implies: > 1) Instead of vector<Real> we use a vector<Handle<Quote> > for > seasonality factors. Or we use either. Luigi -- The economy depends about as much on economists as the weather does on weather forecasters. -- Jean-Paul Kauffmann ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |