TL;DR
A random variable is one uncertain number. A stochastic process is a whole family of them, one for each moment in time, so it describes a quantity that is uncertain and changes as time passes. The value at time is random, and the values at different times are related to one another. Asking how the process behaves over time is the same as asking how that family of random variables behaves together.
Where you'll see it: in stock prices, the noise on a sensor reading over a day, the number of customers in a queue, and the random walk a diffusion model uses to add noise to an image.
Intuition
One random variable per moment
Think about the temperature outside your window. Right now it is some number, but you do not know it in advance, and you do not know it an hour from now either. Each future moment has its own uncertain temperature. Put those uncertain values on a timeline and you have a stochastic process. The timeline is the index set, and each point on it holds a random variable.
A single random variable is a snapshot. A stochastic process is the movie. You can ask about one frame (what is the distribution of the value at 3 pm?), or about the whole film (how does the path wander, does it drift upward, does it return to where it started?). Both questions matter, and the second one needs the first one to be answered for every pair, triple and longer set of times.
Why does this idea exist? Many quantities depend on time and on chance at once. A bank account, a bacterium population, a particle in a fluid and a server's load all change step by step while outside influences keep arriving at random. A single random variable cannot describe how the value at one time depends on the value at an earlier time. A stochastic process can, and that dependence is where most of the interesting behaviour lives.
Two sample paths
Here are two things that could happen to a quantity that starts at 0 and takes a random step at each tick of the clock. Each line is one realisation, a single outcome of the whole process. The dashed curves show the typical spread at each time, which grows like .
- +√t
- −√t
- path A
- path B
Each path is a plain sequence of numbers, but before the coin flips happen, every path at time is possible. The process is the rule that generates all of them, together with the probabilities of each.
What counts as a process
A process has an index set (the times), a state space (the values it can take), and a probability rule that says how likely each combination of values is. Each of these choices gives a different kind of process:
- Discrete or continuous time. is for a daily price or a turn in a game, and for a particle that moves at every instant.
- Discrete or continuous state. The state space can be a finite set of labels, the integers, or the real line.
The random walk above has discrete time and integer state. Brownian motion, which we will meet in its own lesson, has continuous time and real-valued state.
The math
Definition
A stochastic process is a collection of random variables, all defined on the same probability space. For each in the index set , is a random variable taking values in the state space . For each outcome of the underlying experiment, the function is a sample path or realisation.
Here is one complete outcome of the random experiment, the thing that determines everything at once. Fixing gives one path. Fixing gives one random variable. The probability space is the same for all of them, which is why their values can be compared and combined.
Finite-dimensional distributions
We cannot write down a probability for every possible path directly, because there are too many. Instead we describe the process through its finite-dimensional distributions: for every choice of times , the joint distribution of . These distributions must be consistent. Looking at a subset of the times and then ignoring the rest must give the same answer as looking at the smaller set directly. The Kolmogorov extension theorem says that any consistent family of these distributions comes from some process, whose law is determined by that family, so specifying the finite-dimensional distributions is a complete description.
For a simple case, take two times . The joint distribution of contains everything you need about how the process moves between them. Marginalising over gives the distribution of alone, which is why the single-time distributions are the first thing to pin down.
Mean and covariance functions
Two functions summarise most of what we need to know about a process:
The mean function says where the process is centred at each time. The covariance function says how strongly the values at two times move together. Its diagonal, , gives the spread at each time. Expected value and variance and covariance are the tools that define these two functions.
Stationarity
A process is strictly stationary if shifting every time by the same amount does not change the joint distribution: for any , has the same distribution as . The process looks statistically the same at every moment.
A weaker and more often used notion is weak (second-order) stationarity: the mean is constant, , and the covariance depends only on the gap between times, . Strict stationarity implies weak stationarity when the variances are finite, but not the other way around.
Stationarity is a strong assumption. The random walk is not stationary, as the next section shows. Many models are built to be stationary because that makes estimation possible from a single long record.
Worked example of the random walk
Let and , where each is independent and equals or with probability each. This is the random walk from the figure. Each step has mean 0 and variance 1, so:
The last identity holds because the steps after time are independent of everything before. The variance grows with , so the process is not stationary: it spreads out as time passes. Its mean is constant, but its variance is not, so it fails weak stationarity.
Worked examples
Take the random walk from the previous section, where each step is with probability .
- After 3 steps there are equally likely sign patterns.
- requires two steps of and one step of . There are patterns that do this, for example , and .
- So .
- Check the mean: the possible values are with probabilities . The mean is , as the formula says.
- Check the variance: , which equals .
Interpretation: the distribution of spreads out as grows, but its mean stays at zero.
A temperature sensor has a small random error each day. Model its drift as , where and each is an independent Gaussian with mean 0 and variance (so standard deviation degrees). This is a random walk with Gaussian steps.
- The variance after days is . After 25 days it is , so the standard deviation is 1 degree.
- Because a sum of independent Gaussians is Gaussian, .
- The probability that the drift has grown beyond 2 degrees in either direction is , where is the standard Gaussian cumulative distribution function.
- , so the probability is .
Interpretation: a sensor with this small daily error has about a 4.6% chance of being more than 2 degrees off after 25 days, and that risk keeps growing with time. This is why drift has to be corrected by recalibration rather than trusted over long periods.
Use the same walk , with and .
- Take and . Then .
- The variances are and .
- The correlation is .
Interpretation: the walk at time 3 says a fair amount about the walk at time 7, because the later value is built on the earlier one. Correlation shrinks as the gap between times grows, which is the signature of a process with memory.
Tradeoffs and failure modes
A stochastic process is the right model when the value at one time depends on the past in a way you can describe, and when you care about the whole path rather than one number. It is the wrong model when you have only a few observations and no story about how the observations are generated.
| Situation | Problem | Better choice |
|---|---|---|
| You have one long record and assume stationarity | The data may drift, so estimates describe an average that no longer applies | Test for stationarity, or model the trend and fit the residuals |
| You care only about the value at one fixed time | A full process model adds assumptions you do not need | A single random variable and its distribution |
| Values depend on only the latest state | A full history model is overkill | A [[markov-chain |
| Shocks come in bursts or change size over time | A constant-variance model misses the bursts | A volatility model such as GARCH |
| Very rare extreme events matter | Gaussian steps underestimate tails | Heavy-tailed step distributions |
Some practical warnings:
- One realisation is not a distribution. Estimating the distribution of a process from one path requires assumptions such as stationarity and ergodicity, which says time averages match ensemble averages. Without them, one record tells you little about the rest of the family.
- Non-stationarity hides in plain sight. A random walk looks like noise around zero for a while, and a regression on it can give impressive but meaningless results. Checking whether the variance grows is the first step.
- Path properties are subtle. Two processes can have identical finite-dimensional distributions at every fixed set of times and still differ on uncountable events. Keep the question you are asking in mind when you reason about paths.
History
Louis Bachelier defended a thesis in Paris in 1900, Théorie de la spéculation, that modelled stock price changes as a random walk. He was one of the first to write down a process of this kind, and his mathematics was ahead of his field. Albert Einstein, in 1905, explained the jittery motion of particles in a fluid by treating it as a sum of many random kicks, which gave the same mathematics for a different purpose.
Andrey Markov began studying dependent sequences around 1906, the chains that now carry his name. He was looking for a way to extend the law of large numbers beyond independent trials, and the idea that the next state depends only on the current one became central.
The rigorous foundations came in the 1930s. Andrey Kolmogorov's 1933 book Grundbegriffe der Wahrscheinlichkeitsrechnung put probability on the axioms of measure theory and gave the consistency conditions that define a process. Joseph Doob and others developed the general theory of stochastic processes over the following decades, in the 1940s and 1950s. Norbert Wiener built a rigorous construction of Brownian motion in the 1920s, which became the most studied continuous-time process.
The concept caught on because one framework covered many fields at once. Physics, finance, queueing theory, biology and machine learning all needed a way to describe quantities that change randomly over time, and the stochastic process gave a shared language for them.
Check yourself
QuestionA stochastic process has equal to the number of heads in the first fair coin flips. What is , and why is this process not stationary?Show answer
Each flip contributes an expected 1/2 head, so . The process is not stationary because its mean depends on , and a stationary process has a constant mean.
QuestionFor the random walk with steps, what is and what is its standard deviation?Show answer
Each step has variance 1 and the steps are independent, so . The standard deviation is .
QuestionTwo processes have the same mean function and the same covariance at every pair of times. Does that mean they have the same distribution at every set of times? Explain.Show answer
Only for Gaussian processes. The joint distribution of any finite set of values is a Gaussian determined by its mean vector and covariance matrix, so matching both functions matches every finite-dimensional distribution. For general processes it is not enough: mean and covariance only describe second moments, and two processes with different higher-order structure can share them.
QuestionYou have one year of daily sales data and you want to forecast next month. The series trends upward and its variance grows over time. What is the risk in treating it as a stationary process, and what would you do first?Show answer
A stationary model would assume a constant mean and variance, so its forecasts and error bars would be wrong: the trend would be ignored and the spread underestimated as the series grows. First check the trend and the growing variance, then difference or detrend the series and model the remainder, or use a model built for a trend.
Sources
- Stochastic process (Wikipedia): https://en.wikipedia.org/wiki/Stochastic_process
- Random walk (Wikipedia): https://en.wikipedia.org/wiki/Random_walk
- Louis Bachelier (Wikipedia): https://en.wikipedia.org/wiki/Louis_Bachelier