Linear Regression in Excel: A Simple Step-By-Step Guide

How to perform linear regression in

In this tutorial, you’ll learn how to perform Linear Regression in Excel. Linear regression is an approach to linear modeling the relationship between a dependent and an independent variable. Simple linear regression uses an independent variable to predict the outcome of the dependent variable.

The equation for linear regression is given by: y = a + bx, where x is the independent variable, y is the dependent variable and the coefficients are given by:

linear regression formula

Our aim is to find coefficients a which is the intercept and b which is the slope to obtain the equation of the straight line which best fits our data by the least square method. There are two ways in Excel in which we can find the linear regression line which is discussed below for the following data set:

x y data 1

Calculate Linear Regression in Excel Using Its Formula

First, we need to calculate the parameters in the formula for coefficients a and b. The parameters are Σx, Σy, Σxy and Σx 2 . To calculate Σx follow these steps:

summation

summation x result

To calculate Σy follow these steps:

summation y

summation y result

To calculate Σxy follow these steps:

single

first xy product

xy entire list

summation

summation xy result

To calculate Σx 2 follow these steps:

x squared sfirst

x squared sfirst result

squares of x entire list

summation x sqaured formula

summation x sqaured

We now have the parameters essential for the calculation of coefficients intercept a and slope b. Follow the steps to calculate the intercept a:

intercept calculation

intercept result

Follow the steps to calculate the slope b:

slope calculation

slope result

We have the values for the slope and intercept, the equation for the linear regression can be written as y = 1.5 + 0.95x. This equation can now be used to predict values of y for different values of x.

Linear Regression in Excel Using Data Analysis

To use the Data Analysis feature, you need to enable Analysis Toolpak in Excel. Follow these steps to manually enable the feature:

Excel Options 2

add ins dialog

Follow these steps to perform linear regression using Data Analysis:

data analysis dialog

regression dialog

data analysis regression results

Conclusion

In this tutorial, we learned how to perform linear regression both using the formulas and Excel Add-ins.

References