basic econometrics (econ 205)

Post on 01-Jan-2016

116 Views

Category:

Documents

9 Downloads

Preview:

Click to see full reader

DESCRIPTION

Basic Econometrics (Econ 205). Please read Chapter 10 Panel data GH 5 due Monday RAP should be progressing … Please read Acemoglu , Johnson , Robinson, and Yared ( AER , 2008 ). Regression with Panel Data (SW Chapter 10). Notation for panel data. Panel data notation, ctd. - PowerPoint PPT Presentation

TRANSCRIPT

1

Regression with Panel Data(SW Chapter 10)

2

Notation for panel data

3

Panel data notation, ctd.

4

Why are panel data useful?

5

Example of a panel data set:Traffic deaths and alcohol taxes

6

A panel data set looks like this …

7

U.S. traffic death data for 1982:

8

U.S. traffic death data for 1988

9

Why might there be more traffic deaths in states that have higher alcohol taxes?

10

Panel Data with 2 Time Periods

11

12

13

FatalityRate v. BeerTax: Ziliak & McCloskey (2004)?

14

Fixed Effects Regression

15

16

17

The regression lines for each state

18

19

Two ways to write the fixed effects model

20

Estimation of Fixed Effects Models

21

1. “n-1 binary regressors” OLS regression

22

2. “Entity-demeaned” OLS regression

23

Entity-demeaned OLS regression, ctd.

24

Entity-demeaned OLS regression, ctd.

25

Example: Traffic deaths and beer taxes in STATA

Example: A better way in STATA

26

. iis state

. tis year

. xtreg vfrall beertax, fe robust ;

Fixed-effects (within) regression Number of obs = 336Group variable: state Number of groups = 48

R-sq: within = 0.0407 Obs per group: min = 7 between = 0.1101 avg = 7.0 overall = 0.0934 max = 7

F(1,47) = 5.05corr(u_i, Xb) = -0.6885 Prob > F = 0.0294

(Std. Err. adjusted for 48 clusters in state)------------------------------------------------------------------------------ | Robust vfrall | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+---------------------------------------------------------------- beertax | -.6558736 .2918556 -2.25 0.029 -1.243011 -.0687358 _cons | 2.377075 .1497966 15.87 0.000 2.075723 2.678427-------------+---------------------------------------------------------------- sigma_u | .7147146 sigma_e | .18985942 rho | .93408484 (fraction of variance due to u_i)------------------------------------------------------------------------------

• We should use xtreg in this case because those robust standard errors employ a small-sample correction designed for T fixed, n ∞, while areg designed for n fixed, T ∞ (Cameron & Trivedi 2009, p. 253)

27

Example, ctd. For n = 48, T = 7:

28

By the way… how much do beer taxes vary?

29

30

31

. xtsum state year vfr beertax

Variable | Mean Std. Dev. Min Max | Observations-----------------+--------------------------------------------+----------------state overall | 30.1875 15.30985 1 56 | N = 336 between | 15.44883 1 56 | n = 48 within | 0 30.1875 30.1875 | T = 7 | |year overall | 1985 2.002983 1982 1988 | N = 336 between | 0 1985 1985 | n = 48 within | 2.002983 1982 1988 | T = 7 | |vfr overall | 2.040444 .5701938 .82121 4.21784 | N = 336 between | .5461407 1.110077 3.653197 | n = 48 within | .1794253 1.45556 2.962664 | T = 7 | |beertax overall | .513256 .4778442 .0433109 2.720764 | N = 336 between | .4789513 .0481679 2.440507 | n = 48 within | .0552203 .1415352 .7935126 | T = 7

32

. bysort state: egen meantax = mean(beertax)

. gen devmean_beertax = beertax - meantax

. list state year beertax meantax devmean_beertax

+------------------------------------------------+ | state year beertax meantax devmean~x | |------------------------------------------------| 1. | AL 1982 1.539379 1.623793 -.0844132 | 2. | AL 1983 1.788991 1.623793 .1651981 | 3. | AL 1984 1.714286 1.623793 .090493 | 4. | AL 1985 1.652542 1.623793 .0287497 | 5. | AL 1986 1.609907 1.623793 -.0138856 | |------------------------------------------------| 6. | AL 1987 1.56 1.623793 -.0637927 | 7. | AL 1988 1.501444 1.623793 -.122349 | 8. | AZ 1982 .2147971 .3110403 -.0962432 | 9. | AZ 1983 .206422 .3110403 -.1046183 | 10. | AZ 1984 .2967033 .3110403 -.014337 | |------------------------------------------------| 11. | AZ 1985 .3813559 .3110403 .0703156 | 12. | AZ 1986 .371517 .3110403 .0604767 | 13. | AZ 1987 .36 .3110403 .0489597 | 14. | AZ 1988 .346487 .3110403 .0354467 |

