3. Random variables: how to turn 'maybe' into a number
Level 1: Probability: the language of uncertainty
'The stock might go up.' With that sentence you can compute absolutely nothing. Not an expected return, not a risk, not a position size.
A random variable is the device that turns that sentence into something you can actually work with.
Formally, it is a rule that assigns a numerical value to every possible outcome of an uncertain situation. It is not the event itself, but its translation into a number.
Instead of vaguely saying that a stock might go up or might go down, it forces you to define two things precisely:
- Which numbers it can take, for example tomorrow's percentage return.
- What probability is attached to each of those possible values.
This apparently simple step is what lets you start computing rather than merely opining.
Two families: discrete and continuous
A discrete random variable takes a countable set of values, usually the result of counting something. Two examples:
- The number of up days within a 21-session month. It can be 0, 1, 2 and so on up to 21, but never 7.3.
- The number of winning trades among a strategy's first 50.
A continuous random variable, by contrast, can take any value within a range. It is typically the result of measuring something.
The daily percentage return of a stock is the standard case: it might be 0.37%, -1.284% or any other real number inside a reasonable interval.
How the probability is spread
The probability distribution of a random variable describes how the total probability is spread across all its possible values. That total probability must always add up to 1.
For a discrete variable, this can literally be written out as a list of values alongside their associated probabilities.
For a continuous variable there is an important subtlety. Since there are infinitely many possible values within any interval, the probability of the variable taking one exact value is, in practice, zero.
What does make sense to compute is something else: the probability that the value falls inside a given interval, for instance between -1% and +1%.
A discrete example that adds up to 100%
You can define a random variable that classifies a stock's daily return into three categories:
- Down more than 1%.
- Roughly flat, between -1% and +1%.
- Up more than 1%.
And assign them, for illustration, probabilities of 30%, 45% and 25% respectively.
Those three probabilities must add up to exactly 100%. If they do not, the random variable is badly defined, no matter how reasonable the individual numbers look on their own.
The continuous case: look at the histogram
In the continuous case, intuition is best built with a histogram.
If you record thousands of historical daily returns without bucketing them into categories, and plot them as a bar chart, you get an empirical approximation to the underlying continuous probability distribution.
Almost invariably you see the same thing. Most days cluster near zero, with frequency tapering off as returns move away from the center toward extreme values, both positive and negative.
The bell, and the tails that do not fit
The theoretical model most commonly used to approximate this kind of continuous distribution is the normal distribution, with its classic bell shape.
It has one striking virtue: it is fully specified by just two numbers, its mean and its standard deviation. Both are the formal subject of the next module.
Real market returns, however, tend to show heavier tails than a normal distribution predicts. Extreme moves, both sharp drops and sharp rallies, occur more often than that theoretical model would suggest.
This excess weight in the tails is formally called excess kurtosis. It is the precise mathematical basis of something the market theory course mentioned intuitively when discussing the risk of sudden crashes.
The variable is not one of its realizations
It is worth clearly distinguishing between the random variable itself and a particular realization of that variable.
- The random variable is the general rule before the outcome is observed: tomorrow's return on a given stock, still unknown.
- The realization is the specific number already observed, for example +0.8% at the close of that session.
Confusing the general behavior of the random variable — its full distribution — with a single observed realization is a common source of statistical reasoning errors. Several of them are examined in detail in the final module of this level.
The mandatory step before computing anything
Turning 'maybe' into a well-defined random variable, with its complete list of possible values and their associated probabilities, is not a dispensable preliminary. It is the mandatory step before you can compute anything else.
Expected value, variance, correlation between assets: all of those tools are developed in the following modules of this level. And all of them operate exclusively on well-specified random variables, never on vague hunches about where the market might be heading.