640 likes | 936 Views
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.
E N D
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 • gen da18=(mlda<19) • gen da19=(mlda>=19)*(mlda<20) • gen da20=(mlda>=20)*(mlda<21) • gen da21=(mlda>=21)
fatality rate per 10,000 in the population • gen vfrall=10000*mrall
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==.)
mvdecode-Change numeric values to missing values • mvdecode mjailcom,mv(1)
reg vfrall beertax if (year==1988), r • dis "Adjusted Rsquared = " _result(8)
preserve • gen dvfrall = vfrall-vfrall[_n-6] • gen dbtax = beertax-beertax[_n-6]
regdvfralldbtax, r • dis "Adjusted Rsquared = " _result(8) • restore
by state, sort : egen float beertaxtest = total(beertax*(year==1982)) • browse state year beertax beertax1982
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
areg vfrall beertax y82 y83 y84 y85 y86 y87, absorb(state) r
reg vfrall beertax, r • dis "Adjusted Rsquared = " _result(8)
areg vfrall beertax y82 y83 y84 y85 y86 y87, absorb(state) r
aregvfrallbeertax da18 da19 da20 jaildcomserdvmilespdunratelincperc y82 y83 y84 y85 y86 y87, absorb(state) r
test y82 y83 y84 y85 y86 y87 • test da18 da19 da20
test jaild comserd • test unrate lincperc
areg vfrall beertax da18 da19 da20 jaild comserd vmilespd y82 y83 y84 y85 y86 y87, absorb(state) r
test y82 y83 y84 y85 y86 y87 • test da18 da19 da20 • test jaild comserd
areg vfrall beertax mlda jailcom vmilespd unrate lincperc y82 y83 y84 y85 y86 y87, absorb(state) r
test y82 y83 y84 y85 y86 y87 • test unrate lincperc
aregvfrallbeertax da18 da19 da20 jaildcomserdvmilespdunratelincperc y82 y83 y84 y85 y86 y87, absorb(state) r cluster(state)
test y82 y83 y84 y85 y86 y87 • test da18 da19 da20
test jaild comserd • test unrate lincperc