Following that logic, (is there a shorter corr?)
CR=: (+/@:* % *&(+/)&.:*:)&(- +/ % #)
1 3 2 4 CR 2 4 3 3.5
0.831522
But this is already an exercise in arithmetic and
not statistics.
> [mailto:[EMAIL PROTECTED] On Behalf Of Raul Miller
> On 6/27/07, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> > What does SD stand for?
>
> %:@E@:*:@:- E
>
> where E is arithmetic mean
>
> If you want to think of it as standard deviation, or
> substandard deviation, feel free.
--- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> Although in correlation the n-1 cancel out, statistical stddev
> and cov should use sample variance, as the estimated mean is
> used in E(X-E(X))^2 is one less degree of freedom.
>
> --- Raul Miller <[EMAIL PROTECTED]> wrote:
>
> > Here's another (straightforward) variant:
> >
> > E=: +/ % #
> > SD=: %:@E@:*:@:- E
> > COR=: E@:*&(- E) % *&SD
--- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> 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
--- Henry Rich <[EMAIL PROTECTED]> wrote:
> Not really, but gee, shouldn't we be using our wonderful
> language to provide the most expressive form of c rather
> than just the shortest?
>
> a =. (# * +/)@:* - *&(+/)
> c =. a % [EMAIL PROTECTED] %:@* [EMAIL PROTECTED]
> 1 3 2 4 c 2 4 3 3.5
> 0.831522
>
> a =. ((# * +/)@:* - *&(+/)) "1
> c =. %: @ (%~/ . *) @: (a/~) @: ,:
> 1 3 2 4 c 2 4 3 3.5
> 0.831522
>
> I don't think either of these forms is useful for real work,
> since they involve subtracting big near-equal numbers, but
> I learned something about the computation by writing them.
>
> Henry Rich
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of June Kim
> > Sent: Tuesday, June 26, 2007 10:08 AM
> > To: Programming forum
> > Subject: [Jprogramming] Correlation Coefficient
> >
> > I've been playing with the expression at
> > http://en.wikipedia.org/wiki/Correlation
> >
> >
> > c=.(*&[EMAIL PROTECTED]@:*)%*&(s(-~(#*s=.+/))&.:*:])
> > 1 3 2 4 c 2 4 3 3.5
> > 0.831522
> >
> > c is as short as I can get. Could you come up with a verb for
> > correlation, shorter than c?
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm