I used the Spearson project here on Github. I tested it for Spearman's correlation, and it gives exact values for that.
I just uploaded the file spearson.jsto the /librepo folder . Here's how to use it in a browser:
<script src="spearson.js"></script>
<script>
var x = [3, 4, 5];
var y = [.1, .2, .3];
var corr = spearson.correlation.spearman(x, y);
</script>
Similarly, you can use correlation.pearsonPearson's correlation.
source
share