0% found this document useful (0 votes)
214 views72 pages

Linear Regression Explained in Python

The document discusses linear regression using Python. Linear regression finds the relationship between a dependent variable and one or more independent variables. It displays this relationship as a linear equation in the form of y = mx + c, where m is the slope and c is the y-intercept. The goal of linear regression is to minimize the error between the actual observed values and the values predicted by the linear approximation.

Uploaded by

jasti chakradhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
214 views72 pages

Linear Regression Explained in Python

The document discusses linear regression using Python. Linear regression finds the relationship between a dependent variable and one or more independent variables. It displays this relationship as a linear equation in the form of y = mx + c, where m is the slope and c is the y-intercept. The goal of linear regression is to minimize the error between the actual observed values and the values predicted by the linear approximation.

Uploaded by

jasti chakradhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Linear Regression using Python

[Link]
 A technique of finding the relationship between two or
more variables
 Change in dependent variable is associated with a

What is change in one or more independent variables.

Regression?

[Link]
Regression is a technique that displays the relationship
between variable “y” based on the values of variable “x”.

What is For example,.

Regression?

As the temperature drops people put on more jackets to keep warm

[Link]
 Temperature vs. Number of cones sold at ice cream store

 Inches of rain vs. new cars sold

Regression  Daily Snowfall vs. number of skier visits

Use Case
If you think there is a relationship between
two things regression would help confirm it!

[Link]
There are various types of Regression, but we will focus on:

 Linear Regression

Types of  Logistic Regression

Regression

[Link]
LINEAR REGRESSION LOGISTIC REGRESSION

Types of Continuous Variables Categorical Variables

Regression Solves Regression Issue Solves Classification Issue

Straight Line S-Curve

[Link]
 Simple linear regression is useful for finding

relationship between two continuous variables


What is  One is predictor or independent variable and other
Linear is response or dependent variable
Regression?

[Link]
Y

Understandin Line

Dependent Variable
g Linear
Regression

X
Independent Variable

[Link]
Y

Understandin +ve

Dependent Variable
g Linear
Regression

X
Independent Variable

[Link]
Y

Understandin

Dependent Variable
g Linear
Regression
-ve
X
Independent Variable

[Link]
Y

Line
Understandin

Dependent Variable
g Linear
Regression

X
Independent Variable

[Link]
Y
Line of Linear
Regression
Understandin

Dependent Variable
g Linear
Regression

X
Independent Variable

[Link]
Y

Understandin

Dependent Variable
g Linear
Regression Observation

X
Independent Variable

[Link]
Y

Regression Line

Understandin Least Square Method

Dependent Variable
g Linear
Regression

X
Independent Variable

[Link]
Y

error

Understandin Estimated Value

Dependent Variable
g Linear error

Regression
Actual Value

X
Independent Variable

[Link]
Y

Understandin

Dependent Variable
g Linear
Regression
Minimize the
error

X
Independent Variable

[Link]
Y

Understandin +ve Relationship

g Linear

Distance
Regression

X
Speed

[Link]
Y

Understandin y = mx + c

g Linear

Distance
Distance travelled
in a fixed duration

Regression of time

X
Speed

[Link]
Y

Speed of

Understandin
Vehicle

y = mx + c

g Linear

Distance
Regression

X
Speed

[Link]
Y

Understandin y = mx + c

g Linear

Distance
m = +ve slope of line

Regression

X
Speed

[Link]
Y

Understandin y = mx + c

g Linear

Distance
Regression
c = y - intercept of the line

X
Speed

[Link]
Y

Understandin y = - mx + c

g Linear

Time
Time taken to travel
a fixed distance

Regression -ve Relationship

X
Speed

[Link]
Y

Independent Variable

Understandin

Dependent Variable
y = mx + c

g Linear Dependent Variable

Regression

X
Independent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦
Y 1 4
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3

1
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦
Y 1 4
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3

1
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦
Y 1 4
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3

1
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦
Y 1 4
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 mean: 𝒙 3 3.6
18/ mean : 𝒚
5
2

1
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦
y = mx+c 1 4
Y
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 ( , ) mean 3 3.6

1
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦
y = mx+c 1 4
Y
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 ( 3 , 3.6 ) mean

