A random variable is a numerical quantity whose value is not known in advance because it depends on the outcome of a chance process. Formally it is a function that assigns a number to each possible outcome of an experiment. The number shown by a die, the return on a share tomorrow and the loss on a loan portfolio next year are all random variables. By convention a random variable is written with a capital letter, such as , and a particular value it takes with a lower-case letter, such as .
A random variable is described by its probability distribution, which states how likely each value or range of values is. Almost all of quantitative finance is built on the idea: prices, returns, defaults and interest rates are modelled as random variables so that their risk can be measured.
Discrete and continuous random variables
A discrete random variable takes separate, countable values, such as the number of winning trades in a month or whether a borrower defaults. Its distribution is given by a probability mass function that assigns a probability to each value, and the probabilities add up to one.
A continuous random variable can take any value in a range, such as a return of 1.37 percent. The probability of any single exact value is zero, so the distribution is given by a probability density function, and probabilities are found as areas under its curve. The normal distribution and the lognormal distribution are the continuous distributions used most often for returns and prices. For both types, the cumulative distribution function gives the probability that the variable is less than or equal to a stated value.
Expected value and variance
Two numbers summarize most of what is needed about a random variable. The first is its expected value, the probability-weighted average of its outcomes. For a discrete variable:
The second is its variance, the expected squared distance from that average:
- is the -th possible value of the variable.
- is the probability of that value.
- is the expected value of the square of the variable.
The square root of the variance is the standard deviation, which is in the same units as the variable.
As an example, let be the profit on one trade of a strategy that gains $200 with probability 0.55 and loses $150 with probability 0.45. The expected value is dollars. The expected square is . The variance is , and the standard deviation is about $174. The typical swing on one trade is roughly four times the average profit, which shows why a real edge can be hard to see in a small number of trades.
Several random variables together
Markets involve many random variables at once, and how they move together matters as much as how each behaves alone. Covariance and correlation measure the tendency of two variables to move in the same direction. Two variables are independent if knowing the value of one tells nothing about the other; independence implies zero correlation, but zero correlation does not imply independence.
The variance of a sum depends on these links. For a portfolio of two assets, the variance of the total return is the sum of the weighted variances plus a term for their covariance, which is the mathematical basis of diversification. A sequence of random variables indexed by time, such as daily prices, is called a stochastic process.
Use in finance and trading
Treating an uncertain quantity as a random variable allows precise questions to be asked about it. A risk manager asks for the loss that will be exceeded with only 1 percent probability. An option trader asks for the expected payoff of a contract under a pricing distribution. A strategy researcher asks whether the average return in a backtest is far enough from zero to be more than luck, which is a statement about the distribution of a sample mean.
Two results explain why averages are informative. The law of large numbers says the average of many independent draws settles near the expected value. The central limit theorem says that this average is approximately normally distributed whatever the shape of the original variable. Where formulas are not available, Monte Carlo simulation generates many random draws by computer and studies the results.
Limits of the model
Describing a market quantity as a random variable requires choosing a distribution, and the choice is an assumption. Returns show more extreme values than the normal distribution allows, their variability changes over time, and successive returns are not fully independent. Distributions estimated from past data may not describe the future. The framework is therefore a disciplined way of reasoning about uncertainty, not a guarantee that the stated probabilities are correct.