Simple Linear Regression

Similar documents
Ch 2: Simple Linear Regression

Simple Linear Regression

CAS MA575 Linear Models

Multiple Linear Regression

Correlation and the Analysis of Variance Approach to Simple Linear Regression

Measuring the fit of the model - SSR

Multiple Linear Regression

Lecture 6 Multiple Linear Regression, cont.

Oct Simple linear regression. Minimum mean square error prediction. Univariate. regression. Calculating intercept and slope

Linear Models and Estimation by Least Squares

MS&E 226: Small Data

STAT5044: Regression and Anova. Inyoung Kim

Chapter 12 - Lecture 2 Inferences about regression coefficient

MA 575 Linear Models: Cedric E. Ginestet, Boston University Midterm Review Week 7

R 2 and F -Tests and ANOVA

Inference for Regression

AMS 315/576 Lecture Notes. Chapter 11. Simple Linear Regression

Lecture 15. Hypothesis testing in the linear model

Ch 3: Multiple Linear Regression

Simple Linear Regression

Ma 3/103: Lecture 25 Linear Regression II: Hypothesis Testing and ANOVA

Math 3330: Solution to midterm Exam

Topic 17 - Single Factor Analysis of Variance. Outline. One-way ANOVA. The Data / Notation. One way ANOVA Cell means model Factor effects model

Review of probability and statistics 1 / 31

13 Simple Linear Regression

Bivariate Paired Numerical Data

Linear regression. We have that the estimated mean in linear regression is. ˆµ Y X=x = ˆβ 0 + ˆβ 1 x. The standard error of ˆµ Y X=x is.

Chapter 1: Linear Regression with One Predictor Variable also known as: Simple Linear Regression Bivariate Linear Regression

Simple and Multiple Linear Regression

Figure 1: The fitted line using the shipment route-number of ampules data. STAT5044: Regression and ANOVA The Solution of Homework #2 Inyoung Kim

Chapter 1 Linear Regression with One Predictor

Handout 4: Simple Linear Regression

From last time... The equations

STAT 3A03 Applied Regression With SAS Fall 2017

2.2 Classical Regression in the Time Series Context

Econ 3790: Business and Economics Statistics. Instructor: Yogesh Uppal

Linear Regression. Simple linear regression model determines the relationship between one dependent variable (y) and one independent variable (x).

Lecture 14 Simple Linear Regression

TMA4255 Applied Statistics V2016 (5)

Overview Scatter Plot Example

Estimating σ 2. We can do simple prediction of Y and estimation of the mean of Y at any value of X.

Linear models and their mathematical foundations: Simple linear regression

Concordia University (5+5)Q 1.

MAT2377. Rafa l Kulik. Version 2015/November/26. Rafa l Kulik

Models for Clustered Data

Section 4.6 Simple Linear Regression

Subject-specific observed profiles of log(fev1) vs age First 50 subjects in Six Cities Study

robustness, efficiency, breakdown point, outliers, rank-based procedures, least absolute regression

Models for Clustered Data

5. Linear Regression

Simple Linear Regression Analysis

sociology sociology Scatterplots Quantitative Research Methods: Introduction to correlation and regression Age vs Income

Analysis of Variance. Source DF Squares Square F Value Pr > F. Model <.0001 Error Corrected Total

AMS 7 Correlation and Regression Lecture 8

STA 302 H1F / 1001 HF Fall 2007 Test 1 October 24, 2007

Chapter 2 Inferences in Simple Linear Regression

Simple Linear Regression

Inference in Regression Analysis

ST430 Exam 2 Solutions

Problems. Suppose both models are fitted to the same data. Show that SS Res, A SS Res, B

Simple Linear Regression: The Model

Statistical View of Least Squares

1 Multiple Regression

Topic 20: Single Factor Analysis of Variance

22s:152 Applied Linear Regression. Chapter 5: Ordinary Least Squares Regression. Part 1: Simple Linear Regression Introduction and Estimation

Homework 2: Simple Linear Regression

Example: Poisondata. 22s:152 Applied Linear Regression. Chapter 8: ANOVA

STAT 350: Summer Semester Midterm 1: Solutions

Table 1: Fish Biomass data set on 26 streams

F-tests and Nested Models

Inferences for Regression

Coefficient of Determination

STAT420 Midterm Exam. University of Illinois Urbana-Champaign October 19 (Friday), :00 4:15p. SOLUTIONS (Yellow)

Simple Linear Regression

ECON The Simple Regression Model

Summary of Chapter 7 (Sections ) and Chapter 8 (Section 8.1)

Matrices and vectors A matrix is a rectangular array of numbers. Here s an example: A =

Introduction and Background to Multilevel Analysis

