Click here to Login





                                                   Regression Channels Tool Calculates Regression Channels Incorrectly

  0

0
Andrew Boada
2015-08-20 00:04:05


I have no idea how to edit the drawing tool formulas, so I thought I'd bring this issue to your attention.

The first problem is with standard deviation (SD) channels. Although the program seems to calculate the SD statistic correctly, the SD of the dependent variable isn't an appropriate statistic to use to construct a price channel, especially for data that exhibit a trend. That's because the SD isn't a measure of the dispersion of the dependent variable (price in this case) around a trend line; it's a measure of the dispersion of the values of the dependent variable around its own sample mean.

The reason it's a lousy statistic for drawing channels becomes apparent as soon as it's used on time series data the exhibits a decent trend. Financial instruments that have spent a long enough time trading in one direction or another are likely to have current prices that are considerably different from their prices when the trend first began. This means there will be a lot of variation from average price over the course of the trend, and that means a SD that gets progressively larger over time. Creating price channels by drawing a trendline and then adding and subtracting the SD of price data from its mean will result in channels that get wider and wider as the trend continues. If the trend goes on long enough, this technique can easily produce channels that contain 100% of all price movement in the period under consideration, by a comfortable margin. That makes this kind of channel nearly useless as an analytical tool.

The statistic you really want to use to create a straight regression channel is the standard error of the regression, which tells you the standard deviation of the residuals from the trend line. As long as the degree of scatter of prices around the trendline doesn't increase over time, the trend can go on forever and the standard error regression channels will stay the same distance from the regression line. By construction, the trend line plus and minus 1.96 standard errors will contain approximately 95% of the data sampled.

The regression channel drawing tool does offer a channel it calls "standard error", but it bears no resemblance to actual standard error as calculated by an OLS regression. I just did a spot check by running a regression on close prices for the stock OML.L, from 1 September 2009 to 31 December 2013. I calculated a standard error of 14.31 pence. The standard error as calculated by the drawing tool for the same period seems to be about 1.5 pence, off by a factor of almost 10. It took me a minute to figure out where that number came from. It looks like what is being called a standard error is the mean of the sampled price data, divided by 100. That's not even remotely how standard errors are calculated.

It would be great if you guys could fix this tool. Being able to draw statistically meaningful channels based on dependable calculations, without having to use excel or stata to do it, would be very handy.



QuantShare
2015-08-20 04:16:49

  0

Hi Andrew,

The standard error formula used is similar to this one:
http://ncalculators.com/math-worksheets/calculate-standard-error.htm

You cannot edit built-in drawing tools but you can create new ones. You can find many examples on the sharing server.






Andrew Boada
2015-08-20 16:35:25

  0

Hello,

Thanks for replying.

Whatever formula the program is using to calculate standard errors isn't the right one. It gives incorrect standard errors, and it also isn't consistent.

I pulled the underlying data for two stocks from my database, ran regressions on them, and produced standard errors of the estimates to draw standard error price channels. Then I compared them with the channels quantshare drew.

Here are two examples (I drew them all in Excel for ease of visual comparison): http://imgur.com/a/gpdTO#0

The formula for calculating standard errors of the regression can be found here: http://onlinestatbook.com/2/regression/accuracy.html

I know there are people who have created OLS-based indicators, but I'm not really interested in that. I'd really much rather have a functioning regression channel drawing tool.

Again, I'd really just like this to be fixed. I expect this software to work properly.



QuantShare
2015-08-21 02:54:24

  0

Andrew,

I am not sure why you are saying that the the formula isn't the right one and is incorrect.

These are different measures. We propose the standard error of the mean and not the standard error of the estimate and that doesn't mean that the formula is wrong and that the software isn't working properly.

We may add the standard error of the estimate later.



Andrew Boada
2015-08-22 12:30:18

  0

Hi again,

It looks like someone over on your end understands why standard error of the estimate (a.k.a. standard deviation of the residuals) is the statistic to use in conjunction with a regression line in order to construct statistically meaningful regression channels: http://www.quantshare.com/item-1293-standard-error-of-the-estimate-of-a-regression-line#

I downloaded and tested this tool on the same stocks and periods as I did previously when I evaluated the accuracy of the drawing tool's channels. On AAPL, the figure for S.E.E. it gives for the period I looked at is different by a fraction of a penny from the figure I calculated. For OML.L, a stock traded on the London Stock Exchange, the S.E.E. it calculates is more than two times bigger than the figure I calculated. It looks like something is going wrong with its calculations when they're non-US stocks. I'm not sure why that would be.

Assuming that little bug is fixed, the underlying calculation this tool makes is the same calculation the drawing tool should be making when it constructs standard error price channels. For every point along the trend line the user has drawn, the program should add and subtract a user-selected multiple of the S.E.E. to generate the price channel.

Just to reiterate, when you're drawing a trend line and you want to construct a channel around it, you want to know how prices typically deviate from that trend. That's what S.E.E. is a measure of. It tells you how far a typical data point is likely to lie from the trend. As a trader, it can be used to help identify good prices at which to buy and sell, and to help determine if and when a previously identified trend has been violated.

Standard error of the sample mean, as you noted, is a different measure. It uses sample data to estimate the standard deviation of a population mean. This statistic does not relate directly to trends, and it is absolutely not a measure of variation around a trend line. It's the sort of statistic you'd be interested in, for example, if you wanted to estimate the standard deviation of the mean height of all adult males at a given moment in time based on a sample of, say, 40 randomly selected adult males.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Weighted Linear Regression
Donchian Channels
Volatility Channels Indicator
Trading System based on the Linear Regression of the RSI Indicato...
Standard Error of the Estimate of a Regression Line

How-to Lessons
How to use a custom drawing tool
How to calculate the average of a time series using the money man...
How to debug a trading system using the money management tool
How to use the Fibonacci retracement drawing tool
How to remove a chart pane's margins

Related Forum Threads
Quality of fit of CLOSE to linear regression for last n bars.
Trading System based on the Linear Regression of the RSI Indicato...
plot indicator as drawing tool
Custom Drawing tool Trendline does not end with second click
"Combine Trading Systems" tool Question

Blog Posts
Quantitative Analysis: Price Channels
The custom trading indicators tool explained
Introduction to the Events Monitor Tool
How to use QuantShare Indicators in the Grid Tool
Introduction to the Grid Tool









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.