Giter Club home page Giter Club logo

correlated_brownian_motion_matlab's Introduction

๐Ÿ“š Sampled increments from two or more correlated Brownian motions (BM)๐Ÿ“š


Popular algorithm for generating a matrix of increments from a multidimensional Brownian motion (BM) with a given vector of means and a Variance-Covariance matrix.

Problem

Offten when using multifactor models, the model requires correlated sources of noise. A popular choice is to use a multidimensional Brownian motion.

Solution

The proposed algorithm uses two propoerties of BM:

  • Increments of a BM are normaly distributed.
  • assuming n independent BM's whose increments are generated from a standard normal distribution (denoted N(0,1)), a derived proces Y = ฮผ + L*z has its increments distributed as N(ฮผ, E) where ฮผ is the vector of means and L is the square root of the Variance-Covariance matrix (denoted E in the code).

Inputs

  • Vecor of means for each BM mu.
  • Variance-Covariance matrix whose diagonal elements describe the volatility of each BM and the off-diagonal elements describe the covariance E.
  • Number of samples needed sampleSize.

Output

  • Matrix of samples where each column represents a BM and each row a new increment

Getting started

The user is interested in generating samples from 2 Brownian motions with a correlation of 0.8. Additionaly, the first BM has a mean of 1 and a variance of 1.5. The second BM has a mean of 0 and a variance of 2. The user is interested in 480 samples.

mu = [1; 0];
E = [1.5, 0.8; 0.8, 2];
sampleSize = 480;
CorBrownian(mu, E, sampleSize)

correlated_brownian_motion_matlab's People

Contributors

gregorfabjan avatar open-source-modelling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gregorfabjan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.