# How to set correlated wiener processes when constructing stochastic model?

**URL:** <https://discourse.pymc.io/t/how-to-set-correlated-wiener-processes-when-constructing-stochastic-model/9536>\
**Category:** v3\
**Tags:** modeling\
**Created:** [May 31, 2022, 6:50am UTC](https://discourse.pymc.io/t/how-to-set-correlated-wiener-processes-when-constructing-stochastic-model/9536 "2022-05-31T06:50:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KTX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ktx/32/4667_2.png) [@KTX](https://discourse.pymc.io/u/KTX)\
**Post date:** [May 31, 2022, 6:50am UTC](https://discourse.pymc.io/t/how-to-set-correlated-wiener-processes-when-constructing-stochastic-model/9536/1 "2022-05-31T06:50:52Z")

</div>

I have stochastic price model with its volatility being stochastic too.  
dS and dV (where S is price of stock and V is volatility of stock) both has dW term which follows normal distribution.  
and the correlation between them is rho = dW\_S \* dW\_V

Then how can I construct this stochastic model?

---

<div class="post-metadata">

**Author:** ![jessegrabowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jessegrabowski/32/5010_2.png) [@jessegrabowski](https://discourse.pymc.io/u/jessegrabowski)\
**Post date:** [May 31, 2022, 9:47am UTC](https://discourse.pymc.io/t/how-to-set-correlated-wiener-processes-when-constructing-stochastic-model/9536/2 "2022-05-31T09:47:01Z")

</div>

Hi KTX,

A Wiener process is just a continuous time gaussian random walk, and PyMC has this distribution built in as `pm.GaussianRandomWalk`. It also comes in a [multivariate flavor](https://docs.pymc.io/en/v3/pymc-examples/examples/time_series/MvGaussianRandomWalk_demo.html). You will need to re-write your SDE in discrete time and solve it (or the other-way around I guess). That will give you a mean vector and covariance matrix that describes the price and volatility processes. You can plug these into the MvGaussianRandomWalk to actually implement the model.
