Brian,
This corr is dyadic, not monadic.
corr/2&{.& |: ?. 5 3$0
_0.856246
corr/_2&{.& |: ?. 5 3$0
_0.801738
corr/(<<<1){& |: ?. 5 3$0
0.498916
The R verb below is monadic as you expected,
but is only in one of my old scripts.
R ?. 5 3$0
1 _0.856246 0.498916
_0.856246 1 _0.801738
0.498916 _0.801738 1
On Sat, Mar 26, 2011 at 2:18 PM, Brian Deaton <[email protected]> wrote:
>
>
> Correlation, as it's defined, is returning the covariance matrix instead of
> the correlation matrix.
> In 'addons/stats/base/multivariate' correlation is defined as:
>
>
> corr=: cov % * & stddev
>
> corr ?. 5 3$0
> 0.185386 _0.0395232 0.023712
> _0.0395232 0.109811 0.0778964
> 0.023712 0.0778964 0.0764413
>
> cov ?. 5 3$0
> 0.185386 _0.0395232 0.023712
> _0.0395232 0.109811 0.0778964
> 0.023712 0.0778964 0.0764413
>
>
>
> Shouldn't it be something more like:
>
> corr2=: cov % (*"0 1)~ @ stddev
>
> corr2 ?. 5 3$0
> 1 _0.277006 0.199189
> _0.277006 1 0.850217
> 0.199189 0.850217 1
>
>
>
> Thank you,
> Brian
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm