 OrnsteinUhlenbeckProcess - Maple Help

Home : Support : Online Help : Mathematics : Finance : Stochastic Processes : OrnsteinUhlenbeckProcess

Finance

 OrnsteinUhlenbeckProcess
 create new Ornstein-Uhlenbeck process Calling Sequence OrnsteinUhlenbeckProcess(${x}_{0}$, mu, theta, sigma, opts) Parameters

 ${x}_{0}$ - algebraic expression; initial value mu - algebraic expression; long-running mean theta - algebraic expression; the speed of mean reversion sigma - algebraic expression; the volatility parameter opts - (optional) equation(s) of the form option = value where option is scheme; specify options for the OrnsteinUhlenbeckProcess command Options

 • scheme = unbiased or Euler -- This option specifies which discretization scheme should be used for simulating this process. Description

 • The OrnsteinUhlenbeckProcess command creates an Ornstein-Uhlenbeck process. This is a stochastic process $X\left(t\right)$ governed by the stochastic differential equation (SDE)

$\mathrm{dX}\left(t\right)=\mathrm{\theta }\left(\mathrm{\mu }-X\left(t\right)\right)\mathrm{dt}+\mathrm{\sigma }\mathrm{dW}\left(t\right)$

where theta, sigma, and mu are real constants.

 • The parameter ${x}_{0}$ defines the initial value of the underlying stochastic process.
 • The parameter theta is the speed of mean-reversion. The parameter mu is the long-running mean. The parameter sigma is the volatility. In general, theta, mu, and sigma can be any algebraic expressions. However, if the process is to be simulated, these parameters must be assigned numeric values.
 • The scheme option specifies the discretization scheme used for simulation of this process. By default the standard Euler scheme is used. When scheme is set to unbiased the transition density will be used to simulate a value $X\left(t+\mathrm{dt}\right)$ given $X\left(t\right)$. Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $r≔\mathrm{OrnsteinUhlenbeckProcess}\left(\mathrm{r0},\mathrm{\mu },\mathrm{\theta },\mathrm{\sigma }\right)$
 ${r}{≔}{\mathrm{_X0}}$ (1)
 > $\mathrm{Drift}\left(r\left(t\right)\right)$
 ${\mathrm{\theta }}{}\left({\mathrm{\mu }}{-}{\mathrm{_X0}}{}\left({t}\right)\right)$ (2)
 > $\mathrm{Diffusion}\left(r\left(t\right)\right)$
 ${\mathrm{\sigma }}$ (3)
 > $\mathrm{r0}≔0.5$
 ${\mathrm{r0}}{≔}{0.5}$ (4)
 > $\mathrm{\theta }≔1.0$
 ${\mathrm{\theta }}{≔}{1.0}$ (5)
 > $\mathrm{\mu }≔0.25$
 ${\mathrm{\mu }}{≔}{0.25}$ (6)
 > $\mathrm{\sigma }≔0.3$
 ${\mathrm{\sigma }}{≔}{0.3}$ (7)
 > $\mathrm{PathPlot}\left(r\left(t\right),t=0..3,\mathrm{timesteps}=100,\mathrm{replications}=10,\mathrm{thickness}=3,\mathrm{color}=\mathrm{red}..\mathrm{blue},\mathrm{axes}=\mathrm{BOXED}\right)$ Here is an example using the transition density.

 > $\mathrm{\mu }≔0.02$
 ${\mathrm{\mu }}{≔}{0.02}$ (8)
 > $\mathrm{\theta }≔1.0$
 ${\mathrm{\theta }}{≔}{1.0}$ (9)
 > $\mathrm{\sigma }≔0.001$
 ${\mathrm{\sigma }}{≔}{0.001}$ (10)
 > $\mathrm{r0}≔0.05$
 ${\mathrm{r0}}{≔}{0.05}$ (11)
 > $r≔\mathrm{OrnsteinUhlenbeckProcess}\left(\mathrm{r0},\mathrm{\mu },\mathrm{\theta },\mathrm{\sigma }\right)$
 ${r}{≔}{\mathrm{_X1}}$ (12)
 > $q≔\mathrm{OrnsteinUhlenbeckProcess}\left(\mathrm{r0},\mathrm{\mu },\mathrm{\theta },\mathrm{\sigma },\mathrm{scheme}=\mathrm{unbiased}\right)$
 ${q}{≔}{\mathrm{_X2}}$ (13)
 > $p≔\mathrm{dsolve}\left(\left\{\mathrm{diff}\left(x\left(t\right),t\right)=\mathrm{\theta }\left(\mathrm{\mu }-x\left(t\right)\right),x\left(0\right)=\mathrm{r0}\right\}\right)$
 ${p}{≔}{x}{}\left({t}\right){=}\frac{{1}}{{50}}{+}\frac{{3}{}{{ⅇ}}^{{-}{t}}}{{100}}$ (14)
 > $\mathrm{P1}≔\mathrm{PathPlot}\left(r\left(t\right),t=0..5,\mathrm{timesteps}=5,\mathrm{replications}=1,\mathrm{color}=\mathrm{red}\right):$
 > $\mathrm{P2}≔\mathrm{PathPlot}\left(q\left(t\right),t=0..5,\mathrm{timesteps}=5,\mathrm{replications}=1,\mathrm{color}=\mathrm{blue}\right):$
 > $\mathrm{P3}≔\mathrm{plot}\left(\mathrm{rhs}\left(p\right),t=0..5,\mathrm{color}=\mathrm{green}\right):$
 > $\mathrm{plots}\left[\mathrm{display}\right]\left(\mathrm{P1},\mathrm{P2},\mathrm{P3},\mathrm{thickness}=3,\mathrm{axes}=\mathrm{BOXED}\right)$ Here is a realization of the Ornstein-Uhlenbeck process as a subordinated Wiener process.

 > $\mathrm{\mu }≔0.02$
 ${\mathrm{\mu }}{≔}{0.02}$ (15)
 > $\mathrm{\theta }≔1.0$
 ${\mathrm{\theta }}{≔}{1.0}$ (16)
 > $\mathrm{\sigma }≔0.01$
 ${\mathrm{\sigma }}{≔}{0.01}$ (17)
 > $\mathrm{r0}≔0.05$
 ${\mathrm{r0}}{≔}{0.05}$ (18)
 > $r≔\mathrm{OrnsteinUhlenbeckProcess}\left(\mathrm{r0},\mathrm{\mu },\mathrm{\theta },\mathrm{\sigma }\right)$
 ${r}{≔}{\mathrm{_X3}}$ (19)
 > $\mathrm{\tau }≔\frac{\mathrm{exp}\left(2\mathrm{\theta }t\right)-1}{2\mathrm{\theta }}$
 ${\mathrm{\tau }}{≔}{0.5000000000}{}{{ⅇ}}^{{2.0}{}{t}}{-}{0.5000000000}$ (20)
 > $W≔\mathrm{WienerProcess}\left(\mathrm{\tau }\right)$
 ${W}{≔}{\mathrm{_W}}$ (21)
 > $q≔t↦\mathrm{r0}\cdot \mathrm{exp}\left(-\mathrm{\theta }\cdot t\right)+\mathrm{\mu }\cdot \left(1-\mathrm{exp}\left(-\mathrm{\theta }\cdot t\right)\right)+\mathrm{\sigma }\cdot \mathrm{exp}\left(-\mathrm{\theta }\cdot t\right)\cdot W\left(t\right)$
 ${q}{≔}{t}{↦}{\mathrm{r0}}{\cdot }{{ⅇ}}^{{-}{\mathrm{\theta }}{\cdot }{t}}{+}{\mathrm{\mu }}{\cdot }\left({1}{-}{{ⅇ}}^{{-}{\mathrm{\theta }}{\cdot }{t}}\right){+}{\mathrm{\sigma }}{\cdot }{{ⅇ}}^{{-}{\mathrm{\theta }}{\cdot }{t}}{\cdot }{W}{}\left({t}\right)$ (22)
 > $R≔\mathrm{PathPlot}\left(r\left(t\right),t=0..3,\mathrm{timesteps}=100,\mathrm{replications}=3,\mathrm{thickness}=3,\mathrm{color}=\mathrm{red}\right):$
 > $Q≔\mathrm{PathPlot}\left(q\left(t\right),t=0..3,\mathrm{timesteps}=100,\mathrm{replications}=3,\mathrm{thickness}=3,\mathrm{color}=\mathrm{blue}\right):$
 > $\mathrm{plots}\left[\mathrm{display}\right]\left(R,Q\right)$ > $\mathrm{ExpectedValue}\left(\mathrm{Int}\left(r\left(u\right),u=0..1\right),\mathrm{replications}={10}^{4},\mathrm{timesteps}=100\right)$
 $\left[{\mathrm{value}}{=}{0.03902469384}{,}{\mathrm{standarderror}}{=}{0.00004066146237}\right]$ (23)
 > $\mathrm{ExpectedValue}\left(\mathrm{Int}\left(q\left(u\right),u=0..1\right),\mathrm{replications}={10}^{4},\mathrm{timesteps}=100\right)$
 $\left[{\mathrm{value}}{=}{0.03898350713}{,}{\mathrm{standarderror}}{=}{0.0001753525705}\right]$ (24) References

 Brigo, D., Mercurio, F., Interest Rate Models: Theory and Practice. New York: Springer-Verlag, 2001.
 Glasserman, P., Monte Carlo Methods in Financial Engineering. New York: Springer-Verlag, 2004.
 Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003.
 Vasicek, O.A., An Equilibrium Characterization of the Term Structure, Journal of Financial Economics, 5 (1977), pp 177-188. Compatibility

 • The Finance[OrnsteinUhlenbeckProcess] command was introduced in Maple 15.