Bayesian regression - Has anyone made an EA using this algorithm? - page 31

 
Yuri Evseenkov:

I have made a program which obtains coefficients a and b at which the probability according to Bayes' theorem is maximal when applying a normal distribution with expectation equal to ax+b.

The algorithm is reduced to enumerating possible values of a and b in lines y=ax+b, substituting into Bayes formula P(a,b|x,y)=P(x,y|a,b)*P(a)*P(b)/P(x,y); (1)

The probability function P(x,y|a,b) is taken as the normal distribution formula with expectation ax+b. The maximum likelihood measure of the Bayes formula is inversely proportional to the standard deviation.

Straight line (red line) constructed by coefficients a and b (at which probability according to Bayes' theorem is maximal) almost coincided with the same indicator (yellow line) of the linear regression from the kodobase.

Dmitry Fedoseev, Vladimir and other "Copenhagenists" were right.

We got the same plus a probabilistic measure of fit of a,b x and y by Bayes formula. In this case (linear dependence, normal distribution of y, uniform distribution of a and b) it turned out to be inversely proportional to the standard deviation. Perhaps this measure will come in handy in the analysis.


And I thought only chatterboxes came here. I respect your persistence and willingness to understand the theory and apply it in practice.
 
forexman77:

I have another problem: I can't understand some formulas where you have to understand the algebraic signs.

If you mean my and your codes showing distributions of ticks by price levels, there are only four arithmetic operations.

If you mean Bayesian and generally probabilistic methods, you can intuitively represent only some basic concepts. If the object is complex, you need to get it wrong, and the result is a waste of time. You need a kind of mathematical culture or something. And formulas are complicated. But that's okay. Me, with a "C" in higher mathematics, something is beginning to make sense. And on the forum people give key concepts and formulas so as not to get lost in theory.

 
Event:
Your research deserves respect!

There's an article recently - you might find it useful...

https://habrahabr.ru/company/itinvest/blog/277337/

Well, "research" is a bit of a mouthful. So I went through the coefficients, put them into a formula. It's just something to get you started.

Thanks for the article. I've been wanting to read about entropy for a long time. I even have an example of code there.

P.S. Your old avatar with the elephant was cool.

 
Vladimir:
I thought it was just chatterboxes. I respect your persistence and willingness to understand the theory and apply it in practice.

Thank you. I read your threadPredicting the market based on macroeconomic indicators. Impressive.

P.S. And the "chatterboxes" on the Baeis thread are interesting.

 

Please explain the difference between the indicatorshttps://www.mql5.com/ru/code/7812 andhttps://www.mql5.com/ru/code/7325.

If with the first one it seems clear that it builds a line in the middle of the quotes in a given range of bars, then the second one, which looks like a sliding bar, is not clear?

Linear Regression Line (Линия Линейной Регрессии)
Linear Regression Line (Линия Линейной Регрессии)
  • votes: 1
  • 2008.02.06
  • Antoniuk Oleg
  • www.mql5.com
Индикатор рисует линию линейной регресии на основе цен закрытия последних баров.
 
forexman77:

Please explain the difference between the indicatorshttps://www.mql5.com/ru/code/7812 andhttps://www.mql5.com/ru/code/7325.

If with the first one it seems clear that it draws a line in the middle of the quotes in a given range of bars, then the second one, which looks like a sliding bar, is not clear?

The linear regression is not static - the first indicator shows visually what data has been used for the calculation and displays only one point as a result, while the second one shows the calculation at each point, respectively, without visualizing the calculation. I.e. as traders we are not interested enough in the past data, we want to use the forecasting potential that the indicator has on the regression.
 
-Aleks-:
Linear regression is not static - the first indicator shows visually what data was used for the calculation and displays only one point as a result, and the second one shows the calculation on each point, respectively, without visualisation of calculation. I.e. as traders we are not interested in past data, we want to use the forecasting potential of the indicator on regression.
Thank you!
 

Congratulations to the creator of this thread and to the readers on the holiday! Health, peace and prosperity to you and your loved ones!

 

I will try to apply Bayes' theorem in practice.

Task. Using Bayes' theorem, determine which value of a tick that has not yet arrived is most likely.

Given. Time series x,y.

y=ax+b A line from the last tick to the future.

P(a,b|x,y)=P(x,y|a,b)*P(a)*P(b)/P(x,y); (1) Bayes formula.

P(a,b|x,y)is the probability that the coefficients a and b correspond to the x and y coordinates of a future tick.

We need to find such a and b that this probability (or more correctly,a probability measure) is maximal.

P(x,y|a,b) - let's take the real histogram of ticks distribution by price levels as a likelihood function. The function is defined by a two-dimensional array (matrix): price range - probability, percentage ratio of ticks falling within this range to the total number of ticks. (see figure 1)

P(a) The coefficient a determines the slope of the straight line. It can be both positive and negative. The probability of one or the other sign of the value, is determined from the same diagram.

P(b) The coefficient b determines the slope of the line with respect to the time axis.

The coefficients a and b determine the increment of price. As participants emphasized, the distribution of price increments has a shape close to normal. I propose to consider that coefficient b is normally distributed. You can set it with a random number generator (RNG) with a Gaussian distribution.

P(x,y) is a normalizing divisor. A constant value.

For program writing please advise if the standard RNG of MT4 has normal distribution of results or use another one.

Fig. 1


 
Yuri Evseenkov:

Congratulations to the creator of this thread and to the readers on the holiday! Health, peace and prosperity to you and your loved ones!

Thank you so much for this unexpected gift.
Reason: