Catalog

How to Use Linear Regression in Excel (Step-by-Step Tutorial)

August 17, 2023 1.7K views

Linear regression is a fundamental statistical and machine learning technique used for modeling the relationship between a dependent variable (also known as the target or outcome variable) and one or more independent variables (also called predictors or features). It assumes a linear relationship between the variables, meaning the change in the dependent variable is directly proportional to the change in the independent variables.

Linear regression is widely used in various fields, including economics, finance, social sciences, and machine learning, to analyze relationships between variables, make predictions, and estimate numerical outcomes. Excel is also a statistical analysis tool, and you can use linear regression in Excel. This article will give a detailed tutorial on how to use linear regression in Excel.

Part 1. What is Excel Linear Regression?

In Excel, Linear Regression is a statistical tool and a built-in function used to find the best-fitting straight line that describes the linear relationship between two or more variables. It is commonly employed for predictive modeling and analyzing the relationship between a dependent variable and one or more independent variables.

The Linear Regression function in Excel calculates the coefficients (slope and intercept) of the line that minimizes the sum of squared differences between the actual values and the predicted values. This line is also known as the "regression line" or "trendline."

Part 2. How to Use Excel Linear Regression?

Using linear regression in Excel is straightforward and can be done using the built-in "Data Analysis" tool. Follow these steps to use Linear regression in Excel.

Excel Linear Regression Formula And Template With Step By Step Tutorial.

Step 1.  Input the data into an Excel sheet. We have taken the data for one year for COVID Cases and the number of masks sold each month. The Covid cases column is our X-axis, the independent variable. In comparison, the Masks Sold column is Y-axis or the dependent variable. We will perform linear regression on this data.

Step 2. To use the regression function, we have to enable it from the data analysis option. Here is how to enable the regression function in data analysis in Excel.

  • Go to the Data tab and click on Data Analysis in the Analysis group.

  • Select Regression in the pop-up window and then click OK.

  • In the next window, input the Y cell range, the Masks sold column. Then, input the X range, which is the COVID Cases column. Select the Output range in Output options and enter a cell number where you want to get the output. In our case, we have selected the cell K4 for output. Check the Labels and Residual options also, and click OK.

Step 3. When you click the OK button, you will get the following data as output.

Interpretation of the Output Data

1. Summary Output

This summary shows how well the calculated linear regression fits your data source.

  • Multiple R: The Multiple R is the Correlation coefficient that measures the strength of the relationship between independent and dependent variables. The larger the value, the stronger the relationship. In our example, the value is closer to 1, which indicates a stronger relationship between both variables,

  • R Square: It is the coefficient determination, which shows how well the regression fits your data. The value of R square is 0.99 in our example, which is a good fit. It shows that independent variables explain 99% of dependent variables.

  • Adjusted R Square: It is the modified version of R Square.

  • Standard Error: It is another goodness of fit measure which shows the precision of regression analysis.

ANOVA - Analysis Of Variance

It gives the level of variance in your regression model.

  • Df is the degree of freedom with respect to variance.

  • SS  is the sum of squares. The smaller the residual SS with respect to Total SS, the better your data fits with the model.

  • MS is the Mean Square

  • F  is the F-statistics or F-test of the null hypothesis.It is used to test the effectiveness of the model.

  • Significance F is the P value of F.

Making A Graph for Regression In Excel

We can also represent the linear regression function with the help of a graph. The graph gives a visual representation of the data. To make a graph of the above data, follow these steps.

  • Select both columns i,.e. COVID case and Masks sold.

  • Select the Insert tab from the main menu and then click on Scatter chart from the Chart section.

  • You will get the following chart.

  • To get the trend line, click any point and then right-click and select Add Trendline.

  • You will get the following graph with a trendline.

Part 3: A Free Alternative to Microsoft Office - WPS Office

WPS Office is the most robust and popular office suite, used by millions of users worldwide. With many advanced features and built-in templates, it is a free and the best alternative to Microsoft Office. You can use WPS Office as a web app online and a desktop version on your PC.

WPS Office is better than Microsoft Office when compared with the following aspects.

Cost

Microsoft Office is not free to use. You can use the free trial version for only 30 days. To use the trial version, you must provide payment details to use the free trial version. However, WPS Office is free to use. You can use the standard version free of cost.

Cross-Platform Availability

Microsoft Office is available for Windows, Mac, and Android. It requires high system specifications to run smoothly. The latest Microsoft 365 may not run on older versions of different operating systems. WPS Office is lightweight software, and you can use it on Linux, Windows, Mac, Android, and even iOS devices smoothly.

Collaboration

Microsoft Office offers real-time team collaboration and co-authoring features. WPS Office also provides team collaboration features. You can easily collaborate with your team members and can track changes in all the work. You can also suggest and comment on the documents in real-time.

100,000+ Built-in Templates

WPS Office has 100,000+ built-in templates in Writer, Spreadsheet, and Presentation software. You can use a template of your choice which makes your work easier as you do not have to create a document from scratch.

Trustpilot

stars

WPS Office- Free All-in-One Office Suite
  • Use Word, Excel, and PPT for FREE, No Ads.

  • Edit PDF files with the powerful PDF toolkit.

  • Microsoft-like interface. Easy to learn. 100% Compatibility.

  • Boost your productivity with WPS's abundant free Word, Excel, PPT, and CV templates.

5,820,008 User

avator

Algirdas Jasaitis
logo

How To Use Linear Regression in WPS Spreadsheet?

You can easily use linear regression Excel in WPS Spreadsheet. WPS Spreadsheet resembles Microsoft Excel. It has all the functions and features of MS Excel. To use linear regression in WPS Spreadsheet, follow these simple steps.

Step 1. Open the worksheet ofthe  above example with WPS Office.

Step 2. Select both columns and click the Insert tab. From the insert menu, select scatter chart and press enter.

Step 3. You will get the following chart.

Step 4. You can also add a trend line by selecting any point on the chart and then right-click and select Add Trendline.

Step 5.  You will get the following Trend line.

Step 6. You can customize the chart and trendline by selecting among the different options available.

FAQs

1. Can I use Excel's linear regression for nonlinear relationships?

No, You can not use the Excel Linear Regression function for non-linear relationships. The linear function is only designed for linear relationships.

2. Can I perform a linear regression analysis in Excel with multiple independent variables?

Yes, You can perform linear regression analysis with multiple independent variables. This is particularly useful when analyzing complex relationships between multiple factors.

3. Is it necessary to check the assumptions of linear regression in Excel?

Yes, testing the assumptions of linear regression before concluding is crucial. These assumptions may include linearity, independence, normality of residuals, and homoscedasticity. Excel does not provide built-in tests for these assumptions.

Linear Regression In Excel - Conclusion

Linear regression is a helpful function for analyzing different variables directly related to each other. You can efficiently perform linear regression in Excel using Excel's regression function. You can also use WPS Spreadsheet to perform linear regression on any data. WPS Office is a popular productivity solution. You can download WPS Office for free from its official website.

15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.