0% found this document useful (0 votes)
13 views16 pages

Linear Regression

Uploaded by

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

Linear Regression

Uploaded by

Neeraja Bhukya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Linear regression

• Linear regression is a linear approach to modeling


the relationship between the dependent and one
or more independent variables
• It works on supervised data set
• Examples:
• Insurance
• Real estate
• business
• Weather prediction
• Dependent variable: dependent variables also
known as response variables,regressed
variables, predicted variables, target variables,
output variables. Denoted as variables Y.
• Independent variables: this is also known as
predictor variables,regressor variables,
exploratory variables or simply input variables
denoted as variable X
• Regression analysis:
• Is there any relationship between these
variables
• Is the relationship linear and how strong is the
relationship
• How accurately can we estimate the
relationship
• How good is the model for prediction purposes
Regression process
start

Choose a set of variables, form


Formulate the problem
model , specific assumptions

Fit the model Use method of fitting

Residual plots, outliers detection,


Validate assumptions sensitivity analysis

no ok

yes

Evaluate fitted model Goodness of fit tests

no ok yes Use the model for intended


stop
• The linear regression model provides a sloped
straight line representing the relationship
between the variables.
• Mathematically linear regressin is represented
as
• Y=a0+a1X+e
Linear regression line
• A linear line showing the relationship between
the dependent and independent variables is
called a regression line. A regression line can
show two types of relationship:
• Positive Linear Relationship:
If the dependent variable increases on the Y-
axis and independent variable increases on X-
axis, then such a relationship is termed as a
Positive linear relationship.
Y

+line of regression

• Equation Y=a0+a1X
• Negative Linear Relationship:
If the dependent variable decreases on the Y-axis
and independent variable increases on the X-axis,
then such a relationship is called a negative linear
relationship.
• Equation Y=-a0+a1x
Y
- ve line of regression

y
• Finding the best fit line:
• When working with linear regression, our main goal is
to find the best fit line that means the error between
predicted values and actual values should be
minimized. The best fit line will have the least error.
• The different values for weights or the coefficient of
lines (a0, a1) gives a different line of regression, so we
need to calculate the best values for a0 and a1 to find
the best fit line, so to calculate this we use cost
function.
• Cost function-
• The different values for weights or coefficient of
lines (a0, a1) gives the different line of regression,
and the cost function is used to estimate the
values of the coefficient for the best fit line.
• For Linear Regression, we use the Mean Squared
Error (MSE) cost function, which is the average
of squared error occurred between the predicted
values and actual values. It can be written as:
example
s.no Age (X) Glucose levels (Y)
1 43 99
2 21 65
3 25 79
4 42 75
5 57 87
6 59 81
7 55 ?
• Equation Y=a0+a1X
• A0=(Σy)(Σx²)-(Σx)(Σxy)
n(Σx²)-(Σx)²

• A1=n(Σxy)-(Σx)(Σy)
n(Σx²)-(Σx)²
s.No Age (X) Glucose level XY x²
(Y)
1 43 99 4257 9801
2 21 65 1365 4225
3 25 79 1975 6241
4 42 75 3150 5625
5 57 87 4959 7569
6 59 81 4779 6561
247 486 20485 40022
• Step 2 :
• a0=65.14
• a1=0.385335
• Step 3: insert the values in the equation
• Y=65.14+0.385335 X
• Step 4: predict the value of Y for the given value of X=55
• Y=65.14+0.385335 * 55
• Y=86.327
• Hence the glucose level for the given age 55 is 86.327

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy