title: What are the weight values to use in numpy polyfit and what is the error of the fit
body: <p>I'm trying to do a linear fit to some data in numpy.</p>
  
  <p>Ex (where w is the number of samples I have for that value, i.e. for the point <code>(x=0, y=0)</code> I only have 1 measurement and the value of that measurement is <code>2.2</code>, but for the point <code>(1,1)</code> I have 2 measurements with a value of <code>3.5</code>.</p>
  
  <pre><code>x = np.array([0, 1, 2, 3])
  y = np.array([2.2, 3.5, 4.6, 5.2])
  w = np.array([1, 2, 2, 1])
  
  z = np.polyfit(x, y, 1, w = w)
  </code></pre>
  
  <p>So, now the question is:
  is it correct to use <code>w=w</code> in polyfit for these cases or should I use <code>w = sqrt(w)</code> of what should I use?</p>
  
  <p>Also, how can I get the fit error from polyfit?</p>