Ordinary Least Squares Regression

Similar documents
Fixed Effects Models for Panel Data. December 1, 2014

Instrumental Variables and the Problem of Endogeneity

Recent Advances in the Field of Trade Theory and Policy Analysis Using Micro-Level Data

Questions and Answers on Heteroskedasticity, Autocorrelation and Generalized Least Squares

Econometrics. Week 8. Fall Institute of Economic Studies Faculty of Social Sciences Charles University in Prague

The Simple Linear Regression Model

Heteroskedasticity. Part VII. Heteroskedasticity

1 Motivation for Instrumental Variable (IV) Regression

Final Exam. Economics 835: Econometrics. Fall 2010

Introduction to Estimation Methods for Time Series models. Lecture 1

Econometrics - 30C00200

Homoskedasticity. Var (u X) = σ 2. (23)

Linear Models in Econometrics

1. The OLS Estimator. 1.1 Population model and notation

Econometrics. Week 6. Fall Institute of Economic Studies Faculty of Social Sciences Charles University in Prague

Quantitative Analysis of Financial Markets. Summary of Part II. Key Concepts & Formulas. Christopher Ting. November 11, 2017

Lecture 15 Multiple regression I Chapter 6 Set 2 Least Square Estimation The quadratic form to be minimized is

Formal Statement of Simple Linear Regression Model

Multiple Regression Analysis: Heteroskedasticity

the error term could vary over the observations, in ways that are related

Topic 7: Heteroskedasticity

Econometrics of Panel Data

CHAPTER 2: Assumptions and Properties of Ordinary Least Squares, and Inference in the Linear Regression Model

Econ 2120: Section 2

ECON The Simple Regression Model

Need for Several Predictor Variables

Wooldridge, Introductory Econometrics, 4th ed. Chapter 15: Instrumental variables and two stage least squares

Econometrics I KS. Module 2: Multivariate Linear Regression. Alexander Ahammer. This version: April 16, 2018

Econ 582 Fixed Effects Estimation of Panel Data

Heteroskedasticity and Autocorrelation

Econometrics I KS. Module 1: Bivariate Linear Regression. Alexander Ahammer. This version: March 12, 2018

Statistics 910, #5 1. Regression Methods

LECTURE 2 LINEAR REGRESSION MODEL AND OLS

Simple Linear Regression Model & Introduction to. OLS Estimation

Lab 11 - Heteroskedasticity

Outline. Remedial Measures) Extra Sums of Squares Standardized Version of the Multiple Regression Model

Ninth ARTNeT Capacity Building Workshop for Trade Research "Trade Flows and Trade Policy Analysis"

Ma 3/103: Lecture 24 Linear Regression I: Estimation

Least Squares Estimation-Finite-Sample Properties

Intro to Applied Econometrics: Basic theory and Stata examples

Chapter 15 Panel Data Models. Pooling Time-Series and Cross-Section Data

Panel Data. March 2, () Applied Economoetrics: Topic 6 March 2, / 43

Multiple Linear Regression CIVL 7012/8012

A Course on Advanced Econometrics

Econometrics of Panel Data

Lecture 24: Weighted and Generalized Least Squares

Econometrics. Week 4. Fall Institute of Economic Studies Faculty of Social Sciences Charles University in Prague

Biostatistics Workshop Longitudinal Data Analysis. Session 4 GARRETT FITZMAURICE

Topic 10: Panel Data Analysis

Econ 836 Final Exam. 2 w N 2 u N 2. 2 v N

Graduate Econometrics Lecture 4: Heteroskedasticity

Lecture: Simultaneous Equation Model (Wooldridge s Book Chapter 16)

Multiple Regression Analysis

The Simple Regression Model. Simple Regression Model 1

1 Introduction to Generalized Least Squares

ECON3150/4150 Spring 2015

GLS. Miguel Sarzosa. Econ626: Empirical Microeconomics, Department of Economics University of Maryland

Environmental Econometrics

Regression and Statistical Inference

