Statistics Calculator: Linear Regression

Use this page to derive and draw the line of best fit from a set of bivariate data.





Online Linear Regression Calculator

This page allows you to compute the equation for the line of best fit from a set of bivariate data:

  1. Enter the bivariate x,y data in the text box. x is the independent variable and y is the dependent variable. Data can be entered in two ways:

      x values in the first line and y values in the second line, or ...
      individual x,y values on separate lines.

    Individual values within a line may be separated by commas, tabs or spaces. This flexibility in the input format should make it easier to paste data taken from other applications or from text books.
  2. Press the "Submit Data" button to perform the computation.
  3. To clear the graph and enter a new data set, press "Reset".
  4. If the calculations were successful, a scatter plot representing the data will be displayed. On the same plot you will see the graphic representation of the linear regression equation. Above the scatter plot, the variables that were used to compute the equation are displayed, along with the equation itself.
  5. You can now enter an x-value in the box below the plot, to calculate the predicted value of y
  6. To clear the graph and enter a new data set, press "Reset".

What is simple linear regression

Simple linear regression is a way to describe a relationship between two variables through an equation of a straight line, called line of best fit, that most closely models this relationship.

Linear Regression Formula

This calculator uses the following formula to derive the equation for the line of best fit:

$ y = a+bx $

where

$ b = \frac{\sum_{i=1}^n x_i y_i - n \bar{x} \bar{y}}{\sum_{i=1}^n x_i^2 - n \bar{x}^2} $   and   $ a = \bar{y} - b  \bar{x}$