euclidean distance between vectors grouped by other variable in SPSS, R or Excel

I have a dataset containing something like this: case,group,val1,val2,val3,val4 1,1,3,5,6,8 2,1,2,7,5,4 3,2,1,3,6,8 4,2,5,4,3,7 5,1,8,6,5,3 I'm trying to compute programmatically the Euclidean distance between the vectors of values in groups. This means that I have x number of cases in n number of groups. The euclidean distance is computed between pairs of rows and then averaged for the group. So, in the example above, first I compute the mean and std dev of group 1 (case 1, 2 and 5), then standardise values (i.e. [(original value - mean)/st dev], then compute the ED between case 1 and case 2, case 2 and 5, and case 1 and 5, and finally average the ED for the group. Can anyone suggest a neat way of achieving this in a reasonably efficient way?

以上就是euclidean distance between vectors grouped by other variable in SPSS, R or Excel的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