Directory of Open Source for Quantitative Finance and Trading
Username: Password: Not registered?
 
Quick Search:    (AJAX based: No need to press button)

Main : Matlab : 



Sort by:  Title () Date () Rating () Popularity ()
Files currently sorted by: Date (New Files Listed First)


Category: Matlab View Full Details
Download Now!Tutorial on Principal Component analysis of Wiener process
Submitter: vanna Date: 2009/3/11
Description:
This file demonstrates principal component analysis (PCA) of a wiener process (Brownian motion).

Two methods are used to calculate principal components in this file:
Method 1 : Simulate Brownian motion and use eig function to calculate principal components of the matrix
Method 2 : Use analytical formula mentioned by Fredrik Akesson, John P. Lehoczky in paper Discrete eigenfunction expansion of the multidimensional brownian motion and the Ornstein-Uhlenbeck process

Following formula is used to get eigen values:


Following formula is used to get eigen vectors:


Following figure displays eigenvectors of the first 4 components:

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 654 times  654  File Size 0 bytes  Supported Platforms Octave Matlab  Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (6)

Category: Matlab View Full Details
Download Now!Demo on using Galerkin for solving ODE
Submitter: vanna Date: 2009/3/6
Description:
This script demonstrates how to solve following ODE by using Galerkin method:
-1 -x + sin(2*x) + 5*y[x] + y'[x]    with initial condition y[0]=1


Based on paper http://math.fullerton.edu/mathews/n2003/galerkin/GalerkinMod/Links/GalerkinMod_lnk_5.html
After running this script, the output values are coefficients of basis functions.

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 314 times  314  File Size 0 bytes  Supported Platforms   Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (8)

Category: Matlab View Full Details
Download Now!Demo Tutorial on Karhunen Loeve expansion of Wiener
Submitter: vanna Date: 2009/2/14
Description:
Karhunen Loeve expansion is a representation of a stochastic process as sum of an infinite series of terms which are product of random variables and orthogonal functions:




As we know, a Wiener process Xt is characterized by the following properties:
1.Expected value of Xt i.e., E[Xt]=0
2.Variance is t

Here we demonstrate how KL expansion can be used for generating Wiener process paths.

A rescaled Wiener process has the following representation:


In the attached matlab program we generate IID random variables and use this formula to generate Wiener process paths. Instead of using no. of expansion terms to infinity, we restrict it to value of nk.


After doing simulations, we verify that as the no. of expansion terms increase, the simulated process converges to mean 0 and variance t. Note that t should be between 0 and 1.


Section 4.4 in this paper has nice explanation on derivation of expansion formula : http://www.cims.nyu.edu/~eve2/chap4.pdf

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 675 times  675  File Size 0 bytes  Supported Platforms Octave Matlab  Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (8)

Category: Matlab View Full Details
Download Now!Demo/Tutorial on implied volatility vs Local volatility
Submitter: vanna Date: 2009/2/13
Description:
This code demonstrates the different type of local volatility surfaces that result by changing an input implied volatility surface.

eg., this is implied vol. surface:


This is resulting local vol. surface which is based on the above implied vol surface:


Note : Please also download LocalVolSurface to run this file

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 936 times  936  File Size 0 bytes  Supported Platforms Octave Matlab  Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (9)

Category: Matlab View Full Details
Download Now!Swaplet pricing in LMM using MC simulation
Submitter: vanna Date: 2009/1/6
Description:
This is a very simple demonstration of doing monte carlo simulation in libor market model. It shows how to reproduce results for swap price of a swap which starts at T=20 and ends at T=20.5, as mentioned in table2 of paper Linking Caplet and Swaption Volatilities in a BGM/J Framework: Approximate Solutions

NOTE : This code will only work for the last swap and not for the other swaps. For all other swaps the calculation is more involed and has not been implemented yet.


For example, following results are obtained by running this code and using parameter CurveType="G":
octave:41> testswap
T = 20
blackvar = 0.52046
drift = -0.26023
sigma = 0.72143
mcswaplet_price = 0.21504

Value mentioned in paper is .215

Following results are obtained using parameter CurveType="F:
octave:42> testswap
T = 20
blackvar = 0.52046
drift = -0.26023
sigma = 0.72143
mcswaplet_price = 0.24149

Value mentioned in paper is .242




Below is formula for LMM dynamics used for simulation:


Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 841 times  841  File Size 0 bytes  Supported Platforms Octave Matlab  Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (5)
« 1 2 3 4 5 6 (7) 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 »
Similar Links:

Subscribe to RSS or daily email updates of latest quantitative finance code listings
Email address :
Copyright © 2011 QuantCode Inc. All rights reserved.