Our members are dedicated to PASSION and PURPOSE without drama!

APPLICATION OF LINEAR REGRESSION TO TREND ANALYSIS

Started by esoito, April 15, 2013, 10:46:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

esoito

This is really one for Bayes, when he has a moment.

Three requests:

1  Please could you explain LR in relatively simple terms so even the maths-challenged amongst us can have an understandable overview?  (None of the sites I looked at understand the word 'simple'.)

2  Please could you show how it may (or may not) be useful for trend analysis?  (With application to random numbers...perhaps...?? )


3  Please could you suggest any relevant software suitable for members here?

Bayes

Ok, Linear Regression is basically a way of trying to model a relationship between 2 variables (there is something called multiple linear regression which incorporates more than 2 variables, but it's a lot more complicated). In simple terms, you're trying to "fit" a straight line through some points on a graph. This can be done roughly, by eye, but there is a formula which calculates the best fit and therefore gives the best model. You can do the calculations by hand (most scientific calculators have a LR function which makes it quite easy) but usually it's done by computer, and most spreadsheets can do it quite easily.


Having calculated your straight line through the points, you can then use it to "predict" where the next point plotted is likely to lie, according to the model. You have to be careful with this though, because there's no guarantee that the model will continue to hold good when you extrapolate, and this is especially true when dealing with random numbers.  :P


There's a little applet here which you can use to understand the basics of LR: http://mste.illinois.edu/activity/regression/
Click in the green plot area a few times to get some points, then use the rotation scrollbar to rotate the line, and click on "show best fit" to get the optimum line through the points.


Here's a little article on using LR for trend identification which you might find useful:
http://www.dummies.com/how-to/content/how-to-use-a-linear-regression-to-identify-market-.html


Here's an example of how LR could be used to find trends playing the even chances. Generate a table of red/black outcomes, counting how many of each have hit and you end up with a table something like this (50 spins) :



Red   Black


1   0
2   0
2   1
3   1
3   2
4   2
4   3
5   3
6   3
6   4
6   5
7   5
8   5
8   6
8   7
8   8
9   8
10   8
10   9
11   9
11   10
12   10
13   10
13   11
13   12
13   13
14   13
14   14
14   15
15   15
15   16
15   17
15   18
16   18
17   18
18   18
19   18
20   18
20   19
21   19
21   20
22   20
23   20
23   21
23   22
24   22
25   22
25   23
26   23
27   23


So after 50 spins red has hit 27 times and black 23 times. Now you need to plot these points and calculate the LR line. I used some free software called Gnuplot, but you could use Excel or any decent spreadsheet program.


This is the result.


[attachimg=1]


The numbers of reds are on the horizontal axis and the numbers of blacks are on the vertical axis.  Now, if you wanted to "predict" the outcome of the next spin, using the regression line, you would look at the last outcome to see whether it's above or below the line. You're expecting the outcomes to follow the line, so if the last outcome was ABOVE the line you bet that the next outcome will move closer to the line, so in this case you would bet for red to hit, but if the last outcome was BELOW the line you would bet that the next outcome would be black - I hope you can see why you'd bet this way.


So that's it, in a nutshell. It would probably work better (if it works at all) if you recalculated the regression line every 25 spins or so, because random is constantly changing. You could experiment with a "global" line (which extended back say 100 spins) and several short-term lines to model the most recent trends.

esoito

Mate, you are a STAR !!!!

Thank you so much for putting this together, despite your busy schedule that I know takes a lot of your time and energy. 

With great skill you've reduced LR to the basic essentials. You've addressed all three parts of my request. And you've explained it in such a simple way that if  you're not a trained teacher already then you've missed your vocation!

The illustrations are well chosen, too.

I hope members will find this as informative and useful as I have.

Thank you again.  :thumbsup:



Bayes

Thanks for the kind words.  :)


I was actually a maths teacher for a VERY short time years ago. I could handle the maths ok, but not the kids.  :fight:

Sputnik


I like Gnuplot as it looks a littel as "point and figure" charting ...

esoito

On reflection LR could have a place in Binary Options trading where forces other than random are at work.

And assessing some of those forces can help make market predictions more accurate.

Sputnik

 
The old way of charting is very good, the gnuplot reminds me on vertical strings of events ...
Common charting method for baccarat ...

But non of them is good for reading trends, i think it is beginners stuff ... when it comes to even money bets ...

RRRR
BB
R
B
R
BBB
RR
BBBBBBBBB
RRR
R
B
RR
R
B
R
BBB