How to Make Predictions with Linear Regression - Statology (2024)

Linear regression is a method we can use to quantify the relationship between one or more predictor variables and a response variable.

One of the most common reasons for fitting a regression model is to use the model to predict the values of new observations.

We use the following steps to make predictions with a regression model:

  • Step 1: Collect the data.
  • Step 2: Fit a regression model to the data.
  • Step 3: Verify that the model fits the data well.
  • Step 4: Use the fitted regression equation to predict the values of new observations.

The following examples show how to use regression models to make predictions.

Example 1: Make Predictions with a Simple Linear Regression Model

Suppose a doctor collects data for height (in inches) and weight (in pounds) on 50 patients.

She then fits a simple linear regression model using “weight” as the predictor variable and “height” as the response variable.

The fitted regression equation is as follows:

Height = 32.7830 + 0.2001*(weight)

After checking that the assumptions of the linear regression model are met, the doctor concludes that the model fits the data well.

He can then use the model to predict the height of new patients based on their weight.

For example, suppose a new patient weighs 170 pounds. Using the model, we would predict that this patient would have a height of 66.8 inches:

Height = 32.7830 + 0.2001*(170) = 66.8 inches

Example 2: Make Predictions with a Multiple Linear Regression Model

Suppose an economist collects data for total years of schooling, weekly hours worked, and yearly income on 30 individuals.

He then fits a multiple linear regression model using “total years of schooling” and “weekly hours worked” as the predictor variable and “yearly income” as the response variable.

The fitted regression equation is as follows:

Income = 1,342.29 + 3,324.33*(years of schooling) + 765.88*(weekly hours worked)

After checking that the assumptions of the linear regression model are met, the economist concludes that the model fits the data well.

He can then use the model to predict the yearly income of a new individual based on their total years of schooling and weekly hours worked.

For example, suppose a new individual has 16 years of total schooling and works an average of 40 hours per week. Using the model, we would predict that this individual would have a yearly income of $85,166.77:

Income = 1,342.29 + 3,324.33*(16) + 765.88*(45) = $85,166.77

On Using Confidence Intervals

When using a regression model to make predictions on new observations, the value predicted by the regression model is known as a point estimate.

Although the point estimate represents our best guess for the value of the new observation, it’s unlikely to exactly match the value of the new observation.

So, to capture this uncertainty we can create a confidence interval – a range of values that is likely to contain a population parameter with a certain level of confidence.

For example, instead of predicting that a new individual will be 66.8 inches tall, we may create the following confidence interval:

95% Confidence Interval = [64.8 inches, 68.8 inches]

We would interpret this interval to mean that we’re 95% confident that the true height of this individual is between 64.8 inches and 68.8 inches.

Cautions on Making Predictions

Keep in mind the following when using a regression model to make predictions:

1. Only use the model to make predictions within the range of data used to estimate the regression model.

For example, suppose we fit a regression model using the predictor variable “weight” and the weight of individuals in the sample we used to estimate the model ranged between 120 pounds and 180 pounds.

It would be invalid to use the model to estimate the height of an individual who weighted 200 pounds because this falls outside of the range of the predictor variable that we used to estimate the model.

It’s possible that the relationship between weight and height is different outside of the range of 120 to 180 pounds, so we shouldn’t use the model to estimate the height of an individual who weighs 200 pounds.

2. Only use the model to make predictions for the population you sampled.

For example, suppose the population that an economist draws a sample from all lives in a particular city.

We should only use the fitted regression model to predict the yearly income of individuals in this city since the entire sample that was used to fit the model lived in this city.

Additional Resources

Introduction to Simple Linear Regression
Introduction to Multiple Linear Regression
Introduction to Confidence Intervals
The Four Assumptions of Linear Regression

How to Make Predictions with Linear Regression - Statology (2024)

FAQs

How to Make Predictions with Linear Regression - Statology? ›

How to Use a Linear Regression Model to Calculate a Predicted Response Value. Step 1: Identify the independent variable . Step 2: Calculate the predicted response value by plugging in the given value into the least-squares linear regression line y ^ ( x ) = a x + b .

