Stochastic processes: the common language
An operational review of the vocabulary used throughout this module: a process as a family of random variables and as a random path, finite-dimensional laws and their consistency, filtrations as accumulated information, adapted processes and stopping times. A simple random walk provides a running example that returns as a Markov chain, a martingale and a limit producing Brownian motion.
After this lesson you can
- Model a time-dependent phenomenon as a stochastic process by choosing its time set and state space.
- Specify a process through its finite-dimensional distributions and check their consistency.
- Decide whether a decision rule defines a stopping time with respect to a given filtration.
- Simulate and analyze simple random-walk paths, including the distribution of their maximum and first-passage time.
- Use a counterexample to explain how two modifications of a process can have different paths.
Before you start
A film, not a photograph
A closing-price distribution tells us which values are plausible, but not whether the price arrived there through a sudden drop or a series of small fluctuations. When studying a queue, arrival and departure times matter; for API traffic, whether peaks cluster; for temperature, how long a deviation persists. Dependence across time matters as much as the distribution at each instant.
Start with a deliberately simple model: a particle adds or at each step. Compare its paths, a cross-section at one instant and the effect of biasing the coin. The whole cloud and a single line answer different questions.
The drift of a walk with upward-step probability is and its standard deviation is . For a fair coin they are and : doubling the horizon does not double the typical width. With , the center grows linearly while the width grows as the square root. A one-standard-deviation envelope neither contains every path nor sets a boundary they must obey.
Variables and paths: two views of the same object
Choosing and is part of the model. A queue observed after each arrival can use and ; an idealized temperature can use and . A time series is a sample on a grid: it does not determine what happened between observations. The particular observed path should also be distinguished from its law, which describes a set of possible paths.
In the walk, are independent, and . The simple random walk starts at and satisfies . The increments are independent, but the levels are not: for , and . A level contains the entire accumulated past.
The law needs dependence
Consistency is essential: if the law of says almost surely, its marginal for must be the separately stated law of . For real-valued states, the Kolmogorov extension theorem constructs, from a consistent family, a measure on the product space with its product sigma-algebra. The finite-dimensional cylinders determine the law there. This alone does not guarantee continuous paths: regularity requires additional assumptions and, generally, a suitable choice of version.
Marginals are not enough. Let be independent fair coins. The processes and have the same law at each instant, but is respectively and . Dependence changes the joint law even though each snapshot is identical.
A Gaussian process is one whose finite joint laws are Gaussian, including degenerate laws. It is specified by and : for each list, the mean is the vector of and the covariance is the matrix with entries . Not every function is a valid covariance: it must be symmetric and for every finite list and all coefficients. This positivity makes each Gaussian matrix valid; Gaussian marginalization provides consistency. The multivariate Gaussian and its marginalization justify this shortcut.
Available information and decisions without foresight
A trading decision at time cannot use the next day’s maximum. A filtration is an increasing family of sub-sigma-algebras of : if , . Each event in can be determined from information available up to . A sigma-algebra is not a list of known values: it also includes every event that can be formed from them.
The process is adapted to if is -measurable for each . Its natural filtration is , the smallest containing observations of the process itself up to that time. A filtration may contain additional information, including future information; adaptation is checked with respect to the chosen filtration. The generated sigma-algebra formalizes exactly what can be determined.
If is adapted in discrete time, is a stopping time for measurable , because . The first time two consecutive positive increments are observed is also a stopping time: it only requires inspecting the past. By contrast, the time of the last maximum over a fixed horizon generally is not. Two paths can agree up to and then make the maximum observed at either the last maximum or not.
This indistinguishable-histories test is operational: if two histories with the same prefix require different answers about whether stopping has occurred, the event does not belong to the information in that prefix. A finite simulation must specify the horizon and the convention for non-arrival. In continuous time, measurability of first hitting times requires additional assumptions about the paths and filtration; the finite-union proof no longer applies directly.
The law of the walk, maximum and first passage
If counts upward steps, and . Therefore, for with the same parity as and ,
Outside those values the probability is zero. Summing the means and variances of independent increments gives the scales in the first figure. The formula also shows that the distribution is not continuous, although a normal approximation can be useful over long horizons.
For , write and , with integer . The reflection principle gives
To see this, separate paths that reach and end at from those ending at . For the latter, reflect the increments after the first hit of . The endpoint becomes ; the transformation is a probability-preserving bijection because the coin is fair. The sum over reflected endpoints is . The identity applies to a finite horizon and does not claim that the maximum has exactly the same law as .
Also, for , , with value zero when parity or reachability rules it out. This first-passage identity gives the point mass; summing up to must agree with the preceding maximum probability. When a path has not arrived by the horizon, its time is censored: this is not an observation that it will never arrive.
The formula follows by counting paths. For a first hit at step , the penultimate value is and the last increment is positive. Among prefixes of steps ending at , remove those that have already reached . Reflecting each prefix after its first hit puts the latter in bijection with those ending at . The desired count is therefore
A binomial coefficient outside its range is zero. Each complete sequence has probability , and the expression on the right gives the stated formula. Equality depends on both directions having the same probability; with drift, reflection does not preserve each path’s weight.
Lab: simulate without confusing censoring with non-arrival
We build fair walks in batches to limit browser memory. Each row contains the increments of one path, and column zero of the cumulative sum corresponds to the initial time. The exact probability is calculated by summing the binomial law and applying reflection, without using the simulation to define the reference. We print the approximate Monte Carlo error : this is not a deterministic guarantee.
import numpy as np
from math import comb, sqrt
N, n, a, lote = 100_000, 100, 5, 5_000
rng = np.random.default_rng(2601)
hist_primero = np.zeros(n + 1, dtype=np.int64)
suma_cuadrados = np.zeros(3, dtype=np.float64)
cortes = np.array([25, 50, 100])
for inicio in range(0, N, lote):
tam = min(lote, N - inicio)
inc = 2 * rng.integers(0, 2, size=(tam, n), dtype=np.int8) - 1
caminos = np.cumsum(inc, axis=1, dtype=np.int16)
maximos = np.maximum.accumulate(caminos, axis=1)
acceso = maximos >= a
llega = acceso.any(axis=1)
tiempos = acceso.argmax(axis=1)[llega] + 1
hist_primero += np.bincount(tiempos, minlength=n + 1)
suma_cuadrados += (caminos[:, cortes - 1].astype(float) ** 2).sum(axis=0)
def cola(k):
return sum(comb(n, j) for j in range(n + 1) if 2*j - n >= k) / 2**n
empirica = hist_primero.sum() / N
exacta = cola(a) + cola(a + 1)
print('probabilidad empírica:', round(empirica, 5))
print('probabilidad exacta:', round(exacta, 5))
print('error estándar estimado:', round(sqrt(empirica*(1-empirica)/N), 5))
print('sin acceso hasta el horizonte:', N - hist_primero.sum())
print('RMS / raíz del tiempo:', np.round(np.sqrt(suma_cuadrados / N) / np.sqrt(cortes), 4))
print('primeros accesos en pasos 5, 7, 9:', hist_primero[[5, 7, 9]])The RMS is in the fair model. The simulation estimates this moment at three time points; the ratio should approach one, subject to fluctuations. Using argmax is correct only after filtering by any: a row of false values would produce a misleading zero index. Notice that >= a is equivalent here to reaching because jumps have size one; this would not hold for arbitrary increments.
Now check the first-passage distribution against its formula, in addition to the total. The same generator is not reset between batches; the specific results form a reproducible realization, not universal constants.
def masa_primer_paso(k, nivel):
if k < nivel or (k + nivel) % 2:
return 0.0
return nivel / k * comb(k, (k + nivel)//2) / 2**k
print('masas exactas en pasos 5, 7, 9:',
[round(masa_primer_paso(k, a), 6) for k in (5, 7, 9)])
print('suma de masas hasta n:', round(sum(masa_primer_paso(k, a) for k in range(1, n+1)), 6))
print('reflexión:', round(exacta, 6))
teorica = np.array([0.0] + [masa_primer_paso(k, a) for k in range(1, n+1)])
empirica_pasos = hist_primero / N
print('máxima diferencia absoluta entre masas:', round(np.max(np.abs(empirica_pasos - teorica)), 6))
print('pasos 5 a 15: empírica, exacta')
for k in range(5, 16, 2):
print(k, round(empirica_pasos[k], 6), round(teorica[k], 6))
print('P(S_10 = 0):', comb(10, 5) / 2**10)Equality at each time does not imply equality of paths
Two processes on the same space are modifications if, for each fixed , . They are indistinguishable if , provided that event is defined in the sigma-algebra under consideration. The second statement implies the first. On a countable time set the converse also holds, because a countable union of null events is null. Over a continuum we cannot simply take that union.
Let be uniform on , and . For each fixed , , so they are modifications. However, for each realization there is a time where : no path of agrees with that of for all . The figure represents an isolated point, not a positive interval or permanent jump.
Regularity can remove this ambiguity. If two modifications have almost surely continuous paths on , they agree simultaneously at every rational time with probability one because the rationals are countable; by continuity they agree at all real times. They are therefore indistinguishable. The distinction matters when discussing maxima, crossings or continuity, which are properties of an entire path rather than a single marginal.
Exercises
More than one answer may be correct.
Step 1 of 3. What event says that the minimum does not exceed n?
More than one answer may be correct.
primer_acceso(caminos, estados). caminos is a two-dimensional numeric array with at least one column: each row is a path and each column a time starting at zero. Return two arrays: indices of the first hit and the corresponding values. If there is no hit, return index -1 and value NaN. estados is a collection of numbers.import numpy as np
def primer_acceso(caminos, estados):
passRoad map
The walk will reappear as a Markov chain, because the present determines the distribution of the next step, and as a martingale when the coin is fair. Counting processes describe arrivals; time series allow us to study dependence and prediction; Brownian motion and Itô calculus deal with continuous paths. The joint law and available information matter in all of them. Conditional expectation, its tower property, and Gaussian conditioning will be tools for turning information into predictions.
A process is a family of variables on a common probability space and, at the same time, a random path. Joint laws describe dependence; a filtration records what is known and a stopping time respects that information. In continuous time, almost-sure equality at each instant does not suffice to identify entire paths.