# CorBM#

Functions

 `CorBrownian`(mu, E, sampleSize) Algorithm generates samples of increments from a correlated Brownian motion with a given mean and Variance-Covariance matrix (E).
CorBrownian(mu, E, sampleSize)[source]#

Algorithm generates samples of increments from a correlated Brownian motion with a given mean and Variance-Covariance matrix (E).

The algorithm uses the fact that if you have n independent brownian motions, the samples given by “mu+ C*Z” are distributed as N(mu,E), where mu is the vector of means and C is the square root of the Variance-Covariance matrix. For calculating the square root of the VarCovar matrix, the Cholesky decomposition is implemented.

Parameters:
• mu – Array with n elements containing the mean of each BM

• E

n x n numpy array with the Variance-Covariance matrix

sampleSize: integer representing the number of samples

Returns:

sampleSize x n numpy array containing sampled increments for the correlated Brownian motion

Note

The algorithm is not optimized for speed and no testing of inputs is implemented. If this would be usefull to you, let the authors know so that they can extend the code.

Example

```>>> import numpy as np
>>> mu = [1,2]
>>> VarCovar = np.matrix('1,0.8; 0.8,3')
>>> sampleSize = 5
>>> CorBrownian(mu,VarCovar, sampleSize)
[ 2.83211068  4.50021193]
[ 0.26392619  1.56450446]
[-0.25928109  0.97167124]
[ 1.52038489  1.76274556]]
```