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

RE: Statistical Functions



PureBytes Links

Trading Reference Links

Howard

	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.  I would also like to know the formula's you used for the
Correlation Coefficient.  Are the statistical functions in TS2000i the same
as the ones you wrote for TS4.0?

Regards,

Mark.


> -----Original Message-----
> From: Howard Jackson [mailto:hrjf4@xxxxxxxxx]
> Sent: March 20, 1999 10:15 AM
> To: Omega
> Subject: RE: Statistical Functions
>
>
> While you are correct in saying that the correlation function of
> TradeStation 4 is worthless, and that OR support is clueless of the
> fact that it is worthless, it is not correct to say that these can not
> be written in EasyLAnguage.
>
> I personally wrote many of the functions you wrote here, and got them
> with my 2000i product.    Some of the functions I have found are:
>
> COrrelation
> Variance
> Standard DEviation for sample
> Standar Deviation for population
> Skewness
> Curosis
> FIsher Distribution
> Normal Distribution
> Normal CUmulative Distribution
>
> amongst others.   And as far as I have been able to test, they give me
> values that match excel for about 3 or 4 decimal places, then the
> rounding thing starts.  BUy hey, 3 or 4 decimal places is plenty for
> what I am doing.   When I place the trades they are rounded to the
> nearest 1/16 or 1/32nds anyways...
>
> If anyone is intersted in these functions just ask...
>
> H
>
>
> ---"Mark J. Cerar" <mcerar@xxxxxxxxx> wrote:
> >
> >     You are indeed correct, the correlation function in TS4.0 is a
> simplified
> > one that does not give correct results.  I wrote the correlation
> coefficient
> > code for EasyLang and compared it to the results in Excel on
> identical data
> > sets.  The results in EasyLang were way off i.e. Coefficient values of
> > greater than +1 and less than -1 etc.  When I wrote to EasyLang
> support they
> > said there were errors in my code.  They told me that they do not
> fix faulty
> > code and that I should hire an Omega Solution Provider to help me.
> I then
> > broke down the correlation coefficient into it's component
> calculations i.e.
> > mean, variance, standard deviation etc. in EasyLang and compared
> that to the
> > calculations in Excel.  I noticed that they did not match.  Some of
> the
> > variables were simply rounded off so much that the results were
> useless.
> > This is when I suspected that the problem was in TS not in my code.
> >     I found out later on that TS4.0 uses only single precision
> variables.  You
> > need double precision variables to calculate correlation coefficients
> > accurately.  MS products such as Excel and VB have double precision
> > variables so they have no problem.  TS2000i uses only single precision
> > variables too.  I asked EasyLang support about this recently and they
> > responded by saying double precision would be available using COM
> > architecture such as in a DLL.  How to do this I don't know?
> >     The moral of this story is that Marketing > Customer Satisfaction
> at Omega
> > Research.  The fact that they would rather send a customer off on a
> wild
> > goose chase and have him or her waste their time and money on a
> pointless
> > quest rather than admit a limitation in their product  proves it.  Of
> > course, there may be some way of coding an algorithm in EasyLang to
> > calculate the Correlation Coefficient using single-precision
> variables but I
> > haven't seen or heard of such an animal.
> >
> > Mark.
> >
> > > -----Original Message-----
> > > From: Rus Newton [mailto:rpn@xxxxxxxxxxxxxxxxxx]
> > > Sent: March 14, 1999 2:32 PM
> > > To: Omega
> > > Subject: Statistical Functions
> > >
> > >
> > > Anyone written EasyLanguage for proper correlation, covariance &
> other
> > > statistical functions? I don't think the correlation function
> > > included with
> > > TS4 is correct & although I have VB code for most of them I can't
> see the
> > > point of re-writing into ELA if someone else has already done so.
> > >
> > > Thanks
> > >
> > > Rus Newton
> > >
> > >
> >
> >
>
>