Introductory Econometrics

Repeated observations on the same cross-section of individual units. Important advantages relative to pure cross-section data

Econometrics. 9) Heteroscedasticity and autocorrelation

Greene, Econometric Analysis (7th ed, 2012)

Econ 510 B. Brown Spring 2014 Final Exam Answers

Quantitative Methods I: Regression diagnostics

Econometrics Summary Algebraic and Statistical Preliminaries

Bias Variance Trade-off

Introduction to Econometrics Midterm Examination Fall 2005 Answer Key

Heteroskedasticity. y i = β 0 + β 1 x 1i + β 2 x 2i β k x ki + e i. where E(e i. ) σ 2, non-constant variance.

Intermediate Econometrics

. a m1 a mn. a 1 a 2 a = a n

Econometrics of Panel Data

Linear Algebra Review


Simple Linear Regression Estimation and Properties

Spatial Regression. 3. Review - OLS and 2SLS. Luc Anselin. Copyright 2017 by Luc Anselin, All Rights Reserved

Multiple Linear Regression

Lecture 8: Instrumental Variables Estimation

Econometrics Multiple Regression Analysis: Heteroskedasticity

The Classical Linear Regression Model

IV Estimation and its Limitations: Weak Instruments and Weakly Endogeneous Regressors

Stat 5100 Handout #26: Variations on OLS Linear Regression (Ch. 11, 13)

Dynamic Panels. Chapter Introduction Autoregressive Model

Stat 579: Generalized Linear Models and Extensions

Economics 113. Simple Regression Assumptions. Simple Regression Derivation. Changing Units of Measurement. Nonlinear effects

ECON2228 Notes 2. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 47

Economics 582 Random Effects Estimation

Introduction to Panel Data Analysis

Lecture 7: Dynamic panel models 2

STAT 100C: Linear models

Heteroskedasticity. We now consider the implications of relaxing the assumption that the conditional

Linear models and their mathematical foundations: Simple linear regression

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

IV Estimation and its Limitations: Weak Instruments and Weakly Endogeneous Regressors

ECO375 Tutorial 8 Instrumental Variables

Problem Set #6: OLS. Economics 835: Econometrics. Fall 2012

Final Review. Yang Feng. Yang Feng (Columbia University) Final Review 1 / 58

Applied Microeconometrics (L5): Panel Data-Basics

Advanced Quantitative Methods: ordinary least squares

Intermediate Econometrics

Transcription:

Ordinary Least Squares Regression

Goals for this unit More on notation and terminology OLS scalar versus matrix derivation

Some Preliminaries In this class we will be learning to analyze Cross Section Data Panel Data (Longitudinal Data) Time Series Data is ignored in this class (take ECON 408)

Cross Section Data Information at a point in time for N individuals, firms, or economic units id year wage education experience 1 1996 15 12 10 2 1996 23 14 8 : : : : : : : : : : 99 1996 9 10 2 100 1996 54 16 15

Balanced Panel Data Information at T points in time for each of N individuals, firms, or economic units id year wage education experience 1 1996 15 12 10 1 1997 17 12 11 1 1998 20 12 12 2 1996 23 14 8 2 1997 20 15 9 2 1998 21 15 10 : : : : : : : : : : 99 1996 9 10 2 99 1997 13 10 3 99 1998 15 10 4 100 1996 54 16 15 100 1997 58 17 16 100 1998 74 18 17 Here T = 3 (indexed by years) and N=100 (indexed by id)

Unbalanced Panel Data Information on up to T points in time for each of N individuals, firms, or economic units id year wage education experience 1 1997 17 12 11 1 1998 25 12 12 2 1996 23 14 8 2 1998 21 15 10 99 1996 9 10 2 99 1997 13 10 3 99 1998 15 10 4 100 1996 58 17 16 100 1997 74 18 17 Here T = 3 (indexed by years) and N=100 (indexed by id)

