# Getting the next price of a GBM with reversion

Here is the "twin" question of Getting the next price of a GBM (Geometric Brownian Motion) but for GBM with reversion

As in that case, I'd like to write a formula for the next price, as function of:

-PreviousPrice
-DayElapsed    (this can be any fraction, however small, of a day)
-Drift         (daily drift = annual drift% / 100 / 250)
-ReversionSpeed
-Volatility   (daily volatility = annual volatility% / 100 / sqrt(250))
-N01  (standard normal realization)


I got from a site this stuff (which seems a bit too involved for my taste):

 expTerm1 = Exp(ReversionSpeed * DayElapsed)
Term1   = Log(PreviousPrice) * expTerm1

OneMinusexpTerm1   = (1 + expTerm1)
Term2 = (Log(InitialPrice) - Drift  / ReversionSpeed ) * OneMinusexpTerm1

OneMinus_expTerm_2   = 1 - (expTerm1 * expTerm1)
Term3   = (Volatility * Volatility ) * OneMinus_expTerm_2 / (4 * ReversionSpeed )
Term4   = Volatility * N01  * Sqrt(OneMinus_expTerm_2 / (2 * ReversionSpeed))

NextPrice = Math.Exp(Term1 + Term2 + Term3 + Term4)


Could you kindly a better expression (or appropriate corrections to the above) **using my notation and parameters above (assumed <> 0) ** (and/or any useful integration, of course) ?

(The source for my "attempt" above is: http://marcoagd.usuarios.rdc.puc-rio.br/sim_stoc_proc.html#mc-mrd but I am not sure if I got this right.)

P.S. I just want to get 1 preliminary implementation, using all the above parameters (those are constants specified by the user)(volatility, drift, reversion speed, reversion price or "mean"). One of your own choice would do. I am NOT after modeling any instrument in particular, at this time. Will see later the conceptual variations. It's just for testing my software interface. (Later will focus on other concepts). Thank you

-

The formula is given in your link. For the real world probability without jump:

$$x_t = x_{t-1} e^{-\eta \Delta t} + \hat{x}(1-e^{-\eta \Delta t}) +\sigma \sqrt{\frac{1-e^{- 2 \eta \Delta t}}{2 \eta}} N(0,1)$$

where:

$x_t$: price

$x_{t-1}$: PreviousPrice

$\hat{x}$: long term mean (a parameter)

$\Delta t$: Time step (one fraction)

$\eta$: ReversionSpeed

$\sigma$: Volatility (daily volatility = annual volatility% / 100 / 250)

$N(0,1)$: Standard normal realisation

Here is an R implementation:

set.seed(1) # Initialize the random number generation

ReversionSpeed=0.1 #parameter
Timestep=1
Volatility =0.1
T = 50 # number of timesteps
x=0.5 #initial price
EquilibriumPrice=0.4 #equilibrium price

for (i in 1:T){
PreviousPrice = x[i-1]
N01 = rnorm(1,0,1)
NextPrice = exp(log(PreviousPrice) * exp(-ReversionSpeed * Timestep) + log(EquilibriumPrice) * (1 - exp(-ReversionSpeed * Timestep))  + Volatility * N01  * sqrt((1 - (exp(-2*ReversionSpeed * Timestep))) / (2 * ReversionSpeed)))
x=rbind(x,NextPrice)
}

plot(x)


Using these notation you should be able to deduce the risk neutral simulation.

As you can see it, I have given the parameters some values. In practice you should find the parameters that correspond to your asset. This is not easy. This process is Called Calibration. You can look at the most common methods: Maximum likelihood estimation. This is an optimisation technique: given the recursive equation (the equation above) you find the theoretical distribution in function of the parameters, you then try to find the sets of parameters which is the most likely to give prices previously observed.

If you want my opinion on models in general: It really depends on your data as models have evolved to fit specific datasets. But You need to choose the model first, not fitting a model to your dataset. (this imply you have to learn about models).

Models with jumps are used to take into account the fact that price distribution are heavy tailled. It is easy to consider them better than a model without jumps on the paper, but they are way more difficult to use in practice (specifficaly the calibration part, this imply you should learn about Calibration).

If you reaaly want to use these complex tools without learning about models and ways to use them in practice (I do not recommend that) you should look at libraries for common languages as you won't be able to implement the models and methods easily. I suggest you to use R and its packages.

-
There are 3 other formulas, for the riskneutral case and real/riskneutral with jumps. –  emcor Jul 10 at 8:33
There is an exact formula for all of them with very similar notations. –  lmorin Jul 10 at 9:57
Did you ask OP whether he wants the riskneutral or real case, and with jumps or without? Your formula is not the general case. –  emcor Jul 10 at 10:15
I'd like to implement the most suitable expression to create a simulation of real world financial instruments with some mean reversion. If there are 2 versions, with and without jumps, they are of course both welcome. Without jumps would be fine, anyway. Ideally, I would like it to be expressed using the notation I indicated above (say suitable for immediate implementation), so that I can immediately try it. Also, about the "long term mean", may I just assume to be the first price provided to the simulation (say the "initial" price)? –  Pam Jul 10 at 23:59
There is no such thing like "the most suitable expression [] for real world instruments". Models are created/studied by thousands of people since half a century for a very various range of financial assets. If you want to use these models you should: 1) learn about models and wich one is more suited to your data 2) learn how to implement models (yes this is a very trivial exercise ... this is probably why your question is downvoted). 3) Learn how to choose parameters for a model. This process is called calibration. (this is not so easy. questions welcome). –  lmorin Jul 12 at 17:24

1) The reversion speed $\eta$ is just a scaling factor >0 to control the sensitivity to mean deviations, it has no unit as such.

2) There are various simulation formulas in your reference link. Can you please specify which of these you want to simulate?

-
1) Thank you: so it's just a coefficient. 2) Yes, actually I would prefer the one which would make more sense for a realistic simulation (say the least "objectionable"). For that, I would gratefully take your suggestions. –  Pam Jul 4 at 5:45
And, of course, it does NOT have to be from that site. I just mentioned it as source of my code, which is possibly incorrect. I would like to implement just the most acceptable way to get the next price given the input quantities. –  Pam Jul 4 at 6:47
>There are various simulation formulas in your reference link. Can you please specify which of these you want to simulate? Just one of your own choice. –  Pam Jul 13 at 11:53
Just any one of your own choice using all the parameters I have indicated. –  Pam Jul 13 at 20:04