[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fast computation on LinearRegresion and Standard Error



PureBytes Links

Trading Reference Links

Bob Fulks wrote:
>>http://unicorn.us.com/trading/src/_LinRegSlopeSFC.txt
>
>One problem with this approach is that round-off errors accumulate.
>But you can fix this with a simple change:
>Instead of:
>    if xLen <> Length or CurrentBar <= 1 then begin
>use:
>    if xLen <> Length or Mod(CurrentBar, 100) = 1 then begin
>This re-calculates the full calculation once each 100 bars so
>will not allow round-off errors to get very large.

Thanks for the tip.  I had thought of that too...  However, in my
tests of daily bars that span 10 years, I have not noticed any
error accumulation, at least not in the 2nd decimal place that TS
displays.  Even if there was a small error visible, I doubt that it
would be significant in trading.  It's a good idea to recalculate
afresh every so often, but I would think that every 1000 bars would
be sufficient.

-- 
  ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
 // +__>   Director of Research and Development
 //  \ 
 // __)    Unicorn Research Corporation -- http://unicorn.us.com