SlideShare a Scribd company logo
1 of 10
Linear regression Ryan Sain, Ph.D.
Regression Introduced Regression is about prediction Predicting an unknown point based on observations (or measurements) Widgets sold based on advertising We can explore known relationships We can explore unknown relationships
The Variables Outcome Variable The thing we are predicting Number of widgets sold Predictor Variable (simple regression) The variables that you know about Advertising dollars Predictor Variables (multiple regression) We predict values of a dependent variable (outcome) using one or more independent variables (predictors)
The model Any prediction follows the basic formula: Outcomei = (model) + errori In regression our model contains several things: Slope of the line (that best fits the data measured) = b1 Intercept of the line (at the Y axis) b0  So our model = Yi = (b0 + b1Xi) + Errori Do you recognize this equation? The model is simply a line
So how do we calculate this line? The Method of Least Squares The line that is the closest to all the data points Residuals = Deviations (distance of actual data points to the line) Square these residuals to get rid of negatives Then sum them.
How well does this line fit? No line is perfect (there are always residuals) If our line is a good one it should be better than a basic line (significantly so) We compare our line to a basic line: Deviation = SUM (observed – model)2 This is basically a ‘mean’ (model) The mean is an awful predictor No matter how much you spend on adverts – the sales of your widgets are the same
Fitness continued SSt = total sum of squared differences (using the mean) SSr= total residual sum of squares (using our best fit model) Represents a degree of inaccuracy SSm (model sum of squares) = SSt – SSr Large = our model is different than the simple model Proportion of improvement: R2 = SSm/ SSt Percentage of variation in the outcome that can be explained by our model
More fitness You can assess this using an F test as well F is simply systematic variance/unsystematic variance In regression that means: Improvement of the model (SSm - systematic) and the difference between the model and the observed data (SSr – unsystematic) But we need to look at mean squares Because we need to use the average sums of squares in an F test. So we divide by degrees of freedom For SSm = the number of variables in the model For SSr = number of observations – the number of parameters being estimated (number of beta coefficients or predictors) F = MSM / MSR
Individual Predictors The coefficient bis essentially the gradient of the line If the predictor is not valuable then it will predict no change in the outcome as it changes.  This would be b= 0  This is what the mean does If the predictor is valuable – then it will be significantly different than 0.
Individual Predictors cont. To test if b is different from 0 we will use a t-test. We are comparing how big the b value is in comparison to the amount of error in that estimate. We will then use the standard error of the bvalue.  t = bobserved – bexpected / SEb Since the expected value is 0 (no change) then we have to simply divide the observed b value by the standard error of b to get the t score. Degress of freedom is calculated using the following: N – p – 1 (p = number of predictors)

More Related Content

What's hot (7)

12 13 h2_measurement_ppt
12 13 h2_measurement_ppt12 13 h2_measurement_ppt
12 13 h2_measurement_ppt
 
50g working with matricies
50g  working with matricies50g  working with matricies
50g working with matricies
 
2.2 measurements, estimations and errors(part 2)
2.2   measurements, estimations and errors(part 2)2.2   measurements, estimations and errors(part 2)
2.2 measurements, estimations and errors(part 2)
 
1.2.3 solving linear equations (multiple unknowns)
1.2.3  solving linear equations (multiple unknowns)1.2.3  solving linear equations (multiple unknowns)
1.2.3 solving linear equations (multiple unknowns)
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Gang-Of-Four State Pattern
Gang-Of-Four State PatternGang-Of-Four State Pattern
Gang-Of-Four State Pattern
 
LISP: Errors In Lisp
LISP: Errors In LispLISP: Errors In Lisp
LISP: Errors In Lisp
 

Viewers also liked

Simple Linier Regression
Simple Linier RegressionSimple Linier Regression
Simple Linier Regression
dessybudiyanti
 
Nonparametric tests
Nonparametric testsNonparametric tests
Nonparametric tests
Arun Kumar
 
Simple Linear Regression
Simple Linear RegressionSimple Linear Regression
Simple Linear Regression
Sharlaine Ruth
 
Parametric tests seminar
Parametric tests seminarParametric tests seminar
Parametric tests seminar
drdeepika87
 
Simple linear regression (final)
Simple linear regression (final)Simple linear regression (final)
Simple linear regression (final)
Harsh Upadhyay
 

Viewers also liked (12)

Simple Linier Regression
Simple Linier RegressionSimple Linier Regression
Simple Linier Regression
 
Simple Linear Regression (simplified)
Simple Linear Regression (simplified)Simple Linear Regression (simplified)
Simple Linear Regression (simplified)
 
Nonparametric tests
Nonparametric testsNonparametric tests
Nonparametric tests
 
Simple Linear Regression
Simple Linear RegressionSimple Linear Regression
Simple Linear Regression
 
Parametric tests seminar
Parametric tests seminarParametric tests seminar
Parametric tests seminar
 
Non parametric tests
Non parametric testsNon parametric tests
Non parametric tests
 
Berd 5-6
Berd 5-6Berd 5-6
Berd 5-6
 
