Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Bayesian Statistics With R For Traders
#1

Bayesian statistics is very important for traders to learn. In Bayesian statistics, we start with an assumption and then use the data sequentially to improve upon that assumption. Trading is also like that. As data arrives, we improve our prediction about the market direction. More on that in the thread as we progress. I believe every trader should have some understanding for Bayesian Statistics. Data is arriving sequential and we are interested in knowing the bar when we should enter into a trade and the bar when we should close the trade. Bayesian Statistics is perfectly suited to help us achieve that. At the end of each bar, we can use the Bayes formula and determine whether we have a buy signal, sell signal and no signal. 

Likelihood: I am starting this thread in which I will discuss Bayesian Statistics using R. R is a powerful statistical and data science programming language. When we learn Bayesian Statistics, we will also learn how to implement Bayesian Statistical models in R. Just like the Frequentist Statistics, in Bayesian Statistics Likelihood is very important. Likelihood is the probability of observing the data with the given model assumption. Likelihood function is very important in both Bayesian and Non Bayesian Statistics as it influences the inferences that we draw from the data.

Prior: This is something important for you to understand from the very beginning. In Bayesian Statistics, data is considered to be fixed and non random while the model parameters are considered to be random and uncertain. This makes sense. Once we have the data there is no uncertainty left in it. Now we need to fit a model to that data using a number of parameters. These parameters are not known at the start of the process of fitting the model to the data. This forces us to use a prior distribution for the parameters. This prior distribution works as an initial guess that we have about the model parameters. Sometime we use a flat prior. Flat prior means that the parameter value is uniformly distributed in an interval and we consider the parameter to be equally likely in that interval.

Now flat priors are not the best priors. Think of the Bayesian Model is an information processing machine that works sequentially. Weakly informative priors are better when it comes to nudging the Bayesian Machine in the right direction. This is another advantage of Bayesian Statistics. We can use our expert knowledge in the model to improve our predictions. This is precisely what we traders do. Most of the time we  have an opinion about the market like its direction. Bayesian Statistics allows us to build models that can incorporate our opinion as market experts in the model. If our opinion is wrong, the model should be able to filter that opinion. We will see how to do that as we progress in the thread. So basically priors are assumptions and like other assumptions need to be tested. 

Posterior: Posterior is what we get when we combine the prior with the likelihood. We use the Bayes formula to calculate the posterior. You can think of posterior is the update of our belief with the arrival of new data. Bayes formula let's us flip the probability and calculate the inverse probability. Below is the Bayes formula in simple terms:

Posterior= Likelihood X Prior/Average Likelihood

Average Likelihood is also known as Marginal Likelihood.

Subscribe My YouTube Channel:
https://www.youtube.com/channel/UCUE7VPo...F_BCoxFXIw

Join Our Million Dollar Trading Challenge:
https://www.doubledoji.com/million-dolla...challenge/
Reply
#2

As traders we are interested in buy/sell signals. How can Bayes formula help us. This is how Bayesian statistics formulates the signal detection problems:

--The signal has binary state meaning 0 and 1. In our case the signal is either buy or sell. It's same as 0 and 1.
--Signal is hidden from us.  We can only observe it imperfectly. This is precisely what we traders face on a daily basis. Our signals can only be observed with lot o noise meaning imperfectly. We get a cue. This cue can be like a candlestick pattern or any other chart pattern or an indicator or a group of indicators reading. We think it is a buy signal
--Can we use Bayes formula to deduce the true state of the buy signal using the cue that we have just received.

Think over the above three points that I have made. Using Bayes formula only gives us a posterior distribution as I mentioned in the beginning of this thread. A probability distribution? Yes we get a posterior probability distribution about our signal. It just tells us the probability of 0 and 1 in our case since we have reduced our signal detection problem to a binary state classification problem. But since we are dealing with probability distributions here we can only talk of the expected value. Expected value is the long run value.

This is what we do. We define a loss function and an expected profit function. We then take the expected value of this loss function and the expected profit function. This tells us in the long run what will be our expected profit and expected loss.

Subscribe My YouTube Channel:
https://www.youtube.com/channel/UCUE7VPo...F_BCoxFXIw

Join Our Million Dollar Trading Challenge:
https://www.doubledoji.com/million-dolla...challenge/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)