title: Algorithm for scatter plot 'best-fit' line
body: <p>I'm writing a small application in C# using MSChart control to do Scatter Plots of sets of X and Y data points. Some of these can be rather large (hundreds of data points).</p>
  
  <p>Wanted to ask if there's a 'standard' algorith for plotting a best-fit line across the points. I'm thinking to divide the X data points to a predefined number of sets, say 10 or 20, and for each set take the average of the corresponding Y values and the middle X value, and so on to create the line. Is this a correct approach?</p>
  
  <p>I've searched existing threads but they all seem to be about achieving the same using existing applications like Matlab.</p>
  
  <p>Thanks,</p>