Linear Regression
Learn how to find the line of best fit for data and use it to make predictions.
Definition
Linear regression is a statistical method for finding the straight line that best fits a set of data points. This line, called the line of best fit or regression line, keeps the vertical distances between the data points and the line as small as possible overall.
The equation of the regression line is:
Where:
- is the slope (how much changes for each unit increase in )
- is the y-intercept (the value of when )
The least squares method finds the line that minimizes the sum of squared distances (residuals) from each point to the line:
Try it now
What does the slope in a regression line represent?
Interactive Visual
Scatter Plot
Temperature vs iced coffee sales
ŷ = 2.5x − 16.5
r = 0.998 · strong positive correlation
Tap a point to see its coordinates.
Interactive Sandbox
Interactive Grapher
Tap or hover over the graph to read off values.
Try these examples:
y = 2.5x - 16.5
m=2.5, b=-16.5
Expression Calculator
Try these:
History
No calculations yet
Practice Problems
16 problemsProblem 1 of 16
Easy
What does the slope in a regression line represent?
Glossary
- Linear regression
- A statistical method for finding the straight line that best fits a set of data points
- Line of best fit
- The regression line that minimizes the sum of squared residuals
- Slope
- The rate of change; how much increases for each unit increase in
- Y-intercept
- The value of when ; where the line crosses the y-axis
- Residual
- The difference between an actual data point and its predicted value on the regression line
- Least squares
- The method that finds the line minimizing the sum of squared residuals
- Extrapolation
- Using a regression equation to predict values outside the range of the original data
Formula Card
Regression Line
The equation of the line of best fit where m is slope and b is y-intercept
Slope Formula
Calculate the slope from data points using means and deviations
Y-Intercept
Calculate the y-intercept using the slope and the means of x and y
Residual
The difference between actual and predicted values for each point