Economic quiz

profileqwertyu43
2nd_class_august_25.pdf

Econ 5410, Friday August 25, class 2 The regression line

Econ 5410, Friday August 25, class 2

Robert de Jong1

1Department of Economics Ohio State University

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

To those waitlisted for Econ 5410:

Dr. Ruddy’s section of Econ 5410 has been moved to a larger classroom. It should be possible to sign up for his section.

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Today’s class

1 Participation roster

2 Class split for computer class

3 Discussion of “important dates”

4 Exercise for today: Olympic medals 5 Main class topics today:

The summation sign how to draw the regression line

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Important dates

Friday September 1 and Friday September 8: Gretl exercise and Gretl

test, during our regular class times.

The takehome handout dates are:

1 Wednesday August 30 2 Wednesday September 13 3 Friday October 6 4 Wednesday October 18 5 Friday November 10

The takehomes are all due at the start of our next class.

The midterms for this course are on Wednesday September 20 and on

Friday October 27.

The due date for this paper is Wednesday December 6, at the start of

class (our last class).

The final exam for this course is on Monday December 11,

4:00pm-5:45pm, in our regular classroom.

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Exercise for today

The second article is obviously nonsense because we immediately realize that the health effects are due to smoking, and not to owning ashtrays. The issue is that owning ashtrays will be related to smoking more on average, and any health effects are of course due to smoking. In the first article, we have to hope that the researchers have realized that eating lots of beans likely is related to having a healthy life style.

Olympics medals: http://www.medalspercapita.com, http://www.econ.ohio-state.edu/dejong/

medals-rio-2016.txt, http://www.econ.ohio-state. edu/dejong/medals-rio-2016.gdt, and http: //www.econ.ohio-state.edu/dejong/olympics2012.gdt

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

The “medals per capita” approach raises some questions, two of which are:

1 Is the relationship between medals and population truly linear? That is, does an extra unit of population always lead to a fixed expected additional number of medals?

2 How about the extra variables that can possibly explain the number of medals, such as GDP? Can they be omitted?

Other problems can be identified as well. Therefore, drawing a straight line through the point cloud in this setting may not be meaningful

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

In order to understand how the “regression line” and the “Ordinary Least Squares” estimator are calculated and where they come from, understanding the summation sign is important

Summation sign:

N∑ i=1

Xi = X1 + X2 + ... + XN−1 + XN

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

“Summation sign”

Xi Yi 1 2 4 2 1 3

Then 3∑

i=1

Xi = X1 + X2 + X3 = 1 + 4 + 1 = 6

Also : ∑ i

Yi , or ∑

Yi

Notation in Studenmund: sample size N (other books and classes: also T or n)

In this example: N = 3.

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Yi Xi 1 2 4 2 1 3

Example:

3∑ i=1

X 2i = X 2 1 + X

2 2 + X

2 3 = 2

2 + 32 + 22 = 4 + 9 + 4 = 17.

3∑ i=1

XiYi = X1Y1 +X2Y2 +X3Y3 = 2·1 + 2·4 + 3·1 = 2 + 8 + 3 = 13.

3∑ i=1

(Xi−Yi ) = (2−1)+(2−4)+(3−1) = 1+(−2)+2 = 1 = 3∑

i=1

Xi− 3∑

i=1

Yi.

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Note: pitfalls are abundant

3∑ i=1

Xi = 7; 3∑

i=1

Yi = 6

but 3∑

i=1

XiYi = 13,

so 3∑

i=1

Xi · 3∑

i=1

Yi 6= 3∑

i=1

XiYi

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Regression line

= straight line through the point cloud

Simplified example: data on stock price Yi and trade volume Xi :

Xi Yi 1 2 4 2 1 3

Q: How to draw the line through the point cloud? A: we use the least squares principle

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

(picture on blackboard; discussion)

Line y = 2

point # vertical distance squared vertical to line distance

1 0 = |Y1 − 2| 02 = 0 2 0 = |Y2 − 2| 02 = 0 3 1 = |Y3 − 2| 12 = 1

total: 1

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Now try y = x

point # vertical distance squared vertical to line distance

1 1 = |Y1 −X1| 12 = 1 2 2 = |Y2 −X2| 22 = 4 3 2 = |Y3 −X3| 22 = 4

total: 9

Now try line though point # 2, and through middle of points #1 and #3

point # vertical distance squared vertical to line distance

1 1/2 1/4 2 0 0 3 1/2 1/4

total: 1/2

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Suppose now that we try the line y = β0 + β1x

point # vertical distance squared vertical to line distance

