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

Re: Statistical Functions



PureBytes Links

Trading Reference Links

"Mark J. Cerar" wrote:

>         I tested the correlation coefficient function for 40 bars of SP500 data in
> TS4.0 and the results were way off.  The rounding error is introduced during
> the calculation of Variance.  In this formula the Variance is calculated
> using the sum of squares.  When you sum the squares of a time-series like
> the SP500 which is in the four figure range over 40 bars you end up with a
> very large number which as far as I can tell in TS4.0 is rounded off so much
> that it doesn't work.
> 
>         The only way I can see to do this is to use fewer bars of data so that the
> sum of the squares would not be such a large number.  I don't know what the
> upper limit of bars would be with the SP500. The other way might be to
> pre-process the time-series so that the data on which you do the correlation
> calculation is in the one-figure or two-figure range i.e. maybe something
> like standard deviations from the mean.  The latter of course would also use
> a smaller sum of squares which maybe TS4.0 or TS2000i could handle.  This is
> an idea I haven't yet explored.
> 
>         If you have any further thoughts on this, I would be very interested in
> hearing them.  


Get yourself a good introductory book on numerical analysis.  Be sure 
to get one that starts with the theory of the basics of numerical 
errors/rounding caused by limited precision digital computation.

Don't bother to explore your idea; it won't work.  Read that good book
instead.  It will then be immediately obvious why it won't work.

BTW, I have never investigated it, but I suspect the results obtained
with EL are worse (less accurate) than if you implemented the same
sum of squares loop in single precision c or compiled VB on the WinTel
architecture, due to the likely method for handling the partial sums
in EL. (My bias that OR is lazy and unsophisticated in software design
and implementation shows through in this final comment.)

Rod