File:Linear regression.svg

Summary

 
This diagram was created with SageMath.
Category:Created with SageMath#Linear%20regression.svg
Description
English: Random data points and their linear regression. Created with the following Sage (http://sagemath.org) commands:
X = RealDistribution('uniform', [-20, 60])

Y = RealDistribution('gaussian', 1.5)

f(x) = 3*x/20 + 5

xvals = [X.get_random_element() for _ in range(100)]

data = [(x, f(x) + Y.get_random_element()) for x in xvals]

m, b = var('m b')

g(x) = m*x + b

g(x) = g(x).subs(find_fit(data, g, solution_dict=True))

p = list_plot(data) + plot(g, (x, -20, 60), color='red')

p.save('linear_regression.svg')
Date
Source Own work
Author Sewaqu
Other versions Derivative works of this file:  Sedm zakladnich nastroju zlepsovani kvality cz.svgCategory:Files with derivative versions

Licensing

Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.
Category:Self-published work#Linear%20regression.svgCategory:PD-self#Linear%20regression.svg Category:Scatterplots Category:Images with Sage source code Category:Linear regression Category:Least squares
Category:Created with SageMath Category:Files with derivative versions Category:Images with Sage source code Category:Least squares Category:Linear regression Category:PD-self Category:Pages using deprecated source tags Category:Scatterplots Category:Self-published work