Least-Squares Regression

Similar documents
Least-Squares Regression

Response Variable denoted by y it is the variable that is to be predicted measure of the outcome of an experiment also called the dependent variable

a is some real number (called the coefficient) other

II. Descriptive Statistics D. Linear Correlation and Regression. 1. Linear Correlation

STP 226 ELEMENTARY STATISTICS

Correlation Regression

Linear Regression Models

Lecture 6 Chi Square Distribution (χ 2 ) and Least Squares Fitting

Linear Regression Analysis. Analysis of paired data and using a given value of one variable to predict the value of the other

Lecture 6 Chi Square Distribution (χ 2 ) and Least Squares Fitting

The Method of Least Squares. To understand least squares fitting of data.

Correlation and Covariance

Census. Mean. µ = x 1 + x x n n

Section 14. Simple linear regression.

First, note that the LS residuals are orthogonal to the regressors. X Xb X y = 0 ( normal equations ; (k 1) ) So,

Regression and Correlation

University of California, Los Angeles Department of Statistics. Simple regression analysis

Simple Linear Regression

multiplies all measures of center and the standard deviation and range by k, while the variance is multiplied by k 2.

STP 226 EXAMPLE EXAM #1

Chapters 5 and 13: REGRESSION AND CORRELATION. Univariate data: x, Bivariate data (x,y).

REGRESSION (Physics 1210 Notes, Partial Modified Appendix A)

Correlation and Regression

1 Inferential Methods for Correlation and Regression Analysis

9. Simple linear regression G2.1) Show that the vector of residuals e = Y Ŷ has the covariance matrix (I X(X T X) 1 X T )σ 2.

Linear Regression Demystified

Summary: CORRELATION & LINEAR REGRESSION. GC. Students are advised to refer to lecture notes for the GC operations to obtain scatter diagram.

ST 305: Exam 3 ( ) = P(A)P(B A) ( ) = P(A) + P(B) ( ) = 1 P( A) ( ) = P(A) P(B) σ X 2 = σ a+bx. σ ˆp. σ X +Y. σ X Y. σ X. σ Y. σ n.

3/3/2014. CDS M Phil Econometrics. Types of Relationships. Types of Relationships. Types of Relationships. Vijayamohanan Pillai N.

11 Correlation and Regression

Regression, Inference, and Model Building

Regression and correlation

Zeros of Polynomials

TMA4245 Statistics. Corrected 30 May and 4 June Norwegian University of Science and Technology Department of Mathematical Sciences.

The Poisson Distribution

Stat 139 Homework 7 Solutions, Fall 2015

S Y Y = ΣY 2 n. Using the above expressions, the correlation coefficient is. r = SXX S Y Y

Statistical Properties of OLS estimators

Ismor Fischer, 1/11/

Chapter Objectives. Bivariate Data. Terminology. Lurking Variable. Types of Relations. Chapter 3 Linear Regression and Correlation

(all terms are scalars).the minimization is clearer in sum notation:

Simple Regression. Acknowledgement. These slides are based on presentations created and copyrighted by Prof. Daniel Menasce (GMU) CS 700

ECE 8527: Introduction to Machine Learning and Pattern Recognition Midterm # 1. Vaishali Amin Fall, 2015

How to Maximize a Function without Really Trying

Polynomial Functions and Their Graphs

SIMPLE LINEAR REGRESSION AND CORRELATION ANALYSIS

MEI Casio Tasks for Further Pure

3.2 Properties of Division 3.3 Zeros of Polynomials 3.4 Complex and Rational Zeros of Polynomials

MATH CALCULUS II Objectives and Notes for Test 4

ECON 3150/4150, Spring term Lecture 3

Outline. Linear regression. Regularization functions. Polynomial curve fitting. Stochastic gradient descent for regression. MLE for regression

Chapter 12 Correlation

EXAMINATIONS OF THE ROYAL STATISTICAL SOCIETY

DAWSON COLLEGE DEPARTMENT OF MATHEMATICS 201-BZS-05 PROBABILITY AND STATISTICS FALL 2015 FINAL EXAM

TABLES AND FORMULAS FOR MOORE Basic Practice of Statistics

CHAPTER SUMMARIES MAT102 Dr J Lubowsky Page 1 of 13 Chapter 1: Introduction to Statistics

Paired Data and Linear Correlation

Price per tonne of sand ($) A B C

