Variance in Ornstein Uhlenbeck process

4 次查看(过去 30 天)
I don't know if anyone here will be able to help me, but I'm trying to simulate an Ornstein Uhlenbeck process using the code found here: http://planetmath.org/OrnsteinUhlenbeckProcess.html
X_free = cumsum(sqrt(2*D*dt)*randn(size(t)));
X_filt = filter([0 g*dt], [1 -1+g*dt] , X_free);
X_OU = X_free-X_filt;
Here, D is the diffusion constant and g is the rate of mean reversion. I know that the variance in the process should be:
(2*D / (2*g)) * (1 - exp(-2*g*t)
(See, for example http://planetmath.org/OrnsteinUhlenbeckProcess.html) But this seems to not work; for example, when D=.1, g=.01, and t = 1:10000, the variance in the process is roughly ~7.5 (on average), when the equation says that it should be 10. Anyone have any idea why I'm getting a different variance than expected?
Thanks!

回答(1 个)

Ben Petschel
Ben Petschel 2012-9-29
That's an interesting method, though it's not obvious to me how it works and I couldn't see any reference to it in the planet math article. I would first check that X_OU returns exactly the same value when calculated by a simple FOR loop using the same randn values.
Failing that, I would check that dt is small enough for accurate results, and that you are calculating the variance of the values X_OU(end) returned from multiple runs (not the variance of X_OU).

类别

Help CenterFile Exchange 中查找有关 Financial Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by