Applied Regression. Applied Regression. Chapter 2 Simple Linear Regression. Hongcheng Li. April, 6, 2013

Lecture 4 Multiple linear regression

Multiple Sample Numerical Data

Variance Decomposition and Goodness of Fit

Biostatistics for physicists fall Correlation Linear regression Analysis of variance

Density Temp vs Ratio. temp

Statistics for Engineers Lecture 9 Linear Regression

Applied Statistics and Econometrics

Multiple Regression. Inference for Multiple Regression and A Case Study. IPS Chapters 11.1 and W.H. Freeman and Company

CHAPTER EIGHT Linear Regression

Lectures on Simple Linear Regression Stat 431, Summer 2012

Regression Estimation Least Squares and Maximum Likelihood

STAT5044: Regression and Anova

Linear Regression Model. Badr Missaoui

Lecture 5: Linear Regression

Variance. Standard deviation VAR = = value. Unbiased SD = SD = 10/23/2011. Functional Connectivity Correlation and Regression.

The Simple Regression Model. Part II. The Simple Regression Model

Chapter 1. Linear Regression with One Predictor Variable

STAT2012 Statistical Tests 23 Regression analysis: method of least squares

UNIVERSITY OF TORONTO SCARBOROUGH Department of Computer and Mathematical Sciences Midterm Test, October 2013

ECO220Y Simple Regression: Testing the Slope

TABLES AND FORMULAS FOR MOORE Basic Practice of Statistics

Transcription:

Simple Linear Regression MATH 282A Introduction to Computational Statistics University of California, San Diego Instructor: Ery Arias-Castro http://math.ucsd.edu/ eariasca/math282a.html MATH 282A University of California San Diego Ery Arias-Castro 1 / 19

Hooker s data on boiling temperature in the Himalayas Consider the hooker dataset taken from the package alr3. 'data.frame': 31 obs. of 2 variables: $ Temp : num 211 210 208 202 201... $ Pressure: num 29.2 28.6 28.0 24.7 23.7... Data collected by the botanist Dr. Joseph Hooker on temperatures and boiling points measured often at higher altitudes in the Himalaya Mountains. Main question. Is there a relationship between boiling temperature and pressure, and if so, quantify this relationship by building a predictive model. MATH 282A University of California San Diego Ery Arias-Castro 2 / 19

Scatterplot Temp 180 185 190 195 200 205 210 16 18 20 22 24 26 28 Pressure MATH 282A University of California San Diego Ery Arias-Castro 3 / 19

