Least Squares Regression

Mean-centering the data

In order to mean-center a dataset, one first has to calculate the mean values of x and y. Then, the mean of x is subtracted from every x-value, and the mean of y is subtracted from every y-value. In our dataset, the mean value of x is 2.00, and the mean value of y is 2.98.

centering of x                    centering of y

In the plot, this simply moves the origin of the coordinate-system to the «center of gravity» of the dataset. In the figure below, the new coordinate-axis are drawn with black lines. You can see that the vertical line is at x=2.00, and the horizontal line is at y=2.98.

plot of dataset

If you were to draw a straight line through all these datapoints, you would probably agree that the line should pass through the origin of the new coordinate-axis (the «center of gravity»). Having that settled, all we have to determine is the slope of the line.



previous next