http://qs321.pair.com?node_id=1209523


in reply to creating and managing many hashes

What formula do you use to calculate the correlation between the pairs? Does it involve the stddev, mean?

Replies are listed 'Best First'.
Re^2: creating and managing many hashes
by Gtforce (Sexton) on Feb 24, 2018 at 13:25 UTC

    Definitely involves mean and stddev. Hopefully the snippet shows how I'm trying to do this, but do let me know if there is another way, thanks.

    foreach my $subrow (keys %pair1data) { $zee1 = ( ( $pair1data{$subrow} - $submean1 ) / $substddev1 ); $zee2 = ( ( $pair2data{$subrow} - $submean2 ) / $substddev2 ); $sigma += ( $zee1 * $zee2 ); $datasetcounter ++; } $r = ( $sigma / ( $datasetcounter - 1 ) ); return $r;