Session 20 Linear Regression

Table of contents

  1. Learning Outcomes
  2. Simple linear regression
  3. Multi variable regression: 2 Predictors
  4. Multi variable regression
  5. Exercise

1. Learning Outcomes

This section lists the specific competencies students must achieve by the end of the session.

1.1 Learning objectives

The following objective represents the core skill required for this session:

  • LO 5: Apply various learning algorithms for agents to solve problems.

📝 An agent uses a specific learning algorithm to adjust its behavior based on new data to solve a navigation task.

2. Simple linear regression

2.1 Simple linear regression definition

Simple linear regression is a statistical method used to model the relationship between a single predictor variable and a response variable.

  • Predictor variable: also known as the independent variable, this is the input used to explain or predict the outcome.
  • Response variable: also known as the dependent variable, this is the outcome that the model attempts to predict.
  • Linear relationship: the model assumes that the change in the response variable is proportional to the change in the predictor variable.

📝 A researcher studies how the number of hours spent studying affects exam scores, where study hours is the predictor and the score is the response.

2.2 Simple linear regression least square criteria

The least square criteria is the mathematical principle used to find the best-fitting line through a set of data points.

  • Residuals: these are the differences between the observed values and the values predicted by the regression line.
  • Objective: the method aims to minimize the sum of the squared residuals to ensure the line represents the data accurately.
  • Fitted line: the resulting line is defined by the equation y=β0+β1xy = \beta_0 + \beta_1 x, where β0\beta_0 is the intercept and β1\beta_1 is the slope.
TermMathematical Role
β0\beta_0The y-intercept representing the value of yy when x=0x=0
β1\beta_1The slope representing the change in yy for a one-unit change in xx
∑(yi−y^i)2\sum (y_i - \hat{y}_i)^2The sum of squared residuals to be minimized

📝 To find the best line for a dataset, you calculate the vertical distance from every point to the line, square those distances, and choose the line that makes this total sum as small as possible.

2.3 Simple linear regression example

This section applies the regression model to a practical business scenario involving restaurant profitability.

  • Context: The Tasty Sub Shop provides data to help entrepreneurs understand factors affecting the profitability of potential franchise sites.
  • Goal: The objective is to find the fitted regression line to predict profits based on specific site characteristics.

📝 An entrepreneur uses the fitted regression line from Tasty Sub's historical data to estimate the expected annual profit for a new location based on its projected foot traffic.

3. Multi variable regression: 2 Predictors

3.1 Multi variable regression: 2 predictors example

Multi variable regression extends the simple model by using more than one predictor to explain the variation in a response variable.

  • Multiple predictors: the model incorporates two or more independent variables to improve the accuracy of the prediction.
  • Model structure: the relationship is expressed as y=β0+β1x1+β2x2y = \beta_0 + \beta_1 x_1 + \beta_2 x_2, where each xx represents a different predictor.
Model TypeNumber of PredictorsEquation Form
Simple linear regressionOney=β0+β1x1y = \beta_0 + \beta_1 x_1
Multi variable regressionTwo or morey=β0+β1x1+β2x2y = \beta_0 + \beta_1 x_1 + \beta_2 x_2

📝 To predict a restaurant's profit, a model might simultaneously use both "daily customer count" and "average transaction size" as two separate predictors.

4. Multi variable regression

4.1 Definition and formula

Multi variable regression is a statistical method used to model the relationship between a dependent variable and multiple independent variables.

  • The model: It seeks to find a linear relationship that best fits the observed data points.
  • The X matrix: To perform the calculation, the X matrix must be augmented by adding a column of 1s as the first column.
  • The goal: The process aims to determine the coefficients that minimize the sum of squared residuals.
ComponentDescription
Dependent variableThe outcome or response variable being predicted
Independent variablesThe predictor variables used to explain the outcome
Augmented X matrixThe matrix of predictors including a column of 1s for the intercept

📝 To model a house price based on square footage and age, you would include both variables in your X matrix and add a column of 1s to account for the constant intercept.

4.2 Multi variable regression example

This section provides a mathematical application of the regression formulas to reach a solution.

  • Consistency: The results obtained through the multi variable approach are identical to those found in single variable regression when only one predictor is used.
  • Matrix application: The calculation relies on the relationship between the augmented X matrix and the vector of observed values.

📝 If you apply the multi variable formula to a dataset with only one predictor, the resulting coefficients will match the standard simple linear regression results.

5. Exercise

5.1 Exercise: Accu-Copiers, Inc.

This exercise tests the ability to apply least squares estimation to a real-world service data scenario.

  • The scenario: Accu-Copiers, Inc. collected data from 10 service calls to analyze the time required for routine maintenance on the Accu-500 machine.
  • Required tasks:
  • Find the least squares point estimates b0b_0 and b1b_1.
  • Determine the fitted linear regression equation.

📝 Given the service call data, a student must calculate the specific values for b0b_0 (the intercept) and b1b_1 (the slope) to create the final prediction equation.

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also