File:Residuals for Linear Regression Fit.png

Summary

Description
English: Shows the best-fit line to a given dataset (in red), and the resulting residuals (in black).

Produced with the following python code:

from pylab import *

# generate the data
x = arange(10)
np.random.seed(10)
y = 3*x+2+20*np.random.rand(len(x))

# determine the line-fit
k,d = polyfit(x,y,1)
yfit = k*x+d

# plot the data
scatter(x,y)
hold(True)
plot(x, yfit, 'r')
for ii in range(len(x)):
    plot([x[ii], x[ii]], [yfit[ii], y[ii]], 'k')
xlim((-0.1, 9.1))
xlabel('X')
ylabel('Y')
savefig('residuals.png', dpi=200)
show()
Date
Source Own work
Author Thomas.haslwanter
 
This plot was created with Matplotlib.
Category:PNG created with Matplotlib#Residuals%20for%20Linear%20Regression%20Fit.png

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-3.0#Residuals%20for%20Linear%20Regression%20Fit.png
Category:Self-published work Category:Images with Python source code Category:Linear regression
Category:CC-BY-SA-3.0 Category:Images with Python source code Category:Linear regression Category:PNG created with Matplotlib Category:Self-published work