Quant500 Academy

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:

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:

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:

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.

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.

The rest of Quant500

What you are learning, applied to the index every day:

The model portfolio, weekly in your inbox

Every Saturday, its week in one minute: how it went, the best and the worst, and which insiders bought with their own money. Plus, the day the model is rebuilt, which stocks come in and which go out. A simulation, not advice. At most one email a week, no ads, no account; one-click unsubscribe. Made by one person: Pol Gracia.

A model portfolio with simulated results, not a personalized recommendation. Your email is used for this only: privacy.

Behind the Academy and the rest of Quant500 there is one person: Pol Gracia Serrahima.