lib/stats.js
function() {
			// Get the x and y coordinates
			var xCoords = this.pluck('x');
			var yCoords = this.pluck('y');

			// Get the means for the x and y coordinates
			var meanX = xCoords.mean();
			var meanY = yCoords.mean();

			// Get the standard deviations for the x and y coordinates
			var stdDevX = xCoords.stdDev();
			var stdDevY = yCoords.stdDev();

			// Map each element to the difference of the element and the mean
			// divided by the standard deviation
			xCoords.map(function(num) {
				return (num - meanX) / stdDevX;
			});
			yCoords.map(function(num) {
				return (num - meanY) / stdDevY;
			});

			// Multiply each element in the x by the corresponding value in
			// the y
			var nums = this.clone().map(function(num, index) {
				return xCoords.get(index) * yCoords.get(index);
			});

			// r is the sum of xCoords over the number of points minus 1
			return nums.sum() / (nums.size() - 1);
		}
function() {
			// Get the x and y coordinates
			var xCoords = this.pluck('x');
			var yCoords = this.pluck('y');

			// Get the means for the x and y coordinates
			var meanX = xCoords.mean();
			var meanY = yCoords.mean();

			// Get the standard deviations for the x and y coordinates
			var stdDevX = xCoords.stdDev();
			var stdDevY = yCoords.stdDev();

			// Map each element to the difference of the element and the mean
			// divided by the standard deviation
			xCoords.map(function(num) {
				return (num - meanX) / stdDevX;
			});
			yCoords.map(function(num) {
				return (num - meanY) / stdDevY;
			});

			// Multiply each element in the x by the corresponding value in
			// the y
			var nums = this.clone().map(function(num, index) {
				return xCoords.get(index) * yCoords.get(index);
			});

			// r is the sum of xCoords over the number of points minus 1
			return nums.sum() / (nums.size() - 1);
		}
function ( ) { // Get the x and y coordinates
 var xCoords = this . pluck ( 'x' ) ; var yCoords = this . pluck ( 'y' ) ; // Get the means for the x and y coordinates
 var meanX = xCoords . mean ( ) ; var meanY = yCoords . mean ( ) ; // Get the standard deviations for the x and y coordinates
 var stdDevX = xCoords . stdDev ( ) ; var stdDevY = yCoords . stdDev ( ) ; // Map each element to the difference of the element and the mean
 // divided by the standard deviation
 xCoords . map ( function ( num ) { return ( num - meanX ) / stdDevX ; } ) ; yCoords . map ( function ( num ) { return ( num - meanY ) / stdDevY ; } ) ; // Multiply each element in the x by the corresponding value in
 // the y
 var nums = this . clone ( ) . map ( function ( num , index ) { return xCoords . get ( index ) * yCoords . get ( index ) ; } ) ; // r is the sum of xCoords over the number of points minus 1
 return nums . sum ( ) / ( nums . size ( ) - 1 ) ; }
Calculates the correlation coefficient for the data set.  Returns the value of r.
Calculates the correlation coefficient for the data set . Returns the value of r .