Least squares regression: Definition, Calculation and example Least squares regression

Least squares regression: Definition, Calculation and example

SHARE THE ARTICLE ON

Table of Contents

What is least square regression?

Let’s say we have plotted some data on a graph. If the variables are correlated to each other, the scatterplots will show a linear pattern on a graph. Hence, it would make sense to draw a straight line through the points and group them. 

Least square regression is a technique that helps you draw a line of best fit depending on your data points. The line is called the least square regression line, which perfectly depicts the changes in your y (response) variables and their corresponding x (explanatory) variable. As the title has “regression” in it, we can clearly say that this line is used to predict the y variables from its x variable. Having both the response and explanatory variables is the first requirement of any regression technique. 

Transform your insight generation process

Create an actionable feedback collection process.

online survey

The least square regression line

The line that we draw through the scatterplots does not have to pass through all the plotted points, provided there is a perfect linear relationship between the variables. 

Equation of least square regression line: ŷ= a + b x

The Least Squares Regression technique sees to it that the line that makes the vertical distance from the data points to the regression line as small as possible. This line is nothing but the Least Squares Regression line. The word “least square” comes from the best fit line and its ability to minimize the variance. Variance is nothing but the sum of squares of the errors. Since these errors are squared, the data points start to move further away from each other. Hence, we need least square regression to minimize the difference.

Finding a line of best fit

Given below is an example of how the least square regression lie looks when plotted on a graph:

Equation of a line:

Where, 

y = how far up

x = how far sideways

m = slope

Example

A company measured the sales against its investment in advertising in 5 months

Download Market Research Toolkit

Get market research trends guide, Online Surveys guide, Agile Market Research Guide & 5 Market research Template

Making the most of your B2B market research in 2021 PDF 3 s 1.png

Step 1: Add two more columns for x2 and xy

Step 2: Find the sum of all columns

See Voxco survey software in action with a Free demo.

Step 3: Calculate slope m

m = N Σ(xy) − Σx Σy / N Σ(x2) − (Σx)2

5 x 263 − 26 x 41 / 5 x 168 − 262

1315 – 1066 / 840 − 676

249 / 164 

= 1.5183

Step 4: Calculate intercept b

b = Σy − m Σx / N

41 − 1.5183 x 26 / 5

= 0.3049

Step 5: Substitute in the equation of line formula

y = mx + b

y = 1.518x + 0.305

If we proceed to plot these points on a graph, it would look like this:

Net Promoter®, NPS®, NPS Prism®, and the NPS-related emoticons are registered trademarks of Bain & Company, Inc., Satmetrix Systems, Inc., and Fred Reichheld. Net Promoter Score℠ and Net Promoter System℠ are service marks of Bain & Company, Inc., Satmetrix Systems, Inc., and Fred Reichheld.

Explore all the survey question types
possible on Voxco

Read more