CEE 522 Autumn Uncertainty Concepts for Geotechnical Engineering

Assessment and Modeling of Forests. FR 4218 Spring Assignment 1 Solutions

Precalculus MATH Sections 3.1, 3.2, 3.3. Exponential, Logistic and Logarithmic Functions

CHAPTER 8 FUNDAMENTAL SAMPLING DISTRIBUTIONS AND DATA DESCRIPTIONS. 8.1 Random Sampling. 8.2 Some Important Statistics

Geometry of LS. LECTURE 3 GEOMETRY OF LS, PROPERTIES OF σ 2, PARTITIONED REGRESSION, GOODNESS OF FIT

Final Examination Solutions 17/6/2010

Dealing with Data and Fitting Empirically

Lecture 11 Simple Linear Regression

Curve Sketching Handout #5 Topic Interpretation Rational Functions

BIOS 4110: Introduction to Biostatistics. Breheny. Lab #9

Correlation. Two variables: Which test? Relationship Between Two Numerical Variables. Two variables: Which test? Contingency table Grouped bar graph

Chapter If n is odd, the median is the exact middle number If n is even, the median is the average of the two middle numbers

Algebra of Least Squares

For example suppose we divide the interval [0,2] into 5 equal subintervals of length

x c the remainder is Pc ().

1988 AP Calculus BC: Section I

Analysis of Experimental Data

MATH 320: Probability and Statistics 9. Estimation and Testing of Parameters. Readings: Pruim, Chapter 4

Regression, Part I. A) Correlation describes the relationship between two variables, where neither is independent or a predictor.

independence of the random sample measurements, we have U = Z i ~ χ 2 (n) with σ / n 1. Now let W = σ 2. We then have σ 2 (x i µ + µ x ) 2 i =1 ( )

Overview. p 2. Chapter 9. Pooled Estimate of. q = 1 p. Notation for Two Proportions. Inferences about Two Proportions. Assumptions

Lecture 7: Density Estimation: k-nearest Neighbor and Basis Approach

DETERMINATION OF MECHANICAL PROPERTIES OF A NON- UNIFORM BEAM USING THE MEASUREMENT OF THE EXCITED LONGITUDINAL ELASTIC VIBRATIONS.

TEACHER CERTIFICATION STUDY GUIDE

MATH/STAT 352: Lecture 15

Chapter 4 - Summarizing Numerical Data

University of California, Los Angeles Department of Statistics. Hypothesis testing

LINEAR REGRESSION ANALYSIS. MODULE IX Lecture Multicollinearity

Name Date MIDTERM REVIEW II: SYSTEM OF EQUATIONS & INEQUALITIES, FUNCTIONS, LINE REGRESSION, AND LINEAR EQUATIONS

1 Review of Probability & Statistics

NUMERICAL METHODS FOR SOLVING EQUATIONS

Chapter 1 (Definitions)

Maximum and Minimum Values

Statistics 203 Introduction to Regression and Analysis of Variance Assignment #1 Solutions January 20, 2005

Chapter 8: Estimating with Confidence

Direction: This test is worth 250 points. You are required to complete this test within 50 minutes.

CALCULUS BASIC SUMMER REVIEW

1036: Probability & Statistics

Gotta Keep It Correlatin

Confidence Intervals for the Population Proportion p

Topic 10: Introduction to Estimation

Topic 9: Sampling Distributions of Estimators

Transcription:

MATH 482 Least-Squares Regressio Dr. Neal, WKU As well as fidig the correlatio of paired sample data {{ x 1, y 1 }, { x 2, y 2 },..., { x, y }}, we also ca plot the data with a scatterplot ad fid the least squares regressio lie through the data. This lie, deoted y = a x + b, provides a approximate liear fuctioal relatioship betwee the values of x i ad y i. Of course, it is oly a good fit if the correlatio is ear ±1, which meas that there is a strog liear depedece betwee the measuremets X ad Y. The slope a is give by a = x y x y x 2 x 2, where x y = 1 x i y i ad x 2 = 1 x 2 i = 1 i. i = 1 After the slope a is calculated, the the itercept b is give by b = y a x. The we have y = a x + b. Theorem. The least squares lie is the lie that miimizes the sum of squared errors betwee the actual y i values ad the liear approximatios a x i + b. That is, the sum (a x i + b y i ) 2 is miimized with these choices of a ad b. Proof. Let f (a,b) = (a x i + b y i ) 2. We take the first partial derivatives with respect to a ad b, equate them to 0, the solve for a ad b. First, 0 = f b = 2(a x i + b y i ) which gives 0 = a x i + b y i = a x + b y. Solvig for b gives b = y a x. i= 1 i=1 Note that the 2d derivative of f with respect to b equals 2 which is always positive. Thus the critical poit of b = y a x does yield a miimum value by the 2d deriv. test. Next, we have 0 = f a = 2(a x 2 i + b y i )x i = 2a x i + 2b x i 2 x i y i = 2a x 2 + 2b x 2x y. i=1 Thus, 0 = a x 2 + b x x y = a x 2 + (y a x ) x x y. Solvig for a gives a = x y x y x 2 x 2. Now the 2d derivative of f with respect to a equals 2 x 2 So the critical poit value for a does yield a miimum value. which is always positive.