1
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦
y = mx+c 1 4
Y
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥
y = mx+c 1 4
Y
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥
Y
y = mx+c 1 4 1 −3
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥
Y
y = mx+c 1 4 −2
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥
Y
y = mx+c 1 4 −2
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥
Y
y = mx+c 1 4 −2
2 −3
D ependent
Variable 2 3
5 3 4
4 2
4 5 5
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥
Y
y = mx+c 1 4 −2
−1
D ependent
Variable 2 3
5 3 4 0
4 2 1
4 5 5 2
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦
Y
y = mx+c 1 4 −2
−1
D ependent
Variable 2 3
5 3 4 0
4 2 1
44 5 5 2
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦
Y
y = mx+c 1 4 −2 4 −3.6
−1
D ependent
Variable 2 3
5 3 4 0
4 2 1
4 5 5 2
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−
−𝑦
Y
y = mx+c 1 4 −2 0.4
−1
D ependent
Variable 2 3
5 3 4 0
4 2 1
4 5 5 2
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦
Y
y = mx+c 1 4 −2 0.4
−1 3 − 3.6
D ependent
Variable 2 3
5 3 4 0
4 2 1
4 5 5 2
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦
Y
y = mx+c 1 4 −2 0.4
D ependent
Variable 2 3 −1 − 0.6
5 3 4 0 0.4
4 2 1 − 1.6
4 5 5 2 1.4
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑦 2
𝑥 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥
Y
y = mx+c 1 4 −2 0.4 4
D ependent
Variable 2 3 −1 − 0.6 1
5 3 4 0 0.4 0
4 2 1 − 1.6 1
4 5 5 2 1.4 4
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -2 x 0.4
D ependent
Variable 2 3 −1 − 0.6 1
5 3 4 0 0.4 0
4 2 1 − 1.6 1
4 5 5 2 1.4 4
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m=
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦) 1
m= =
1 𝛴 𝑥−𝑥 2 10

X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable 2 3 −1 − 0.6 1 0.6
3.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable 2 3 −1 − 0.6 1 0.6
0.1
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable 2 3 −1 − 0.6 1 0.6
3
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable
3.6 = 0.3 + 𝑐 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable 3.6 − 0.3 = 𝑐 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable
3.3 = 𝑐 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable
3.3 = 𝑐 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1
c=3.3

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
X
0 1 2 3 4 5 6 I ndependent Variable

[Link]
Understanding Linear
Regression
𝑥 𝑦 𝑥−𝑥 𝑦−𝑦 𝑥−𝑥 2 (𝑥 − 𝑥)(𝑦 − 𝑦 )
Y
y = mx+c 1 4 −2 0.4 4 -0.8
D ependent
Variable
3.3 = 𝑐 2 3 −1 − 0.6 1 0.6
5 3 4 0 0.4 0 0
4 2 1 − 1.6 1 -1.6
4 5 5 2 1.4 4 2.8
3 mean 3 3.6 𝛴 = 10 𝛴=1
c=3.3

2 𝛴 (𝑥 − 𝑥)(𝑦 − 𝑦)
m= = 0.1
1 𝛴 𝑥−𝑥 2
Equation of Regression line for m = 0.1, c = 3.3 is:
X
0 1 2 3 4 5 6 I ndependent Variable
y = 0.1x+3.3

[Link]
Mean Square Error

m = 0.1
Y
D ependent c = 3.3
Variable
y = 0.1x + 3.3
5
For given m = 0.1 & c = 3.3 ,
4 Lets predict values for y when
x = {1,2,3,4,5}
3
y = 0.1 x 1+ 3.3 = 3.2
y = 0.1 x 2+ 3.3= 3.1
2 y = 0.1 x 3+ 3.3= 3.0
y = 0.1 x 4+ 3.3= 2.9
y = 0.1 x 5+ 3.3= 2.8
1

X I ndependent
Variable
0 1 2 3 4 5 6
[Link]
Mean Square Error

m = 0.1
Y
D ependent c = 3.3
Variable
y = 0.1x + 3.3
5
For given m = 0.1 & c = 3.3 ,
4 L ine of Regression
Lets predict values for y when
x = {1,2,3,4,5}
3
y = 0.1 x 1+ 3.3 = 3.2
y = 0.1 x 2+ 3.3= 3.1
2 y = 0.1 x 3+ 3.3= 3.0
y = 0.1 x 4+ 3.3= 2.9
y = 0.1 x 5+ 3.3= 2.8
1

X I ndependent
Variable
0 1 2 3 4 5 6
[Link]
Finding the best Fit Line

[Link]
Goodness of Fit – 𝑹𝟐
𝑥 𝑦𝑝
Y 1 3.2
D ependent
Variable 2 3.1
5 3 3.0
4 2.9
4 L ine of Regression
5 2.8
3

𝑅2 =
𝛴 (Predicted Distance – Mean)2

2 𝛴 (Actual Distance – Mean) 2

1 𝛴 𝑦𝑝 − 𝑦
2

𝑅2 =
X I ndependent 𝛴 𝑦−𝑦 2
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑥 𝑦 𝑦𝑝 (𝑦𝑝 − 𝑦)
Y 1 4 3.2 3.2-3.6
D ependent
Variable 2 3 3.1
5 3 4 3.0
4 2 2.9
4 L ine of Regression
5 5 2.8
3

1 𝛴 𝑦𝑝 − 𝑦
2

𝑅2 =
X I ndependent 𝛴 𝑦−𝑦 2
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑥 𝑦 𝑦𝑝 (𝑦𝑝 − 𝑦) (𝑦 − 𝑦)
Y 1 4 3.2 -0.4 4 – 3.6
D ependent
Variable 2 3 3.1 -0.5
5 3 4 3.0 -0.6
4 2 2.9 -0.7
4 L ine of Regression
5 5 2.8 -0.8
3

1 𝛴 𝑦𝑝 − 𝑦
2

