File:Local martingale.svg

From testwiki
Jump to navigation Jump to search
Original file (SVG file, nominally 1,440 × 960 pixels, file size: 211 KB)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

21 July 2024

image/svg+xml

File history

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

Date/TimeThumbnailDimensionsUserComment
current03:31, 22 July 2024Thumbnail for version as of 03:31, 22 July 20241,440 × 960 (211 KB)wikimediacommons>Cosmia NebulaUploaded while editing "Local martingale" on en.wikipedia.org

The following page uses this file: