SERVING THE QUANTITATIVE FINANCE COMMUNITY

  • 1
  • 3
  • 4
  • 5
  • 6
  • 7
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

PDE/PIDE (FDM. FEM) methods thread

December 20th, 2011, 3:29 pm

Another requirement is post-processing of errors. This approach can be used in different regions etc. An example of what is possible by using libraries.
Last edited by Cuchulainn on December 19th, 2011, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 14th, 2012, 9:43 am

Implementing PDE Models in C++ and Boost: OverviewWe now discuss the motivation for and the design of a customisable software system in C++ to price two-factor equity options (as discussed in Haug 2007 and Zhang 1998). The main goal is to set up and eventually extend a software framework to allow fast prototyping of new finance PDE models, finite difference schemes and C++ libraries to improve efficiency and speedup. In particular, the short terms goals are:. The ability to define new schemes, introduce them to the framework and test their accuracy by comparing them with the exact solutions, if available (see Haug 2007). For example, we can test the different variants of the Alternating Direction Explicit (ADE) method in combination the Janenko method and it is also possible to investigate the effects on accuracy by comparing different kinds of boundary conditions.. Analyse and design software systems by decomposing them into loosely-coupled components with each component having well-defined interfaces. Having found these components we then implement them using a combination of higher-order function libraries such as Boost Function, Signals and Bind. The data that is transported between components is usually modeled as uBLAS vectors and matrices.We use Domain Architectures, System and Design Patterns as drivers of the design process (Duffy 2004A, POSA 1996, GOF 1995). This approach is needed in our experience if we wish to produce flexible and customizable software systems.. In general, we try not to create home-grown software if it is available in STL and Boost, for example. This approach improves standardization and reduces the learning curve (Demming 2010, Demming 2012).. When creating this software system we will hopefully need to develop utilities (for example, post-processing error analysis) that can be used in other applications. C++ source code in a few days I use VS2010 and Boost 1.47. typical output
Last edited by Cuchulainn on February 13th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 19th, 2012, 3:57 pm

Here is the source code for 2-factor linear PDE. You can define your PDE (e.g. Heston) and test ADE against it. Some scenarios for you could be:1. does ADE work for your PDE2. Are your PDE BC well-defined3. AccuracyExcel output will show this. You need to create a VS C++ project.BTW I an using domain transformation.
Attachments
TwoFactorADE101.zip
(32.95 KiB) Downloaded 22 times
Last edited by Cuchulainn on February 18th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 21st, 2012, 6:52 am

Another benchmark is to compare ADE to 1. Crank-Nicolson and Rannacher2. ADI and Soviet Splitting and the impact of the LU on their performance3. Accuracy and parallelisability4. Craig-Sneyd versus Janenko4. Do we need non-constant meshes? 5. It is relatively easy to upgrade this ADE code to 3d. A possibility is to use Boost::multi-array as container. See Part IIIhttps://www.quantnet.com/boost-and-computational-finance/
Last edited by Cuchulainn on February 20th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Alan
Posts: 9783
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 27th, 2012, 4:50 pm

Here's a very nice, IMO, 3-factor PDE test problem suggested by another thread.Namely, suppose you write a solver for bond prices for theChen (1996) 3 factor interest rate model, given at eqn (27) hereAs in all bond models, the asymptotic yield is given byThere is undoubtedly a nice relatively simple analytic formula for y(infinity) I will post when I work it out,assuming it's not in Chen's article which I haven't seen yet. The formula will beindependent of the hotspot values (r0, theta0,v0), but will depend on the (sde/pde) parameters.So, the idea would be to get a 3-factor pde working, take larger and larger T, and show convergenceto the analytic formula. [If any interest, I will be happy to post boundary conditions, once I think them through ...]
Last edited by Alan on February 26th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 27th, 2012, 6:22 pm

QuoteSo, the idea would be to get a 3-factor pde working, take larger and larger T, and show convergenceto the analytic formula. Why not solve the corresponding elliptic PDE directly and use your BC?Does solution of parabolic PDE --> solution of elliptic PDE in the time limit?Can @FX get on this with ADE??my PDE 'queue' in C++ isCIRHestonthis
Last edited by Cuchulainn on February 26th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Alan
Posts: 9783
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 27th, 2012, 6:30 pm

Sorry, on second thought, I don't like this model, as the interest rate can go negative. So, withdraw this suggestion. Re elliptic; I don't have an elliptic solver, so only use the large T parabolic method,(which is often tedious, but works).I did play around with a public source FEM elliptic solver and posted about ita few years ago, but decided it was flakey in the end.
Last edited by Alan on February 26th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

PDE/PIDE (FDM. FEM) methods thread

February 27th, 2012, 6:32 pm