1 |Y1 − (β0 + β1X1)| |Y1 −β0 −β1X1|2 2 |Y2 − (β0 + β1X2)| |Y2 −β0 −β1X2|2 3 |Y3 − (β0 + β1X3)| |Y3 −β0 −β1X3|2

total: |Y1 −β0 −β1X1|2 +|Y2 −β0 −β1X2|2 +|Y3 −β0 −β1X3|2

In general:

|Y1 −β0 −β1X1|2 + |Y2 −β0 −β1X2|2

+ . . . + |YN −β0 −β1XN|2

where N denotes sample size

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Using mathematics, we can find the values of β0 and β1 that minimize

|Y1 −β0 −β1X1|2 + |Y2 −β0 −β1X2|2

+ . . . + |YN −β0 −β1XN|2.

Question: why not minimize the sum of absolute values, or fourth powers?

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Example of the least squares principle: find the value for β0 that minimizes

∑N i=1(Yi −β0)

2

Note that

N∑ i=1

(Yi −β0)2 = N∑ i=1

(Yi − Ȳ + Ȳ −β0)2

= N∑ i=1

(Yi − Ȳ )2 + N∑ i=1

2(Yi − Ȳ )(Ȳ −β0) + N∑ i=1

(Ȳ −β0)2,

and

N∑ i=1

2(Yi − Ȳ )(Ȳ −β0) = 2(Ȳ −β0) N∑ i=1

(Yi − Ȳ ) = 0,

so this summation is minimal for β0 = Ȳ .

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Minimizing N∑ i=1

(Yi − (β0 + β1Xi ))2

over all possible values of β0 and β1 gives

β̂1 = N ·

∑N i=1 XiYi −

∑N i=1 Xi ·

∑N i=1 Yi

N · ∑N

i=1 X 2 i − (

∑N i=1 Xi )

2

and β̂0 = Ȳ − β̂1X̄

Note Ȳ = N−1 ∑N

i=1 Yi , the average of the Yi

The mathematical calculation requires being able to find the minimum of a function of two variables using differentiation

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Example of the least squares principle: find the value for β0 that minimizes

∑N i=1(Yi −β0)

2

Note that

N∑ i=1

(Yi −β0)2 = N∑ i=1

(Yi − Ȳ + Ȳ −β0)2

= N∑ i=1

(Yi − Ȳ )2 + N∑ i=1

2(Yi − Ȳ )(Ȳ −β0) + N∑ i=1

(Ȳ −β0)2,

and

N∑ i=1

2(Yi − Ȳ )(Ȳ −β0) = 2(Ȳ −β0) N∑ i=1

(Yi − Ȳ ) = 0,

so this summation is minimal for β0 = Ȳ .

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Example

Xi Yi XiYi X 2 i

1 2 2 1 4 2 8 16 1 3 3 1

6 7 13 18

β̂1 = N ·

∑N i=1 XiYi −

∑N i=1 Xi ·

∑N i=1 Yi

N · ∑N

i=1 X 2 i − (

∑N i=1 Xi )

2

= 3 · 13 − 7 · 6 3 · 18 − 62

= 39 − 42 54 − 36

= −3 18

= − 1

6 ≈−0.167

Also

β̂0 = Ȳ − β̂1X̄ = 7/3 − (− 1

6 )(6/3) = 8/3 ≈ 2.67

Regression line: y = (8/3) − (1/6)x Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Q: does the regression line y = (8/3) − (1/6)x pass through the middle of the points (1,2) and (1,3)?

A: Yes, if x = 1, the corresponding y value for the regression line is

(8/3) − (1/6) · 1 = (16/6) − (1/6)

= 15/6 = 2.5

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Computer software: Gretl will calculate the regression line for us

Other packages that can do this:

Excel, or other spreadsheet program

SAS, SPSS

Stata, Eviews, etc.

Robert de Jong Econ 5410, Friday August 25, class 2

Econ 5410, Friday August 25, class 2 The regression line

Goal of this class: be able to interpret output for regressions; examples:

1 A “wage equation”: explaining individuals’ wages from characteristics; http://www.econ.ohio-state.edu/dejong/wage2.gdt

2 Teenage pregnancy rates in Ohio counties; http: //www.econ.ohio-state.edu/dejong/teenpreg.gdt

3 George W. Bush approval rating vs. oil price http://www. econ.ohio-state.edu/dejong/bushapproval2.gdt

Robert de Jong Econ 5410, Friday August 25, class 2

  • Econ 5410, Friday August 25, class 2
  • The regression line