. sum beertax devmean_beertax

Variable | Obs Mean Std. Dev. Min Max-------------+-------------------------------------------------------- beertax | 336 .513256 .4778442 .0433109 2.720764devmean_be~x | 336 2.96e-09 .0552203 -.3717208 .2802565

33

. xtsum state year vfr beertax

Variable | Mean Std. Dev. Min Max | Observations-----------------+--------------------------------------------+----------------state overall | 30.1875 15.30985 1 56 | N = 336 between | 15.44883 1 56 | n = 48 within | 0 30.1875 30.1875 | T = 7 | |year overall | 1985 2.002983 1982 1988 | N = 336 between | 0 1985 1985 | n = 48 within | 2.002983 1982 1988 | T = 7 | |vfr overall | 2.040444 .5701938 .82121 4.21784 | N = 336 between | .5461407 1.110077 3.653197 | n = 48 within | .1794253 1.45556 2.962664 | T = 7 | |beertax overall | .513256 .4778442 .0433109 2.720764 | N = 336 between | .4789513 .0481679 2.440507 | n = 48 within | .0552203 .1415352 .7935126 | T = 7

. collapse beertax, by(state)

. sum

Variable | Obs Mean Std. Dev. Min Max-------------+-------------------------------------------------------- state | 48 30.1875 15.44883 1 56 beertax | 48 .513256 .4789513 .0481679 2.440507

34

. xtline beertax, overlay

. xtline beertax if state==37 | state==45 | state==13 | state==41 | state==53 | state==56, overlay

35

Panel data with Time Fixed Effects

36

Time fixed effects only

37

Two formulations

38

Estimtation of Time fixed effects

39

. tab year, gen(yr)

Year | Freq. Percent Cum.------------+----------------------------------- 1982 | 48 14.29 14.29 1983 | 48 14.29 28.57 1984 | 48 14.29 42.86 1985 | 48 14.29 57.14 1986 | 48 14.29 71.43 1987 | 48 14.29 85.71 1988 | 48 14.29 100.00------------+----------------------------------- Total | 336 100.00

. sum y*

Variable | Obs Mean Std. Dev. Min Max-------------+-------------------------------------------------------- year | 336 1985 2.002983 1982 1988 yngdrv | 336 .1859299 .0248736 .073137 .281625 yr1 | 336 .1428571 .350449 0 1 yr2 | 336 .1428571 .350449 0 1 yr3 | 336 .1428571 .350449 0 1-------------+-------------------------------------------------------- yr4 | 336 .1428571 .350449 0 1 yr5 | 336 .1428571 .350449 0 1 yr6 | 336 .1428571 .350449 0 1 yr7 | 336 .1428571 .350449 0 1

40

. xtreg vfr beertax yr2 yr3 yr4 yr5 yr6 yr7, fe robust

Fixed-effects (within) regression Number of obs = 336Group variable: state Number of groups = 48

R-sq: within = 0.0803 Obs per group: min = 7 between = 0.1101 avg = 7.0 overall = 0.0876 max = 7

F(7,47) = 4.36corr(u_i, Xb) = -0.6781 Prob > F = 0.0009

(Std. Err. adjusted for 48 clusters in state)------------------------------------------------------------------------------ | Robust vfr | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+---------------------------------------------------------------- beertax | -.6399799 .3570783 -1.79 0.080 -1.358329 .0783691 yr2 | -.0799029 .0350861 -2.28 0.027 -.1504869 -.0093188 yr3 | -.0724206 .0438809 -1.65 0.106 -.1606975 .0158564 yr4 | -.1239763 .0460559 -2.69 0.010 -.2166288 -.0313238 yr5 | -.0378645 .0570604 -0.66 0.510 -.1526552 .0769262 yr6 | -.0509021 .0636084 -0.80 0.428 -.1788656 .0770615 yr7 | -.0518038 .0644023 -0.80 0.425 -.1813645 .0777568 _cons | 2.42847 .2016885 12.04 0.000 2.022725 2.834215-------------+---------------------------------------------------------------- sigma_u | .70945965 sigma_e | .18788295 rho | .93446372 (fraction of variance due to u_i)------------------------------------------------------------------------------

41

Combining entity & time fixed effects

top related