Presentation is loading. Please wait.

Presentation is loading. Please wait.

Things to do in Lecture 1 Outline basic concepts of causality Go through the ideas & principles underlying ordinary least squares (OLS) estimation Derive.

Similar presentations


Presentation on theme: "Things to do in Lecture 1 Outline basic concepts of causality Go through the ideas & principles underlying ordinary least squares (OLS) estimation Derive."— Presentation transcript:

1 Things to do in Lecture 1 Outline basic concepts of causality Go through the ideas & principles underlying ordinary least squares (OLS) estimation Derive formally how to estimate the value of the coefficients we are interested using OLS Run an OLS regression

2 Regression analysis is primarily concerned with quantifying the relationship between variables Does more than measures of association like the correlation coefficient since it implies that one variable depends on another hence there is a causal relationship between the variable whose behaviour we would like to explain - the dependent variable (which label y) and the explanatory (or independent) variable that we think can explain this behaviour (which label X) DERIVING OLS REGRESSION COEFFICIENTS

3 -Given data on both the dependent and explanatory variable we can establish that causal relationship using regression analysis -How? -fit a straight line through the data that best summarises the relationship -Since the equation of a straight line is given by Y= b 0 + b 1 X we can obtain an estimate of the values for the intercept b 0 (the constant) and the slope b 1 that together give the line of best fit How ?

4 # # # # # # Y X Which line (and hence which slope & intercept) to choose? - The one that minimises the sum of squared residuals dodo b0b0 b1b1 d1d1 Suppose we plot a set of observations on the Y variable and the X variable of interest - a scatter diagram

5 Using the principle of Ordinary Least Squares (OLS) - Try to fit a (straight) line through the data based on minimising the sum of squared residuals What is a residual? If we fit a line through some data then this will give a predicted value for the dependent variable based on the value of the X variable and the values for the constant and the slope

6 # # # # # # y X b0b0 XiXi yiyi b1b1 Given any straight line can always read off actual and predicted values of variable of interest for every individual i in the data set

7 For example given the equation of a straight line Y = b 0 + b 1 X we know when X = 1, then the predicted value of Y and when X = 2, then the predicted value of Y

8 We can then compare this predicted value with the actual value of the dependent variable and the difference between the actual and predicted value gives the residual Which since gives

9 # # # # # # y X b0b0 XiXi yiyi The difference between the actual and predicted value is the residual b1b1 predicted actual

10 We can then compare this predicted value with the actual value of the dependent variable and the difference between the actual and predicted value gives the residual (where the i subscript refers to the i th individual or firm or time period in the data set)

11 Things to know about residuals So intuitively then the line of best fit should be the one that delivers the smallest residual values for the each observation in the data set 1. The larger the residual the worse the prediction

12 2. Since the difference between the actual and predicted value gives the residual a positive residual means The model underpredicts and similarly The model over- predicts (larger than actual)

13 Given this.. Suppose we tried to minimise the sum of all the residuals in the data in an attempt to get the line of best fit Whilst this might seem intuitive it will not work because it is possible that any positive residual will be offset by a negative residual in the summation and so the sum could be close to zero even if the overall fit of the regression were poor

14 We can avoid this problem is use instead the principle of Ordinary Least Squares (OLS) Rather than minimise the sum of residuals, minimise the sum of squared residuals - Squaring ensures that values are always positive and so can never cancel each other out -Also gives more weight to larger residuals and so harder to get away with a poor fit, (the larger any one residual in absolute value, the larger is the sum of squared residuals (RSS)

15 Things to do in Lecture 2 Derive formally how to estimate the value of the coefficients we are interested using OLS Run an OLS regression Interpret the regression output Measure how well the model fits the data

16 # # # # # # y X Which line (and hence which slope & intercept) to choose? - The one that minimises the sum of squared residuals dodo b0b0 b1b1 d1d1 The Idea Behind Ordinary Least Squares (OLS)

17 # # # # # # y X b0b0 XiXi yiyi The difference between the actual and predicted value is the residual b1b1 predicted actual

18 Consider the following simple example N=2 and want to fit a straight line y=b 0 +b 1 X thru the following data points using principle of OLS (min sum of squared residuals) (Y 1 =3 X 1 =1)(Y 2 =5 X 2 =2) It follows that can write estimated residual for the 1 st observation and similarly for the 2 nd observation and y 1 =3 using as

19 OLS: minimise the sum of squared residuals (A) Expanding the terms in brackets Adding together like terms

20 Now need to find values of and which minimise this sum, Using the rules of calculus we know the first order condition for minimisation are:

21 This gives 2 simultaneous equations which can solve for unknown values of and using rules for simultaneous equations So the estimated regression line becomes ie the intercept (constant) with the y axis is at 1 and the slope of the straight line is 2

22 Basic idea underlying OLS is to choose a line of best fit -Choose a straight line that passes through the data and minimises the sum of squared residuals Now need to do this more generally so can apply the technique to any possible combination of (x, y) data pairs and any number of observations

23 If we wish to fit a (straight) line through N (rather than 2) observations, then the OLS principle is still the same ie choose and to minimise (where now the summation runs from 1 to N rather than 1 to 2 )

24 sub. in This is just a generalised version of (A) above

25 Again, find values of and which minimise this sum, using the same simple calculus rules and

26 Now these two (1 st order) minimisation conditions give and again we have 2 simultaneous equations (called the normal equations) which can again solve for and (1) (2)

27 Using the fact that the sample means of Y and X can re-write (1) and so obtain the formula to calculate the OLS estimate of the intercept (3) (*** learn this **)

28 Sub. into (2) gives and simplifying collecting terms

29 Dividing both sides by 1/N which gives the formula to calculate the OLS estimate of the slope (**** learn this ****)

30 The OLS equations give a nice, clear intuitive meaning about the influence of the variable X on the size of the slope, since it shows that: So are how the computer determines the size of the intercept and the slope respectively in an OLS regression i) the greater the covariance between X and Y, the larger the (absolute value of) the slope ii) the smaller the variance of X, the larger the (absolute value of) the slope

31 It is equally important to be able to interpret the effect of an estimated regression coefficient Given OLS essentially passes a straight line through the data, then given So the OLS estimate of the slope will give an estimate of the unit change in the dependent variable y following a unit change in the level of the explanatory variable (so you need to be aware of the units of measurement of your variables in order to be able to interpret what the OLS coefficient is telling you)


Download ppt "Things to do in Lecture 1 Outline basic concepts of causality Go through the ideas & principles underlying ordinary least squares (OLS) estimation Derive."

Similar presentations


Ads by Google