Linear regression calculator
Calculator finds out coefficient of linear function to fits best into series of (x, y) points.

Beta version

This online calculator is currently under heavy development. It may or it may NOT work correctly.
You CAN try to use it. You CAN even get the proper results.
However, please VERIFY all results on your own, as the level of completion of this item is NOT CONFIRMED.
Feel free to send any ideas and comments !

Calculation data - measurement points


Results - linear approximation of your points

Function formulaShow sourcey=2 x+1y=2~x+1
Line slope a2
Free term b1
Measurement points
Number of points4
Points you entered(1, 3), (2, 5), (3, 7), (4, 9)
Helper values
Sum of x-values x\sum x10
Sum of y-values x\sum x24
Sum of x squares x2\sum x^230
Sum of multiplies xy\sum xy70

Some facts

  • Approximation of a function consists in finding a function formula that best matches to a set of points e.g. obtained as measurement data.
  • If we limit the search to linear function only, then we say about linear regression or linear approximation.
  • The least squares method is one of the methods for finding such a function.
  • The least squares method is the optimization method. As a result we get function that the sum of squares of deviations from the measured data is the smallest. Mathematically, we can write it as follows:
    i=1n[yif(xi)]2=min.\sum_{i=1}^{n} \left[y_i - f(x_i)\right]^2 = min.
    • (xi,yi)(x_i, y_i) - coordinations of the i-th measurement point, these are points that we know,
    • f(x)f(x) - the function we are searching for, we want this function to best match to the measurement points,
    • nn - number of measurement points.
  • If we set a condition that we are only looking for a linear function:
    f(x)=ax+bf(x) = ax + b
    we get following solution:
    a=n SxySx Syn Sxx(Sx)2a = \dfrac{n~S_{xy} - S_x~S_y}{n~S_{xx} - \left(S_x\right)^2}
    b=Sya Sxnb = \dfrac{S_y - a~S_x}{n}
    • SxS_{x} - sum of x-values xi\sum x_i,
    • SyS_{y} - sum of y-values yi\sum y_i,
    • SxxS_{xx} - sum of squares xi2\sum x_i^2,
    • SxyS_{xy} - sum of multiplies xi yi\sum x_i~y_i.

Tags and links to this website

What tags this calculator has


This is permalink. Permalink is the link containing your input data. Just copy it and share your work with friends:

Links to external sites (leaving Calculla?)

JavaScript failed !
So this is static version of this website.
This website works a lot better in JavaScript enabled browser.
Please enable JavaScript.