File:Local martingale.svg

Summary

Description
English: Illustration for local martingale.

Up Panel: Multiple simulated paths of the process which is stopped upon hitting . This shows gambler's ruin behavior, and is not a martingale. Down Panel: Paths of with an additional stopping criterion: the process is also stopped when it reaches a magnitude of . This no longer suffers from gambler's ruin behavior, and is a martingale.

Matplotlib code

import numpy as np
import matplotlib.pyplot as plt

dw = 0.05
dt = dw**2
num_samples = 5

def generate_Xt(k=None):
    W = np.array([])
    while True:
        B = np.array([np.random.default_rng().choice([-1, 1]) for _ in range(1000)])
        W = np.append(W, np.cumsum(B) * dw)
        t = np.arange(len(W)) * dt

        if k is not None:
            hitting_index = np.argmax((W >= k)

Date
Source Own work
Author Cosmia Nebula

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.
Category:CC-BY-SA-4.0#Local%20martingale.svgCategory:Self-published work
Category:Random walks Category:Created with Matplotlib
Category:CC-BY-SA-4.0 Category:Created with Matplotlib Category:Random walks Category:Self-published work