LinearRegression_FoundationalMathofAI_S24
LinearRegression_FoundationalMathofAI_S24
Yashil Sukurdeep
June 28, 2024
Contents
1 Linear Regression: Fundamentals 2
1
1 Linear Regression: Fundamentals
Linear regression is a statistical technique used to model and analyze the rela-
tionships between a dependent variable and one or more independent variables.
By fitting a linear equation to the observed data, linear regression helps in pre-
dicting the value of the dependent variable based on the values of the indepen-
dent variables. This method is widely used in various fields such as economics,
biology, engineering, and social sciences due to its simplicity and interpretabil-
ity. The primary objective of linear regression is to determine the best-fitting
line, known as the line of best fit, which minimizes the differences between the
observed values and the predicted values. This allows researchers and analysts
to understand the strength and direction of the relationship between variables,
make predictions, and uncover trends. Linear regression is fundamental to both
statistical analysis and machine learning, serving as a foundational tool for more
complex modeling techniques.
Figure 1: Scatter plot showing a positive linear trend between two variables.
2
It seems reasonable to suspect that there is a positive linear relationship between
the dependent variable y and the independent variable x, which we can model
through the following linear model :
yi = β0 + β1 xi + ϵi for i = 1, . . . , n
where:
• yi is the dependent variable for the i-th observation,
whose y-intercept βb0 and slope βb1 are calculated such that they minimize the
sum of the squared errors between the observed values yi and the predicted
.
values ybi = βb0 + βb1 xi :
n
X 2
βb0 , βb1 = argmin (yi − β0 − β1 xi ) (2)
β0 ,β1 i=1
Figure 2: Line of best fit (in red) for the data from Figure 1.
3
Using some calculus and algebra, we can find explicit formulas for βb0 and βb1 :