QuoteOriginally posted by: AlanSorry, on second thought, I don't like this model, as the interest rate can go negative. So, withdraw this suggestion.Alan, isn't this actually even more desirable/applicable now (with Fed's quantitative easing and ECB's actions)?
 
User avatar
Alan
Posts: 9783
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 27th, 2012, 6:36 pm

QuoteOriginally posted by: PolterQuoteOriginally posted by: AlanSorry, on second thought, I don't like this model, as the interest rate can go negative. So, withdraw this suggestion.Alan, isn't this actually even more desirable/applicable now (with Fed's quantitative easing and ECB's actions)?IMO, a few basis points negative is fine, but these models that allow arbitrary negative (nominal) rates are nonsenseto me.
 
User avatar
Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

PDE/PIDE (FDM. FEM) methods thread

February 27th, 2012, 8:13 pm

QuoteOriginally posted by: AlanQuoteOriginally posted by: PolterQuoteOriginally posted by: AlanSorry, on second thought, I don't like this model, as the interest rate can go negative. So, withdraw this suggestion.Alan, isn't this actually even more desirable/applicable now (with Fed's quantitative easing and ECB's actions)?IMO, a few basis points negative is fine, but these models that allow arbitrary negative (nominal) rates are nonsenseto me.Huh, I see, interesting. But that still excludes the "traditional" models (i.e., the ones guaranteed to be non-negative), right? Out of curiosity, is there a recommended/industry-std. adjustment method for these models that expands the range of the realization of a model's stochastic process just by a few basis points (and no more, I suppose that involves translating the barrier (as in CIR process) down from 0 somehow?) or are there separate, new models for pricing contracts where this is relevant? I've heard of ad-hoc approaches "gluing" log-normal-for-positive w/ normal-for-negative (but that's again arbitrarily negative) models and variations thereof, but that doesn't quite solve the problem.Sorry for the thread-drift, I just got intrigued
 
User avatar
Alan
Posts: 9783
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 27th, 2012, 9:55 pm

I don't know. Lately I have been fitting the CIR model and a variant to the US Tsy yield curve, but themodel's natural barrier at 0 works fine there.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 28th, 2012, 9:26 am

QuoteOriginally posted by: AlanI don't know. Lately I have been fitting the CIR model and a variant to the US Tsy yield curve, but themodel's natural barrier at 0 works fine there.Are you using bootstrapping/interpolation in combination with CIR? Single curve I suppose?
Last edited by Cuchulainn on February 27th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Alan
Posts: 9783
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

PDE/PIDE (FDM. FEM) methods thread

February 28th, 2012, 3:38 pm

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: AlanI don't know. Lately I have been fitting the CIR model and a variant to the US Tsy yield curve, but themodel's natural barrier at 0 works fine there.Are you using bootstrapping/interpolation in combination with CIR? Single curve I suppose?Yeah just the yields at a point in time. No interpolation: just the raw ask yields from princpal strips.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

PDE/PIDE (FDM. FEM) methods thread

March 16th, 2012, 8:42 am

I am setting up the 2-factor PDE suggested by Paul here. It is analogous to an Asian option in (S, I) and I want to test it with ADE as well. Some quirky differences with a Multi-asset pde are:1. No diffusion term in I.2. On I = 0 we have a 1st order hyperbolic PDE as boundary condition.Both problems are tractable. It's just a s/w issue to keep a uniform interface.
Last edited by Cuchulainn on March 15th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

PDE/PIDE (FDM. FEM) methods thread

March 16th, 2012, 8:44 am

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: PaulCuch, V(S,I,t) with(this is a different V from earlier!) With usual payoff for V(S,I,T). The volatility sigma is a function of S/I, I is an exponentially weighted moving average of past prices (although you don't need to know that for solving the PDE). The vol function is sigmoidal in shape, pick your favourite function!PI can define the PDE class for this problem (the C++ mechanics are very easy because of the new interface approach in qfcl TwPDE101.zip) and having done that we can run it directly in ADE and visualise in Excel.In order to set up the IBVP unambiguously, some explicit flags and assumption to help fill in the details:A1. sigmoid is 1/(1 + exp(-t)).A2. The quirky convection term in I to be augmented by an artificial viscosity term (Lax-Wendroff). I don't use upwinding in ADE but I could (==> makes ADE more complicated). Anyway, small issue.A3. The term S - I can be negative or positive.A4. V1 payoff max (K - S, 0).A5. The boundary conditions in S are the same as for the BS PDE.A6. We need > 1 BC in I. Any heuristics?A7. Lambda is positive.A8. Finally, I transform 1/4 plane problem to a [0,1]^2 and from there some idea of appropriate BC. BTW I used the payoff _as_ the BC for multi-asset PDE and give good results to date. Is this also a good heuristic in this case (as starters)?Of course, if other forum members wish to contribute, then even better
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On