Parametric vs Nonparametric Tests: When to use which
Parametric vs Nonparametric Tests: When to use whichParametric vs Nonparametric Tests: When to use which
Parametric vs Nonparametric Tests: When to use which
 
Simple linear regression (final)
Simple linear regression (final)Simple linear regression (final)
Simple linear regression (final)
 
Non-Parametric Tests
Non-Parametric TestsNon-Parametric Tests
Non-Parametric Tests
 
Reporting a single linear regression in apa
Reporting a single linear regression in apaReporting a single linear regression in apa
Reporting a single linear regression in apa
 
DIstinguish between Parametric vs nonparametric test
 DIstinguish between Parametric vs nonparametric test DIstinguish between Parametric vs nonparametric test
DIstinguish between Parametric vs nonparametric test
 

Similar to Linear regression

Building a Regression Model using SPSS
Building a Regression Model using SPSSBuilding a Regression Model using SPSS
Building a Regression Model using SPSS
Zac Bodner
 
Linear Regression
Linear RegressionLinear Regression
Linear Regression
Abdullah al Mamun
 
Linear functions and modeling
Linear functions and modelingLinear functions and modeling
Linear functions and modeling
IVY SOLIS
 

Similar to Linear regression (20)

Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)
 
Regression Analysis presentation by Al Arizmendez and Cathryn Lottier
Regression Analysis presentation by Al Arizmendez and Cathryn LottierRegression Analysis presentation by Al Arizmendez and Cathryn Lottier
Regression Analysis presentation by Al Arizmendez and Cathryn Lottier
 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriously
 
Detail Study of the concept of Regression model.pptx
Detail Study of the concept of  Regression model.pptxDetail Study of the concept of  Regression model.pptx
Detail Study of the concept of Regression model.pptx
 
SEM
SEMSEM
SEM
 
What is Isotonic Regression and How Can a Business Utilize it to Analyze Data?
What is Isotonic Regression and How Can a Business Utilize it to Analyze Data?What is Isotonic Regression and How Can a Business Utilize it to Analyze Data?
What is Isotonic Regression and How Can a Business Utilize it to Analyze Data?
 
Chapter 14 Part I
Chapter 14 Part IChapter 14 Part I
Chapter 14 Part I
 
Structural equation modeling in amos
Structural equation modeling in amosStructural equation modeling in amos
Structural equation modeling in amos
 
HRUG - Linear regression with R
HRUG - Linear regression with RHRUG - Linear regression with R
HRUG - Linear regression with R
 
MF Presentation.pptx
MF Presentation.pptxMF Presentation.pptx
MF Presentation.pptx
 
Building a Regression Model using SPSS
Building a Regression Model using SPSSBuilding a Regression Model using SPSS
Building a Regression Model using SPSS
 
statistical learning theory
statistical learning theorystatistical learning theory
statistical learning theory
 
Gradient Decent in Linear Regression.pptx
Gradient Decent in Linear Regression.pptxGradient Decent in Linear Regression.pptx
Gradient Decent in Linear Regression.pptx
 
Linear Regression
Linear RegressionLinear Regression
Linear Regression
 
Simple Linear Regression: Step-By-Step
Simple Linear Regression: Step-By-StepSimple Linear Regression: Step-By-Step
Simple Linear Regression: Step-By-Step
 
Multiple Linear Regression
Multiple Linear Regression Multiple Linear Regression
Multiple Linear Regression
 
Interpreting Regression Results - Machine Learning
Interpreting Regression Results - Machine LearningInterpreting Regression Results - Machine Learning
Interpreting Regression Results - Machine Learning
 
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsData Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
 
Statistics for ess
Statistics for essStatistics for ess
Statistics for ess
 
Linear functions and modeling
Linear functions and modelingLinear functions and modeling
Linear functions and modeling
 

More from Ryan Sain

324 12 3 special topics tool use language
324 12 3 special topics tool use language324 12 3 special topics tool use language
324 12 3 special topics tool use language
Ryan Sain
 
324 12 2 special topics timing
324 12 2 special topics timing324 12 2 special topics timing
324 12 2 special topics timing
Ryan Sain
 
324 12 part 1 special topics food caching
324 12 part 1 special topics food caching324 12 part 1 special topics food caching
324 12 part 1 special topics food caching
Ryan Sain
 
324 10 observational learning
324 10 observational learning324 10 observational learning
324 10 observational learning
Ryan Sain
 
324 09 avoidance
324 09 avoidance324 09 avoidance
324 09 avoidance
Ryan Sain
 
324 7 part 2 extinction
324 7 part 2 extinction 324 7 part 2 extinction
324 7 part 2 extinction
Ryan Sain
 
324 06 stimulus control
324 06 stimulus control324 06 stimulus control
324 06 stimulus control
Ryan Sain
 

More from Ryan Sain (20)

Psyc 321_14 surveys
Psyc 321_14 surveysPsyc 321_14 surveys
Psyc 321_14 surveys
 
Psyc 321_13 ethics
Psyc 321_13 ethicsPsyc 321_13 ethics
Psyc 321_13 ethics
 
Psyc 321_12 small n research
Psyc 321_12 small n researchPsyc 321_12 small n research
Psyc 321_12 small n research
 