Time Series Data (Not Covered) id year wage education experience 1 1986 15 12 8 1 1987 17 12 9 : : : : : : : : : : 1 2005 33 13 27 1 2006 35 13 28 Here T = 20 (indexed by years) and N=1 (indexed by id)

Yardsticks Unbiased: E[b] = β Consistent: E[b] β, as N approaches

Yardsticks, cont Efficiency: The estimator uses all information at hand for the best estimate of β and the variance/covariance matrix An estimator is asymptotically efficient if it is consistent, asymptotically normally distributed, and has an asymptotic covariance that is not larger than the asymptotic covariance matrix of any other consistent, asymptotically distributed estimator

OLS Consider a situation where we want to test a hypothesis about economic behavior or some type of economic phenomena What are the returns to education? How do premiums impact choice of Obamacare? y i = β 0 + β 1 x i1 + β 2 x i2 + β 3 x i3 + ɛ i

OLS and linear algebra y 1 y i y N = 1 x 11 x 12 x 13 1 x i1 x i2 x i3 1 x N1 x N2 x N3 β 0 β 1 β 2 β 3 + ɛ 1 ɛ i ɛ N (1)

Exercise Check for conformability Show that any row in the above relationship can be written y i = β 0 + β 1 x i1 + β 2 x i2 + β 3 x i3 + ɛ i (2) Why is a column of ones needed in x?

OLS and linear algebra, cont y 1 y i y N N 1 = 1 x 11 x 12 x 13 1 x i1 x i2 x i3 1 x N1 x N2 x N3 N 4 β 0 β 1 β 2 β 3 4 1 + ɛ 1 ɛ i ɛ N N 1

