1 / 62

Regression with Panel Data (SW Chapter 10)

Regression with Panel Data (SW Chapter 10). summary statistics. sum year. sum state. create year dummies. gen y82=(year==1982). gen y83=(year==1983) gen y84=(year==1984) gen y85=(year==1985) gen y86=(year==1986) gen y87=(year==1987) gen y88=(year==1988). minimum legal drinking age.

tiara
Download Presentation

Regression with Panel Data (SW Chapter 10)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Regression with Panel Data(SW Chapter 10)

  2. summary statistics

  3. sum year

  4. sum state

  5. create year dummies • gen y82=(year==1982)

  6. gen y83=(year==1983) • gen y84=(year==1984) • gen y85=(year==1985) • gen y86=(year==1986) • gen y87=(year==1987) • gen y88=(year==1988)

  7. minimum legal drinking age • gen da18=(mlda<19) • gen da19=(mlda>=19)*(mlda<20) • gen da20=(mlda>=20)*(mlda<21) • gen da21=(mlda>=21)

  8. fatality rate per 10,000 in the population • gen vfrall=10000*mrall

  9. gen incperc=perinc/1000 • gen lincperc = ln(incperc) • gen vmilespd = vmiles/1000 • gen frmall = mrall/(vmiles/100000) • gen jailcom = ((jaild+comserd)>0) • gen mjailcom = (jaild==.)*(comserd==.)

  10. mvdecode-Change numeric values to missing values • mvdecode mjailcom,mv(1)

  11. replace jailcom = jailcom + mjailcom;

  12. reg vfrall beertax if (year==1982), r

  13. display

  14. display "Adjusted Rsquared = " _result(8)

  15. reg vfrall beertax if (year==1988), r • dis "Adjusted Rsquared = " _result(8)

  16. preserve • gen dvfrall = vfrall-vfrall[_n-6] • gen dbtax = beertax-beertax[_n-6]

  17. keep

  18. regdvfralldbtax, r • dis "Adjusted Rsquared = " _result(8) • restore

  19. egen-Extensions to generate

  20. by state, sort : egen float beertaxtest = total(beertax*(year==1982)) • browse state year beertax beertax1982

  21. egen beertax1988 = sum(beertax*(year==1988)) ,by(state) • egen vfrall1982 = sum(vfrall*(year==1982)) ,by(state) • egen vfrall1988 = sum(vfrall*(year==1988)) ,by(state) • gen beertax_diff=beertax1988-beertax1982 • gen vfrall_diff=vfrall1988-vfrall1982

  22. areg-Linear regression with a large dummy-variable set

  23. areg vfrall beertax, absorb(state) r

  24. areg vfrall beertax y82 y83 y84 y85 y86 y87, absorb(state) r

  25. reg vfrall beertax, r • dis "Adjusted Rsquared = " _result(8)

  26. areg vfrall beertax, absorb(state) r

  27. areg vfrall beertax y82 y83 y84 y85 y86 y87, absorb(state) r

  28. test y82 y83 y84 y85 y86 y87

  29. aregvfrallbeertax da18 da19 da20 jaildcomserdvmilespdunratelincperc y82 y83 y84 y85 y86 y87, absorb(state) r

  30. test y82 y83 y84 y85 y86 y87 • test da18 da19 da20

  31. test jaild comserd • test unrate lincperc

  32. areg vfrall beertax da18 da19 da20 jaild comserd vmilespd y82 y83 y84 y85 y86 y87, absorb(state) r

  33. test y82 y83 y84 y85 y86 y87 • test da18 da19 da20 • test jaild comserd

  34. areg vfrall beertax mlda jailcom vmilespd unrate lincperc y82 y83 y84 y85 y86 y87, absorb(state) r

  35. test y82 y83 y84 y85 y86 y87 • test unrate lincperc

  36. aregvfrallbeertax da18 da19 da20 jaildcomserdvmilespdunratelincperc y82 y83 y84 y85 y86 y87, absorb(state) r cluster(state)

  37. test y82 y83 y84 y85 y86 y87 • test da18 da19 da20

  38. test jaild comserd • test unrate lincperc

  39. Example: Traffic deaths and beer taxes in STATA

More Related