File:Ornstein-Uhlenbeck-traces-a-mu.svg

Original file(SVG file, nominally 520 × 340 pixels, file size: 176 KB)

Summary

Description
English: Four sampled traces of an Ornstein-Uhlenbeck process with θ=1 and σ= with different start values a and long-term mean values µ. Expectation values of each trace E(X) are shown in gray.
Date
Source Own work
Author Geek3
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with Matplotlib.
Source code
InfoField

Matplotlib source code

The plot was generated with Matplotlib
#! /usr/bin/env python3
# -*- coding:utf8 -*-

import matplotlib.pyplot as plt
import numpy as np
from math import *

plt.rcParams['font.sans-serif'] = 'DejaVu Sans'
np.random.seed(5)

amu_list = [(10, 0), (0, 0), (-10, 0), (0, -10)]
sigmaX = 1. # standard deviation of X
tau = 1. # relaxation time scale
theta = 1. / tau # mean reversion rate
D = sigmaX**2 * theta # diffusion constant
sigma = sqrt(2 * D) # diffusion
t = np.linspace(0, 12, 2001)
dt = t[1:] - t[:-1]

fig = plt.figure(figsize=(520 / 90.0, 340 / 90.0), dpi=72)

for a, mu in amu_list:
    randnorm = np.random.normal(0, 1, len(t))
    X = np.empty_like(t)
    X[0] = a

    for i in range(1, len(t)):
        X[i] = X[i-1] + (mu - X[i-1]) * dt[i-1] * theta + sigma * sqrt(dt[i-1]) * randnorm[i]
    X_expect = mu + (a - mu) * np.exp(-t * theta)
    
    plt.plot(t, X, lw=1, label=rf'a ={a:3.0f}  $\mu$ ={mu:3.0f}'.replace(' ', '  ').replace('-', u'\u2212'))
    plt.plot(t, X_expect, lw=2.5, color='#cccccc', zorder=-1,
        label={False:None, True:'E(X)'}[mu==-10])

plt.grid(True)
plt.xlim(t[0], t[-1])
plt.ylim(-13, 13)
plt.xlabel(r't / $\theta^{-1}$')
plt.ylabel(r'X / $\sigma_X$')
plt.legend(loc='upper right', framealpha=1)
plt.tight_layout()
plt.savefig('Ornstein-Uhlenbeck-traces-a-mu.svg')

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

4 sampled traces of an Ornstein-Uhlenbeck process

Items portrayed in this file

depicts

26 November 2022

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current15:01, 26 November 2022Thumbnail for version as of 15:01, 26 November 2022520 × 340 (176 KB)Geek3Uploaded own work with UploadWizard
The following pages on the English Wikipedia use this file (pages on other projects are not listed):

Global file usage

The following other wikis use this file:

Metadata