Simple linear model We assume a simple linear model Temp = β 0 + β 1 Pressure With (x i, y i representing the pressure-temperature pairs, the formal model is y i = β 0 + β 1 x i + ǫ i β 0 is the intercept β 1 is the slope ǫ is the random error Assumptions: The ǫ i s are i.i.d. normal with mean zero and same variance σ 2. All parameters β 0, β 1 and σ 2 are in general unknown. MATH 282A University of California San Diego Ery Arias-Castro 4 / 19

Least squares regression A popular way to fit this data is by minimizing the error sum of squares SSE(β 0, β 1 = (y i β 0 β 1 x i 2 Under the assumption that the ǫ i s are i.i.d. normal, this corresponds to maximum likelihood estimation. > hooker.lm = lm(temp ~ Pressure Coefficients: (Intercept Pressure 146.673 2.253 MATH 282A University of California San Diego Ery Arias-Castro 5 / 19

Least squares regression Define SXX = x = 1 n x i, y = 1 n (x i x 2, SYY = (y i y 2, SXY = y i (x i x(y i y Standard calculations provide explicit formulae: β 1 = SXY SXX and β0 = y β 1 x Note. The least squares regression line passes through the mean (x, y. MATH 282A University of California San Diego Ery Arias-Castro 6 / 19

Regression line Temp 180 185 190 195 200 205 210 16 18 20 22 24 26 28 Pressure MATH 282A University of California San Diego Ery Arias-Castro 7 / 19

Residuals and Estimate for σ 2 The fitted values: The residuals: ŷ i = ˆβ 0 + ˆβ 1 x i e i = y i ŷ i Estimate for σ 2 : ˆσ 2 = 1 n 2 (y i ŷ i 2 = 1 n 2 e 2 i = SSE n 2 = MSE Note. This estimate corresponds to the maximum likelihood estimate multiplied by n/(n 2 to make it unbiased. MATH 282A University of California San Diego Ery Arias-Castro 8 / 19

Moments Assumptions: the errors are uncorrelated, mean 0 and same variance σ 2. β 0 and β 1 are unbiased: E ( β0 = β 0, E ( β1 = β 1 Their second moments are: ( 1 var ( β0 = σ 2 n + x2, var ( β1 SXX = σ 2 1 SXX, cov ( β0, β 1 = σ 2 x SXX σ 2 is unbiased: E ( σ 2 = σ 2 MATH 282A University of California San Diego Ery Arias-Castro 9 / 19

Distributions Assumptions: the errors are i.i.d. normal, mean 0 and same variance σ 2. ( β 0, β 1 is normally distributed. (n 2 σ 2 /σ 2 has the chi-square distribution with n 2 degrees of freedom. ( β 0, β 1 and σ 2 are independent. MATH 282A University of California San Diego Ery Arias-Castro 10 / 19

t-tests and confidence intervals Define ŝe ( β0 = σ 1 n + x2 SXX ŝe ( β1 = σ 1 SXX Assumptions: the errors are i.i.d. normal, mean 0 and same variance σ 2. Then: β 0 β 0 ŝe ( β0 and β 1 β 1 ŝe ( β1 have the t-distribution with n 2 degrees of freedom. Coefficients: Estimate Std. Error t value Pr(> t (Intercept 146.67290 0.77641 188.91 <2e-16 *** Pressure 2.25260 0.03809 59.14 <2e-16 *** --- Residual standard error: 0.806 on 29 degrees of freedom MATH 282A University of California San Diego Ery Arias-Castro 11 / 19

t-tests and confidence intervals We can also provide a condifence interval for β 0 + β 1 x. The natural estimator is β 0 + β 1 x. Under the normal assumptions, it has the normal distribution with E ( β0 + β 1 x = β 0 + β 1 x var( β0 + β ( 1 1 x = σ 2 n We therefore estimate its standard error by + (x x2 SXX ŝe ( β0 + β 1 x = σ 1 n + (x x2 SXX MATH 282A University of California San Diego Ery Arias-Castro 12 / 19

t-tests and confidence intervals Therefore: β 0 + β 1 x β 0 β 1 x ŝe ( β0 + β 1 x has the t-distribution with n 2 degrees of freedom. As a consequence, β 0 + β 1 x ± t α/2 n 2 ( β0 ŝe + β 1 x is a level-α confidence interval for β 0 + β 1 x. MATH 282A University of California San Diego Ery Arias-Castro 13 / 19

Confidence Bands We want to provide confidence intervals for β 0 + β 1 x simultaneously level-α for all x. Under the normal assumptions, the following satisfies that property β 0 + β 1 x ± (2F2,n 2 α 1/2 ŝe ( β0 + β 1 x MATH 282A University of California San Diego Ery Arias-Castro 14 / 19

Confidence Bands Temp 180 185 190 195 200 205 210 16 18 20 22 24 26 28 Pressure MATH 282A University of California San Diego Ery Arias-Castro 15 / 19

Prediction Intervals The confidence intervals (and bands above compute a range for the expected value at a given x, meaning the target is β 0 + β 1 x. Suppose we want instead an interval that contains a new observation at x with high confidence, meaning the target is now y new = β 0 + β 1 x + ǫ new. Our prediction is ŷ new, and given that the new observation is independent of the n observations used to build the model, we have y new ŷ new N(0, var(ǫ new + var( β0 + β 1 x. Therefore, we have the following (1 α-level prediction interval: y new ŷ new ± t α/2 n 2 σ 1 + 1 n + (x x2 SXX MATH 282A University of California San Diego Ery Arias-Castro 16 / 19

Analysis of variance Consider H 0 : the model is y i = β 0 + ǫ i against H 1 : the model is y i = β 0 + β 1 x i + ǫ i Define the error sum of squares SSE = (y i ŷ i 2 = e 2 i Define the sum of squares due to regression SSreg = (y ŷ i 2 = SXY2 SXX MATH 282A University of California San Diego Ery Arias-Castro 17 / 19

Analysis of variance The ANOVA is based on F = SSreg/1 SSE/(n 2 Under the normal assumptions, under the null F has an F-distribution with 1 and n 2 degrees of freedom. Note. Equivalent to the two-sided t-test for β 1 = 0. The computations are often summarized in an ANOVA table. Analysis of Variance Table Response: Temp Df Sum Sq Mean Sq F value Pr(>F Pressure 1 2272.47 2272.47 3497.9 < 2.2e-16 *** Residuals 29 18.84 0.65 --- MATH 282A University of California San Diego Ery Arias-Castro 18 / 19

Coefficient of determination R 2 The coefficient of determination measures the quality of the fit: Note that R 2 = SSreg SYY = 1 SSE SYY R 2 = ρ(x,y 2 where ρ(x,y is the correlation of x = (x 1,...,x n and y = (y 1,...,y n ρ(x,y = cov(x, y var(xvar(y MATH 282A University of California San Diego Ery Arias-Castro 19 / 19