title: Error of slope using numpy.polyfit and dependent variable
body: <p>I am having trouble understanding the error estimates between the variables when performing linear regression. Referring to <a href="https://stackoverflow.com/questions/27634270/how-to-find-error-on-slope-and-intercept-using-numpy-polyfit/56643541#56643541">How to find error on slope and intercept using numpy.polyfit</a> say I am fitting a straight line with <code>numpy.polyfit</code> (code below).</p>
  
  <p>As mentioned in the question in the link, the square root of the diagonals of the covariance matrix are the estimated standard-deviation for each of the fitted coefficients, and so <code>np.sqrt(V[0][0]))</code> is the standard deviation of the slope. My question(s) is(are): how the standard deviation of <code>y</code> should be represented? Should it be the addition of the uncertainties <em>in quadrature</em>, i.e., y +/- <code>np.sqrt(np.sqrt(V[0][0])**2+np.sqrt(V[1][1])**2)</code> ? Or perhaps I could only represent it by the standard deviation of the residuals (which would be <code>np.sqrt(S)/(len(y)-1)</code>)? Finally, is it possible to obtain the residuals from the covariance matrix?</p>
  
  <p>PS: thanks for the heads-up on adding an "answer" to a question.</p>
  
  <pre><code>import numpy as np
  
  # Data for testing
  x = np.array([0.24580423, 0.59642861, 0.35879163, 0.37891011, 0.02445137,
         0.23830957, 0.38793433, 0.68054104, 0.83934083, 0.76073689])
  
  y = np.array([0.61502838, 1.01772738, 1.35351035, 1.32799754, 0.23326104,
         0.89275698, 0.689498  , 1.48300835, 2.324673  , 1.52208752])
  
  p, V = np.polyfit(x, y, 1, cov=True)
  
  p2, S, *rest = np.polyfit(x, y, 1, full=True)
  </code></pre>