Psyc 321_11 quasi experimentation
Psyc 321_11 quasi experimentationPsyc 321_11 quasi experimentation
Psyc 321_11 quasi experimentation
 
psyc 321_10 experimental ecology
psyc 321_10 experimental ecologypsyc 321_10 experimental ecology
psyc 321_10 experimental ecology
 
Psyc 321_09 within groups
Psyc 321_09 within groupsPsyc 321_09 within groups
Psyc 321_09 within groups
 
Psyc 321_07 control
Psyc 321_07 controlPsyc 321_07 control
Psyc 321_07 control
 
psyc 321_06 threats to validity and control
psyc 321_06 threats to validity and controlpsyc 321_06 threats to validity and control
psyc 321_06 threats to validity and control
 
Psyc 321_05 introduction to stats
Psyc 321_05 introduction to statsPsyc 321_05 introduction to stats
Psyc 321_05 introduction to stats
 
Psyc 321_04 numerical description
Psyc 321_04 numerical descriptionPsyc 321_04 numerical description
Psyc 321_04 numerical description
 
Psyc 321_03 hypotheses
Psyc 321_03 hypothesesPsyc 321_03 hypotheses
Psyc 321_03 hypotheses
 
Psyc 321_02 methods of_science
Psyc 321_02 methods of_sciencePsyc 321_02 methods of_science
Psyc 321_02 methods of_science
 
Psyc 321_01 what is science
Psyc 321_01 what is sciencePsyc 321_01 what is science
Psyc 321_01 what is science
 
324 12 3 special topics tool use language
324 12 3 special topics tool use language324 12 3 special topics tool use language
324 12 3 special topics tool use language
 
324 12 2 special topics timing
324 12 2 special topics timing324 12 2 special topics timing
324 12 2 special topics timing
 
324 12 part 1 special topics food caching
324 12 part 1 special topics food caching324 12 part 1 special topics food caching
324 12 part 1 special topics food caching
 
324 10 observational learning
324 10 observational learning324 10 observational learning
324 10 observational learning
 
324 09 avoidance
324 09 avoidance324 09 avoidance
324 09 avoidance
 
324 7 part 2 extinction
324 7 part 2 extinction 324 7 part 2 extinction
324 7 part 2 extinction
 
324 06 stimulus control
324 06 stimulus control324 06 stimulus control
324 06 stimulus control
 

Recently uploaded

Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
fonyou31
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Recently uploaded (20)

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 

Linear regression

  • 2. Regression Introduced Regression is about prediction Predicting an unknown point based on observations (or measurements) Widgets sold based on advertising We can explore known relationships We can explore unknown relationships
  • 3. The Variables Outcome Variable The thing we are predicting Number of widgets sold Predictor Variable (simple regression) The variables that you know about Advertising dollars Predictor Variables (multiple regression) We predict values of a dependent variable (outcome) using one or more independent variables (predictors)
  • 4. The model Any prediction follows the basic formula: Outcomei = (model) + errori In regression our model contains several things: Slope of the line (that best fits the data measured) = b1 Intercept of the line (at the Y axis) b0 So our model = Yi = (b0 + b1Xi) + Errori Do you recognize this equation? The model is simply a line
  • 5. So how do we calculate this line? The Method of Least Squares The line that is the closest to all the data points Residuals = Deviations (distance of actual data points to the line) Square these residuals to get rid of negatives Then sum them.
  • 6. How well does this line fit? No line is perfect (there are always residuals) If our line is a good one it should be better than a basic line (significantly so) We compare our line to a basic line: Deviation = SUM (observed – model)2 This is basically a ‘mean’ (model) The mean is an awful predictor No matter how much you spend on adverts – the sales of your widgets are the same
  • 7. Fitness continued SSt = total sum of squared differences (using the mean) SSr= total residual sum of squares (using our best fit model) Represents a degree of inaccuracy SSm (model sum of squares) = SSt – SSr Large = our model is different than the simple model Proportion of improvement: R2 = SSm/ SSt Percentage of variation in the outcome that can be explained by our model
  • 8. More fitness You can assess this using an F test as well F is simply systematic variance/unsystematic variance In regression that means: Improvement of the model (SSm - systematic) and the difference between the model and the observed data (SSr – unsystematic) But we need to look at mean squares Because we need to use the average sums of squares in an F test. So we divide by degrees of freedom For SSm = the number of variables in the model For SSr = number of observations – the number of parameters being estimated (number of beta coefficients or predictors) F = MSM / MSR
  • 9. Individual Predictors The coefficient bis essentially the gradient of the line If the predictor is not valuable then it will predict no change in the outcome as it changes. This would be b= 0 This is what the mean does If the predictor is valuable – then it will be significantly different than 0.
  • 10. Individual Predictors cont. To test if b is different from 0 we will use a t-test. We are comparing how big the b value is in comparison to the amount of error in that estimate. We will then use the standard error of the bvalue. t = bobserved – bexpected / SEb Since the expected value is 0 (no change) then we have to simply divide the observed b value by the standard error of b to get the t score. Degress of freedom is calculated using the following: N – p – 1 (p = number of predictors)