clear capture log close log using lab5.log, replace /*********************************************************** LAB5.DO is a STATA do-file that for Lab 5, which runs differences in differences and fixed effect models. - written by Dan Rosenbaum, 2006 Located at my web-site for this course (http://www.uncg.edu/bae/people/rosenbaum) is a file containing state-level means for various groups of single women from the 1985-1997 March CPS. The file is named welfare.raw and is stored space-delimited ASCII. Here is a short description of the variables in the order that they are found in the data. YEAR = four-digit year STATE = state of residence, alphabetical order (1-51) STCODE = state of residence, postal abbreviation KIDS = 1 if single mothers, 0 otherwise BEYONDHS = 1 if more than a high school education, 0 otherwise HOURS = average hours worked last year UR = state unemployment rate (in percentage points) WELFARE = average AFDC and Food Stamp benefits in 1996 dollars per year TAXES = average federal and state income taxes in 1996 dollars per year POP = population of group **********************************************************/ /*********************************************************** Here I change the matsize (short for matrix size, I believe, to allow more variables to be read into STATA). Note also that "set mem 200m" sets RAM allocation equal to 200 MB in case you every get an error message that says that you need more memory. ***********************************************************/ set matsize 100 /*********************************************************** Here I read in the data and keep only the observations from 1984-1986 and 1988-1990. ***********************************************************/ infile year state str2 stcode kids beyondhs hours ur welfare taxes pop /// using welfare drop if year>1990 | year==1987 sum /*********************************************************** Here I regress hours onto post86 using only single mothers with a high school education or less. ***********************************************************/ gen post86=year>1986 reg hours post86 [aweight=pop] if beyondhs==0 & kids==1 /*********************************************************** Here I run differences in differences. Note that I am restricting the sample to single women with a high school education or less. Our key variable is the kids86 interaction. ***********************************************************/ gen kids86=kids*post86 reg hours kids post86 kids86 [aweight=pop] if beyondhs==0 /*********************************************************** We can also include regressors. Here I include the state unemployment rate and its interaction with single mothers. ***********************************************************/ gen urkids=ur*kids reg hours kids post86 kids86 ur urkids [aweight=pop] if beyondhs==0 /*********************************************************** Here I run the model on single women with more than a high school education. I would expect the EITC effects to be smaller for this group. ***********************************************************/ reg hours kids post86 kids86 ur urkids [aweight=pop] if beyondhs==1 /*********************************************************** Here instead of using the interaction, I use a variable that gives total taxes. ***********************************************************/ replace taxes=taxes/1000 replace welfare=welfare/1000 reg hours taxes [aweight=pop] if beyondhs==0 /*********************************************************** The regression above gives strange results if we do not control for kids and post86. ***********************************************************/ reg hours taxes kids post86 [aweight=pop] if beyondhs==0 /*********************************************************** Now I am going to start look at fixed effect models. First, I clear the data and read it in again, so that I have all of the years. I then regress hours onto my welfare variable. ***********************************************************/ clear infile year state str2 stcode kids beyondhs hours ur welfare taxes pop /// using welfare sum reg hours welfare [aweight=pop] if beyondhs==0 & kids==1 /*********************************************************** Now I add time fixed effects. ***********************************************************/ xi: reg hours welfare i.year [aweight=pop] if beyondhs==0 & kids==1 /*********************************************************** Here I absorb the time fixed effects and then include time and state fixed effects. ***********************************************************/ areg hours welfare [aweight=pop] if beyondhs==0 & kids==1, absorb(year) xi: areg hours welfare i.year [aweight=pop] if beyondhs==0 & kids==1, absorb(stcode) /*********************************************************** Here I run a random effects model. ***********************************************************/ xi: xtreg hours welfare i.year if kids==1 & beyondhs==0, re i(state)