Estimation Problem For most empirical research in the Social Sciences, interested in marginal effects or elasticities The ME are: Don t know β or ɛ y i x ik = β k However, given an estimate for β (b), we can construct estimates for ɛ i (e i ) as e i = y i (b 0 + b 1 x i1 + b 2 x i2 + b 3 x i3 ) = y i x i b ] where x i = [1 x i1 x i2 x i3

Visualizing OLS Note that for every point, y i = β 0 + β 1 x i1 + β 2 x i2 + β 3 x i3 + ɛ i = b 0 + b 1 x i1 + b 2 x i2 + b 3 x i3 + e i Or, for all points y = xβ + ɛ = xb + e

Choosing b One way to calculate b is to minimize the sum squared errors (SSE): n n (e i ) 2 = (y i (b 0 + b 1 x i1 + b 2 x i2 + b 3 x i3 )) 2 i=1 i=1 Exercise: show that n i=1 (e i ) 2 is equivalent to (y xb) (y xb) = e e

The Minimization Problem min b SSE(b) min b e e

The Minimization Problem min b SSE(b) min b e e Simplifying and using the inner product rule: min y y 2y xb + b x xb b

First order conditions: S b = 2x y + 2x xb = 0

First order conditions: S b = 2x y + 2x xb = 0 can be simplified to solve for the OLS estimator b b = (x x) 1 x y

What have we just solved for?

Implementation in Stata

Some Assumptions we will use for deriving model Recall the assumptions in the classic multiple regression model: 1 Linear in parameters 2 There is no linear relationships between the columns in the matrix x 3 Exogeneity of the independent variables: E[ɛ i x j1, x j2,, x j3 ] = 0, for all j This condition ensures that the independent variables for observation i, or for any other observation are not useful for predicting the disturbance terms in the model 4 Homoskedasticity and no autocorrelation: E[ɛ i ɛ j ] j n and share the same variance σ 2 5 Disturbance terms are normally distributed, and given condition (3) and (4): ɛ N(0, σ 2 I)

Properties: Unbiased Is E(b) = β?

Properties: Unbiased Is E(b) = β? E(b) = E[(x x) 1 x y] = E[(x x) 1 x (xβ + ɛ)] = E[(x x) 1 x xβ + (x x) 1 x ɛ] = β + E[(x x) 1 x ɛ] (3) Need E[x ɛ] = 0 Two equivalent ways to think about this: 1 Errors uncorrelated with independent variables 2 Independent variables have no useful information for predicting errors

Properties: For unbiased b need E[x ɛ] = 0 Implications: If errors correlated with independent variables we have endogeneity and the results are biased Exercise: investigate dimensions of E[x ɛ] = 0

Properties: Variance of the estimator The variance of any random variable (scalar) is defined as Var(a) = E[(a E(a)) 2 ] = E[(a µ a ) 2 ] We are interested in the variance/covariance relationship between elements of our estimated vector b in order to perform statistical inference on our parameter estimates The definition of a variance/covariance matrix for a random vector b is Var(b) =E[(b E[b])(b E[b]) ] =E[(b β)(b β) ] Exercise: what are dimensions?

Properties: Variance of the estimator, cont Var(b) = E[(b β)(b β) ] = E[((x x) 1 x y β)((x x) 1 x y β) ] substitute y = xβ + ɛ, check for conformability and simplify

Properties: Variance of the estimator, cont Var(b) = (x x) 1 x E[ɛɛ ]x((x x) 1 ) = (x x) 1 x E[ɛɛ ]x(x x) 1 To simplify further, we invoke the assumption above (ɛ N(0, σ 2 I)), so that E[ɛɛ ] = σ 2 I Exercise: simplify Var(b) further

Properties: Variance of the estimator, cont Finally, we have Var(b) = σ 2 (x x) 1 k k I refer to this as the Variance/Covariance Matrix of the Parameters

How to recover σ 2? σ 2 is the variance of the error Given assumption (3), errors are homoskedastic- shared by everyone in the population σ 2 is unobserved, but estimate it by using estimated errors for each observation and recover sample average s 2 = e e N K = (y xb) (y xb) N K

Estimated Variance/Covariance Matrix of Parameters var(b) = s 2 (x x) 1 Use diagonal elements of this matrix for the variance of each parameter estimated in the model: 00665 00042 00035 00014 Var[b] = s 2 (x x) 1 = s 2 00042 05655 00591 00197 00035 00591 00205 00046 00014 00197 00046 00015 So, the standard error from our regression for b 0 (assumed to be the first parameter) is s 2 0665

Implement in Stata

Heteroskedasticity

Testing for Heterskedasticity The symptoms of Heteroskedasticity are embodied in the relationship between the linear predictor xb and the estimated error Idea: see if the variances of the estimated model errors (e) are a function of the independent variables (x)

Testing for Heterskedasticity: What stata does (estat hettest) Step 1: Recover model residuals (e = y xb) and predictions (^y = xb) Step 2: Using the residuals, calculate diagonal(ee ) r = 1 N (y xb) (y xb) Step 3: Run the regression r = δ 0 + δ 1^y + v, and recover the Model Sum of Squares (MSS): (^r ^r) (^r ^r) Step 4: Using the MSS 2 (distributed χ 2 (1)), perform the following hypothesis test: H 0 : No Heteroskedasticity: σ 2 i = σ 2 i N H1 : Heteroskedasticity: σ 2 i σ 2 i N

The Fix -Remember back to our proof Var(b) = (x x) 1 x E[ɛɛ ]x(x x) 1 -OLS assumes we can estimate Var(ɛ) as s 2 0 0 0 0 s 2 0 0 var(e) = s 2 I N N = 0 0 s 2 0 0 0 0 s 2

The Fix, cont For robust standard errors, use this where s 2 1 0 0 0 0 s2 2 0 0 var(e) = ˆV = 0 0 s 3 2 0 0 0 0 sn 2 s i = e i = y i x i b = y i ŷ i

Robust Standard Errors The robust standard error variance covariance matrix is then: Var(b) = (x x) 1 x ˆVx(x x) 1 Notice we use information in the estimated error to fix the Heteroskedasticity problem Things to reflect on: 1 Should we always use robust standard errors? 2 We are able to leverage estimated errors in this way because b is unbiased in the presence of heteroskedasticity Therefore, our estimates for ɛ i are unbiased