Wouldn’t it be great if there was a way to combine statistical probabilities with human intuition and expertise?

## How can we use Bayesian Inference in finance?

Isn’t data more trustworthy when it’s backed by prior knowledge and beliefs about its behaviour?

In the light of new evidence, can’t we update previously calculated probabilities?

Doesn’t it make sense to adjust predictions using real life experience?

These questions lead us to an area of statistics called Bayesian inference. This alternative differs from classic frequentist methods fundamentally due to its use of prior information. In Bayesian statistics we synthesise two sources of information – prior knowledge and data – into a probability distribution known as the posterior. This is done using Bayes’ theorem, which tells us **how to learn from experience**. For continuous distributions we have the following formula based around conditional probabilities:

which can be interpreted as the distribution of the parameter θ given the data x, derived using the prior f(θ).

This prior knowledge is a source of controversy, and provokes much criticism from frequentist statisticians. While in many applications of Bayesian methods the prior information comes in the form of expert opinions, the subjective nature is not inherent in forming the prior. It can be based on intuitive judgments and experiences, or may alternatively be created using historical and objective market data. This second option satisfies both frequentist and Bayesian ideals.

Another main characteristic of Bayesian statistics is the use of probability distributions to express uncertainty. A weak or uninformative prior is defined when we have little information or we are unsure of the hypothesis. After using real market evidence to create the posterior probability, the estimate is usually improved and the distribution’s variance is reduced. This narrower distribution is interpreted as reduced uncertainty surrounding the true state and hypothesis.

Apart from the mathematical calculations’s complexity, the choice of prior is the most challenging aspect of putting Bayesian techniques into practice. An incorrect prior can make it almost impossible to find the true state, and so the posterior distribution remains vague, whereas a useful prior allows us to arrive at the true state with ease.

## Applications in Finance

After the recent surge in their popularity, Bayesian methods are now being used in many technical areas and professions. To name a few: to filter spam emails, in robotics to infer position and orientation, in medical trials to approve new drugs and procedures, and (although it is not as widespread) it also has possible applications in some parts of finance. Let’s look at some examples:

- Imagine two financial assets are known to have a strong dependence between them. Using historical frequencies of the variations in both of them, we can infer probabilities for how changes in one affect the other. This type of application is quite simplistic and is probably employed without any awareness of its Bayesian foundations. For example, we see how a change in interest rates will affect a stock price index based on past data. From the table below we estimate that if interest rates increase then there is an 88% (50/57) chance that the S&P500 will decrease.

- The methods can also be used to create an adaptive technical model based on
*recursive Bayesian estimation*. We estimate the direction of the market and update it as we receive more data; hence the prior probability each day is the previous day’s posterior probability. This iterative process produces improved estimations as the market becomes clearer and more data becomes available. It is used to filter out background noise and focus on the principal movements. One way to use this would be to wait until a sufficiently good estimate is achieved (i.e. the movement is clear enough) and trade in that direction. In the graph below we observe how the estimates for a coordinate system are improved with 100 iterations.

- In a more technical sense, we can use Bayesian statistics in model fitting. Usually we optimise the probability of data fitting a certain model and fit observations to that model, but by making use of Bayes’ formula we can invert the problem and optimise the probability that the model fits the data.

- We receive information which leads us to believe, given our experience, that a certain asset is going to fall in value an x% over a certain period. We can set this as our prior knowledge, incorporating our uncertainty of this value x, and (combining it with current market data movements) we can achieve stronger and more accurate estimates.

- A clever and more specific application of the famous Bayes’ Theorem could be in
**stop loss trading levels.**We methodically change our opinion of the market as we receive new information. Then, by means of a recursive strategy, we update our stop loss level. The idea is very similar to a trailing stop; dynamically changing the trade exit level to take into account what is happening in the market. In the next entry we will look at this strategy in more detail and implement a basic version.

## In Conclusion

In practice, using Bayesian methods in finance is not as simple as it may first appear. Defining a prior distribution and deriving the posterior distribution can be complex tasks. Although basic uses of Bayes’ theorem may be found in certain areas of finance, true implementation of Bayesian inference is hard to come by. We hope to discover and examine possible applications in future posts.

Don’t miss the next post in this series: In less than a Bayes haze.