Dan Bron wrote:
> Hey John,
>
> Thanks!  I got this just as I posted that last message.   I can see you're
> onto something, but I don't quite understand.  Can you
> perhaps show me a couple of examples?  Use the noun  jjss  if you can.
>

This can be improved substantially, but here's the general idea.  You can
also get m more directly from the original data.

jjss   =:  (<0 1;(,2);,3),(<0 1 2;,3),(<0 3;1 2),(<0 1 3;,2),<0 1;2 3
f=:[: ; ] ,"0&.>~ [: i. #
g=:[: /:/ |:
h=:[: |: [: > g@:f&.>  NB. h jjss gives rows (identities), columns
(attribute values)
c=:[: (+/%#) =    NB. correlate two vectors
C=:c"1/~          NB. correlation matrix

   ]m=:h jjss
0 0 0 0 0
0 0 1 0 0
1 0 1 1 1
2 1 0 0 1
   C m
  1 0.8 0.2 0.4
0.8   1 0.4 0.2
0.2 0.4   1 0.2
0.4 0.2 0.2   1

Best wishes,

John


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to