----- Original Message ----- From: "Brian Deaton" <[email protected]> To: <[email protected]> Sent: Sunday, March 27, 2011 7:18 AM Subject: [Jprogramming] correlation bug?
> > > 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