𝑅2 =
X I ndependent 𝛴 𝑦−𝑦 2
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑥 𝑦 𝑦𝑝 (𝑦𝑝 − 𝑦) (𝑦 − 𝑦)
Y 1 4 3.2 -0.4 0.4
D ependent
Variable 2 3 3.1 -0.5 -0.6
5 3 4 3.0 -0.6 0.4
4 2 2.9 -0.7 -1.6
4 L ine of Regression
5 5 2.8 -0.8 1.4

1 𝛴 𝑦𝑝 − 𝑦
2

𝑅2 =
X I ndependent 𝛴 𝑦−𝑦 2
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑦𝑝 (𝑦𝑝 − 𝑦) (𝑦 − 𝑦) 𝑦𝑝 − 𝑦
2

2
Y
D ependent
3.2 -0.4 0.4 −0.4
Variable 3.1 -0.5 -0.6
5 3.0 -0.6 0.4
L ine of Regression
2.9 -0.7 -1.6
4
2.8 -0.8 1.4

1 𝛴 𝑦𝑝 − 𝑦
2

𝑅2 =
X I ndependent 𝛴 𝑦−𝑦 2
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑦𝑝 (𝑦𝑝 − 𝑦) (𝑦 − 𝑦) 𝑦𝑝 − 𝑦
2

Y 3.2 -0.4 0.4 0.16


D ependent
Variable 3.1 -0.5 -0.6 0.25
5 3.0 -0.6 0.4 0.36
2.9 -0.7 -1.6 0.49
4 L ine of Regression

2.8 -0.8 1.4 0.64


3

1 𝛴 𝑦𝑝 − 𝑦
2

𝑅2 =
X I ndependent 𝛴 𝑦−𝑦 2
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑦𝑝 (𝑦𝑝 − 𝑦) (𝑦 − 𝑦) 𝑦𝑝 − 𝑦
2
𝑦 −𝑦 2

2
Y 3.2 -0.4 0.4 0.16 0.4
D ependent
Variable 3.1 -0.5 -0.6 0.25
5 3.0 -0.6 0.4 0.36
2.9 -0.7 -1.6 0.49
4 L ine of Regression

2.8 -0.8 1.4 0.64


3

1 𝛴 𝑦𝑝 − 𝑦
2

𝑅2 =
X I ndependent 𝛴 𝑦−𝑦 2
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑦𝑝 (𝑦𝑝 − 𝑦) (𝑦 − 𝑦) 𝑦𝑝 − 𝑦
2
𝑦 −𝑦 2

Y 3.2 -0.4 0.4 0.16 0.16


D ependent
Variable 3.1 -0.5 -0.6 0.25 0.36
5 3.0 -0.6 0.4 0.36 0.16
2.9 -0.7 -1.6 0.49 2.56
4 L ine of Regression

2.8 -0.8 1.4 0.64 1.96

1 𝛴 𝑦𝑝 − 𝑦
2

𝑅2 =
X I ndependent 𝛴 𝑦−𝑦 2
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑦𝑝 (𝑦𝑝 − 𝑦) (𝑦 − 𝑦) 𝑦𝑝 − 𝑦
2
𝑦 −𝑦 2

Y 3.2 -0.4 0.4 0.16 0.16


D ependent
Variable 3.1 -0.5 -0.6 0.25 0.36
5 3.0 -0.6 0.4 0.36 0.16
2.9 -0.7 -1.6 0.49 2.56
4 L ine of Regression

2.8 -0.8 1.4 0.64 1.96

3 𝛴 1.9
𝛴 5.2

𝑅 2
=
𝛴 𝑦𝑝 − 𝑦
2

=
1.9
1 𝛴 𝑦−𝑦 2 5.2

X I ndependent
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐
𝑦𝑝 (𝑦𝑝 − 𝑦) (𝑦 − 𝑦) 𝑦𝑝 − 𝑦
2
𝑦 −𝑦 2

Y 3.2 -0.4 0.4 0.16 0.16


D ependent
Variable 3.1 -0.5 -0.6 0.25 0.36
5 3.0 -0.6 0.4 0.36 0.16
2.9 -0.7 -1.6 0.49 2.56
4 L ine of Regression

2.8 -0.8 1.4 0.64 1.96

3 𝛴 1.9
𝛴 5.2

𝑅2 =
𝛴 𝑦𝑝 − 𝑦
2

= 0.36
1 𝛴 𝑦−𝑦 2

X I ndependent
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐

Actual vs Predicted Value


Y
D ependent
Variable

4 L ine of Regression
𝑅2 ≈ 0.6
3

X I ndependent
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐

Actual vs Predicted Value


Y
D ependent
Variable

4 L ine of Regression
𝑅2 ≈ 0.9

X I ndependent
Variable
0 1 2 3 4 5 6
[Link]
Goodness of Fit – 𝑹𝟐

Actual vs Predicted Value


Y
D ependent
Variable

4 𝑅2 ≈ 1
L ine of Regression

I ndependent
Variable
X
0 1 2 3 4 5 6
[Link]
[Link]

India : +91-7847955955

US : 1-800-216-8930 (TOLL FREE)

sales@[Link]

[Link]

You might also like