where I is the total number of datapoints. In the figure below, lines are drawn for four of the points.
If you look at the lines drawn, you see that a small sampling error in the datapoints close to origo has a much bigger impact on the slope than the the same error would have on datapoints far away from origo. One could therefore argue that points close to origo should count less when calculating the mean value. This can be accomplished by using a weighted mean.