8.2 Regression
8.2 Regression
2_Regression
Regression
Introduction
Regression analysis is a statistical method used to examine the relationship
between one or more independent variables (predictors) and a dependent variable
(response).
The goal of regression is to model this relationship mathematically to predict,
analyze, or understand how changes in the predictors affect the response.
Regression is widely applied across fields such as economics, biology, machine
learning, finance, and social sciences for prediction, trend analysis, and
hypothesis testing.
Definition
Regression : is a mathematical measure of the average relationship between two
or more variables in terms of original units of the data.
3. Multiple Regression :
4. Logistic Regression :
Example :
Ex 1 :
Ex 2 :
It is clear that the data in this example takes the form of linear distribution, as it is
distributed around that line.
Ex 3 :
There is a linear relationship :
Ex 4 :
Simple Linear Regression
Mathematical Formulation :
The simple linear regression model is expressed as:
Y = aX i + b + ϵ i
Where:
Y : Dependent variable (response variable) .
X : Independent variable (predictor variable) .
b : Intercept parameter (value of Y when X = 0 ).
a : Slope parameter (change in Y for a one-unit change in X ) .
ϵi : Error term (captures variability not explained by the model ) with mean
2 2
E[ϵ i ] = 0 and variance σ (ϵ i ) = σ .
Error Terms are uncorrelated , so that their covariance is zero ,
Cov(ϵ i , ϵ j ) = 0 for all i ≠ j .
Objective :
^
Estimate b and a such that the difference between observed Y and predicted Y
values is minimized.
This is typically achieved using the Least Squares Method.
Independence :
Observations are independent.
Homoscedasticity :
Normality :
Error terms are normally distributed.
^ ^ ^
Y = aX + b
Where :
^
Y : is the predicted variable .
x̄ : the average of X values .
ȳ : the average of y values .
^ ^
Y − b
X =
^
a
On the other hand, the regression line equation as X is the response variable and
Y is the predictor variable can be written as follows :
X i = cY i + d + ζ i
n n n
n∑ xi yi − ∑ xi ∑ yi
i=1 i=1 i=1
^= ^ ^ȳ
λ = c , δ = d = x̄ − a
n n 2
2
n∑ y − (∑ yi )
i=1 i i=1
^ ^
^ Y + d
X = c.
Where :
^
X : is the predicted variable .
x̄ : the average of X values .
ȳ : the average of y values .
Examples :
Ex 1 :
Ex 2 :
Ex 3 : On the Inverse Prediction