How to do prediction using linear regression? ›

How to Use a Linear Regression Model to Calculate a Predicted Response Value. Step 1: Identify the independent variable . Step 2: Calculate the predicted response value by plugging in the given value into the least-squares linear regression line y ^ ( x ) = a x + b .

How to interpret linear regression statology? ›

A value of 0 indicates that the response variable cannot be explained by the predictor variable at all. A value of 1 indicates that the response variable can be perfectly explained without error by the predictor variable. The higher the R-squared of a model, the better the model is able to fit the data.

Is it appropriate to use the linear regression equation to make predictions? ›

Statistical researchers often use a linear relationship to predict the (average) numerical value of Y for a given value of X using a straight line (called the regression line). If you know the slope and the y-intercept of that regression line, then you can plug in a value for X and predict the average value for Y.

What is an example of a simple linear regression forecasting? ›

Linear regression is one of the simplest predictive modelling algorithms which predicts the values of dependent variables by taking into account just one independent variable. For example, predicting the salary by looking at the qualification or predicting the height by looking at the age, etc.

What are the methods of linear prediction? ›

The two classic methods for linear prediction are called the autocorrelation method and the covariance method [162,157]. Both methods solve the linear normal equations (defined below) using different autocorrelation estimates. is guaranteed to be stable).

Which regression is best for prediction? ›

For example, if you want to predict a continuous outcome variable, such as sales, you will need a linear regression model. If you want to predict a binary outcome variable, such as customer churn, you will need a logistic regression model.

Which regression model is best for prediction? ›

ML experts prefer Ridge regression as it minimizes the loss encountered in linear regression (discussed above). In place of OLS (Ordinary Least Squares), the output values are predicted by a ridge estimator in ridge regression. The above-discussed linear regression uses OLS to predict the output values.

How do you predict outcomes in statistics? ›

Through the use of regression, models can be created to predict outcomes. More specifically, linear and logistic regression models are used to predict outcomes.

How do you explain linear regression results? ›

Interpreting Linear Regression Coefficients

A positive coefficient indicates that as the value of the independent variable increases, the mean of the dependent variable also tends to increase. A negative coefficient suggests that as the independent variable increases, the dependent variable tends to decrease.

How do you interpret predicted value in linear regression? ›

The predicted value of Y is called the predicted value of Y, and is denoted Y'. The difference between the observed Y and the predicted Y (Y-Y') is called a residual. The predicted Y part is the linear part. The residual is the error.

What is the simplest explanation of linear regression? ›

What is simple linear regression? Simple linear regression is a regression model that estimates the relationship between one independent variable and one dependent variable using a straight line. Both variables should be quantitative.

Why linear regression is not suitable for prediction? ›

Answer: Linear regression is not suitable for classification because it predicts continuous outcomes rather than discrete classes.

When should you not use linear regression? ›

[1] To recapitulate, first, the relationship between x and y should be linear. Second, all the observations in a sample must be independent of each other; thus, this method should not be used if the data include more than one observation on any individual.

Why we Cannot use linear regression to make probability predictions? ›

Probability is ranged between 0 and 1, where the probability of something certain to happen is 1, and 0 is something unlikely to happen. But in linear regression, we are predicting an absolute number, which can range outside 0 and 1.

How do you make predictions in linear regression Excel? ›

How to Do a Linear Regression in Excel
  1. Step 1: Input Historical Values Into Excel. Start by inputting your historical data into Excel. ...
  2. Step 2: Plot Your Historical Data Using a Scatter Plot. Next, plot your historical data using a scatter plot. ...
  3. Step 3: Place Your Trendline. ...
  4. Step 4: Calculate Your Prediction.
Jan 23, 2024

Can linear regression predict probability? ›

Like all forms of regression analysis, linear regression focuses on the conditional probability distribution of the response given the values of the predictors, rather than on the joint probability distribution of all of these variables, which is the domain of multivariate analysis.

Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 5804

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.