My question is why they are defined at all,
as they separate the sum and the 1/n part.

E.g. ssdev is sum of squared deviations,
whereas mean E(X) is Sum Xi*Pi, where Pi is 1/n.
So the semantical relationship is broken into
the details of arithmetic.

Here's an approach which, using very simple 
opertations, shows relation between
covariance (numerator) and variance (denominator).

   dv=: - +/ %    #                NB. deviation
   m1=:   +/ % <:@#                NB. adjusted mean
   cr=: m1@:*&dv % *&(m1&.:*:@dv)  NB. correlation

   1 3 2 4 cr 2 4 3 3.5
0.831522


--- "Sherlock, Ric" <[EMAIL PROTECTED]> wrote:

> Is there any practical reason both spdev & ssdev are defined?
> They both seem to do the same thing (ssdev is a little bit faster).
> spdev=:+/@(*~ dev)
> ssdev=:+/@:*:@dev
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of Devon 
> > McCormick
> > Sent: Wednesday, 27 June 2007 03:54
> > To: Programming forum
> > Subject: Re: [Jprogramming] Correlation Coefficient
> > 
> > I always like the version that comes in the standard J stats library:
> > 
> >    corr
> > cov % *&stddev
> >    cov
> > spdev % <:@[EMAIL PROTECTED]
> >    spdev
> > +/@(*~ dev)
> >    dev
> > -"_1 _ mean
> >    mean
> > +/ % #
> >    stddev
> > %:@var
> >    var
> > ssdev % <:@#
> >    ssdev
> > +/@:*:@dev



 
____________________________________________________________________________________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to