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();

			// Calculate the correlation coefficient
			var r = this.r();

			// Calculate the slope
			var slope = r * (stdDevY / stdDevX);

			// Calculate the y-intercept
			var yIntercept = meanY - slope * meanX;

			return {
				slope: slope,
				yIntercept: yIntercept,
				r: r
			};
		}
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();

			// Calculate the correlation coefficient
			var r = this.r();

			// Calculate the slope
			var slope = r * (stdDevY / stdDevX);

			// Calculate the y-intercept
			var yIntercept = meanY - slope * meanX;

			return {
				slope: slope,
				yIntercept: yIntercept,
				r: r
			};
		}
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 ( ) ; // Calculate the correlation coefficient
 var r = this . r ( ) ; // Calculate the slope
 var slope = r * ( stdDevY / stdDevX ) ; // Calculate the y-intercept
 var yIntercept = meanY - slope * meanX ; return { slope : slope , yIntercept : yIntercept , r : r } ; }
Calculates the Least Squares Regression line for the data set.  Returns an object with the slope and y intercept.
Calculates the Least Squares Regression line for the data set . Returns an object with the slope and y intercept .