To compute both the sample correlatio r ad the least-squares lie o a TI, eter paired data ito lists L1 ad L2 (or some other pair of lists), press STAT, scroll to CALC, press 4 for LiReg(ax+b), the eter the commad LiReg(ax+b) L1, L2. Some Other Quick Facts 1. The poit ( x, y ) is always o the least-squares regressio lie. 2. The slope of the least-squares regressio lie also is give by a = r σ Y, where σ X r = x y x y = x y x y x 2 x 2 y 2 y 2 σ, ad σ X σ X = Y x 2 x 2, ad σ Y = y 2 y 2. 3. The value r 2 is the coefficiet of determiatio. It measures the proportio of the observed values accouted for by the regressio fit. Because 0 r 2 1, a r 2 ear 1 meas that there is a strog fit, ad a r 2 ear 0 meas that there is virtually o fit of the data. Examples. (i) Make a scatterplot; (ii) Compute r ad explai what it meas; (iii) Fid the equatio of the least-squares regressio lie ad graph it through the scatterplot. (iv) Explai what r 2 meas i each case. 1. Aalyze the relatioship betwee the tar ad icotie levels i cigarettes. Brad Tar (mg) Nicotie (mg) Alpie 14.1 0.86 Beso & Hedges 16.0 1.06 Bull Durham 29.8 2.03 Camel Lights 8.0 0.67 Carlto 4.1 0.40 Chesterfield 15.0 1.04 Golde Lights 8.8 0.76 Ket 12.4 0.95 Kool 16.6 1.12 L&M 14.9 1.02 STAT EDIT STAT PLOT Adjust Settigs ZOOM 9 We see a geeral tred: As the tar level icreases, the icotie level seems to icrease.

STAT CALC Eter commad r 0.9871 Because r 0.9871 is so close to +1, there is a strog positive liear relatioship betwee tar ad icotie. As the tar level icreases, the icotee level teds to icrease liearly. The least-squares regressio lie is give by y = a x + b 0.0610475 x + 0.138167. Due to the close fit, this liear fuctio could be used to predict a icotie level y for a give tar level x. For istace, if x = 20 mg of tar, the y 1.359 mg of icotie. Y= From VARS STATISTICS EQ Press ENTER From CALC (2d TRACE) value, X = 20 Here r 2 0.974. Usig the lie y = 0. 0610475 x + 0.138167 as a predictor, icotie level is 97.4% determied by tar level ad 2.6% determied by other factors. 2. If a perso has high body desity, the they should have less body fat. The followig data lists measuremets of body desities ad percetages of body fat from a radom sample of people. Is the relatioship observable? Perso Body Desity Body Fat 1. 1.0708 12.6% 2. 1.0751 10.9% 3. 1.0549 19% 4. 1.0722 12% 5. 1.0622 16.1% 6. 1.0668 14.2% 7. 1.079 9.4% 8. 1.0775 9.9% 9. 1.055 19% 10. 1.0416 24.5% STAT EDIT STAT PLOT Adjust Settigs ZOOM 9 We see the strog tred: As body desity icreases, the body fat decreases.

STAT CALC Eter commad r 0.999948 Because r is so close to 1, there is a strog egative liear relatioship betwee body desity ad body fat. As body desity icreases, the body fat teds to decrease liearly. The least-squares regressio lie is give by y = a x + b 404. 5927 x + 445.8576, which i this case gives a almost perfect liear fit. Y= From VARS STATISTICS EQ Press ENTER Because r 2 0.9999, we ca say that whe usig body fat is 99.99% determied by oe s body desity. as a predictor, the 3. Is there a relatioship betwee drivig speed ad MPG for your gas-guzzlig SUV? Speed (mph) MPG 10 18 20 20 40 22 60 20 70 18 STAT EDIT STAT PLOT Adjust Settigs ZOOM 9 There clearly seems to be some sort of relatioship (perhaps quadratic). The mpg icreases as speed icreases to a certai poit; but the as speed icreases further, the mpg drops off.

There is o correlatio! STAT CALC r = 0. The correlatio measures the stregth ad directio of the liear relatioship betwee the variables. Just because the correlatio equals 0, it does ot mea that there is o relatioship. I this case, there simply is ot a permaet liear relatioship betwee speed ad mpg; but there certaily is a relatioship. Here, the least-squares regressio lie is costat ad is give by y = 19.6. I this case, the least-squares regressio lie is ot a good fit of the data. However, it is the best liear approximatio of the data, which really does o good here because there is o permaet liear relatioship betwee speed ad mpg. Because r 2 = 0, the lie does ot fit the data at all. Usig the lie y = 19.6 as a predictor, the the mpg is ot at all determied by its speed. 4. Is there a relatioship betwee height ad GPA? The followig data is a collectio of measuremets from a radom sample of WKU studets. Studet Height (iches) GPA 1. 60.5 3.95 2. 69.5 2.51 3. 69.5 2.85 4. 71.5 3.41 5. 73 1.91 6. 65.5 2.70 7. 75 3.26 8. 68 3.34 9. 64 2.20 10. 61 2.28 STAT EDIT STAT PLOT Adjust Settigs ZOOM 9

There does ot appear to be ay relatioship betwee height ad grade poit average. High ad low (ad middle) GPAs are attaied from studets of all heights. STAT CALC r 0.059468 The correlatio is early 0. Whe there is o relatioship whatsoever betwee the variables, the we say that they are idepedet. Whe variables are idepedet, the the true correlatio will equal 0. So the correlatio coefficiet from a radom sample of measuremets should be very close to 0 whe the two variables have o associatio betwee them. Here, the least-squares regressio lie is give by y = 0. 007754 x + 3.3663446. Because the correlatio is early 0, there is o liear relatioship betwee height ad GPA. (I fact, there is o relatioship at all because GPA is probably idepedet of height.) So agai, the least-squares regressio lie is ot a good fit of the data. Because r 2 0.0035, whe usig the lie = as a predictor, a perso s GPA is 0.35% determied by height ad 99.65% determied by other factors. 5. Sixtee bige drikers at Ohio State Uiversity had a beer party. Thirty miutes later, campus police measured their blood alcohol cotet (BAC). Here are the data: Studet 1 2 3 4 5 6 7 8 # Beers 5 2 9 8 3 7 3 5 BAC 0.10 0.03 0.19 0.12 0.04 0.095 0.07 0.06 Studet 9 10 11 12 13 14 15 16 # Beers 3 5 4 6 5 7 1 4 BAC 0.02 0.05 0.07 0.10 0.085 0.09 0.01 0.05 Is there a correlatio betwee BAC ad the umber of beers druk by the studet? What would you predict the average BAC to be for people havig 6 beers?

STAT EDIT STAT PLOT Adjust Settigs ZOOM 9 The BAC ca vary from perso to perso. For istace, the BACs of the studets havig 3 beers were 0.02, 0.04, ad 0.07. But a geeral tred exists: As the umber of beers icreases, the blood alcohol cotet teds to icrease. STAT CALC r 0.894338 The high correlatio shows that there is a relatively strog positive liear relatioship. But the relatioship is ot precisely liear, perhaps due to the varyig effects of alcohol o differet people. Here, the least-squares regressio lie is give by y 0.018 x 0.0127, which ca be iterpreted as givig the average BAC for the various amouts of beer. Evaluatig the lie for x = 6 beers, we obtai a average BAC of about 0.095, which is well above the legal limit! So do't drik ad drive! From CALC (2d TRACE) value Here r 2 0.80. Usig y 0.018 x 0.0127 as a predictor, the blood alcohol cotet is 80% determied by the umber of beers, ad 20% determied by other factors such as body weight, male or female, amout of food i stomach, etc.