* Set your working directory cd "/Users/bernardofanfani/Desktop/teaching/research_topics_labor/lab_7/seventh_lab" cap log close log using "lecture_7.log", replace ********************************************* * FIRST EXAMPLE: /* Application of the DD method to Lalonde's (1985) data to estimate the effect of NWD program participation on income. */ * We open the Lalonde (1985) database. use t1_lalonde_nsw, clear des * we generate outcome Y as income in 1975. gen Y = re75 * we generate a variable t equal to the year 1975 gen t = 1975 * we generate a variable X =1 if the person participates in the NWD gen X = treat * we keep only these variables and save the database keep Y t X describe save panel1975.dta, replace * we open the Lalonde database again (1985) and repeat for 1978. use t1_lalonde_nsw, clear des * we generate outcome Y as income in 1978. gen Y = re78 * we generate a variable t equal to the year 1978 gen t = 1978 * we generate a variable X =1 if the person participates in the NWD gen X = treat * we keep only these variables and append the panel 1975 keep Y t X describe append using panel1975.dta des ta t ta X su Y * DiD regression can be estimated as: reg Y i.X##i.t ********************************************* * SECOND EXAMPLE: /* Application of the DiD method based on the paper Draca, Mirko, Stephen Machin and John Van Reenen. 2011. "Minimum Wages and Firm Profitability." American Economic Journal: Applied Economics, 3(1): 129-51. */ use "draca_etal_2011_AEJ.dta", clear describe ta year * Definition of treatment group. * firms with average wage less than or = 12 thousand in 1999 are X=1 gen treat = 1 if avwage<=12 & year==1999 * firms with average wages between 12 and 20 thousand in 1999 are the control group replace treat = 0 if avwage>12 & avwage <= 20 & year==1999 * we now assign treatment to years other than 1999. * if a firm is treat=1 in 1999 -> treat=1 in all other years * if a firm is treat=0 in 1999 -> treat=0 in all other years sort regno treat by regno: replace treat = treat[1] * After Policy Dummy gen post = 1 if year >= 2000 replace post = 0 if year >= 1997 & year < 2000 * Interaction gen post_treat = treat * post ***** * ESTIMATES OF THE DD EFFECTS OF THE MINIMUM WAGE ON AVERAGE WAGES AND PROFITS. * Has the minimum wage had any effect on the average wage of firms? * * Log Wages reg ln_avwage post_treat post treat if pp==1,cluster(regno) * we can include other independent variables to make the DD hypothesis more credible... reg ln_avwage post_treat post treat NMW grad2 unionmem ptwk female i.sic2 i.year i.gorwk if pp==1,cluster(regno) * Has the minimum wage had any effect on corporate profits? * * Log profit margin reg net_pcm post_treat post treat if pp==1,cluster(regno) * se includiamo altre variabili dipendenti... reg net_pcm post_treat post treat NMW grad2 unionmem ptwk female i.sic2 i.year i.gorwk if pp==1,cluster(regno) ***** * EVENT STUDY SPECIFICATION (not performed in the Draca et al. paper) * this specification allows testing for the presence of * "parallel trends" reg net_pcm i.year##i.treat if pp==1, cluster(regno) * we can graph the coefficients. * first we install this useful command to produce the graphs ssc install coefplot, replace coefplot, vertical yline(0, lcolor(red)) /// title("Placebo and year-specific DD effects on profits") subtitle("Differenza condizionata crescita profitti rispetto al 1997 tra X=1 e X=0") /// keep(1997.year#1.treat 1998.year#1.treat 1999.year#1.treat 2000.year#1.treat 2001.year#1.treat 2002.year#1.treat) /// rename(1997.year#1.treat="1997" 1998.year#1.treat="1998" 1999.year#1.treat="1999" 2000.year#1.treat="2000 (post)" 2001.year#1.treat="2001 (post)" 2002.year#1.treat="2002 (post)") * We also test this specification for wages. reg ln_avwage i.year##i.treat if pp==1, cluster(regno) coefplot, vertical yline(0, lcolor(red)) /// title("Placebo and year-specific DD effects on average wages") /// keep(1997.year#1.treat 1998.year#1.treat 1999.year#1.treat 2000.year#1.treat 2001.year#1.treat 2002.year#1.treat) /// rename(1997.year#1.treat="1997" 1998.year#1.treat="1998" 1999.year#1.treat="1999" 2000.year#1.treat="2000 (post)" 2001.year#1.treat="2001 (post)" 2002.year#1.treat="2002 (post)") *** TABLE 3: PLACEBO EXPERIMENT FOR WAGES AND PROFITS (this is included in the Draca et al. paper) **Placebo Policy: ff = 1 if 1/4/1993-31/3/1996 (pre-placebo policy) or 1/4/1996-31/3/1999 (post-placebo policy) * Treatment group for placebo gen plactreat = 1 if avwage<=12 & year==1996 replace plactreat = 0 if avwage>12 & avwage <= 20 & year==1999 sort regno plactreat by regno: replace plactreat = plactreat[1] * After Policy Dummy gen placpost = 1 if year >= 1997 & year <= 1999 replace placpost = 0 if year < 1997 * Interaction gen placpost_treat = plactreat * placpost * net profits reg net_pcm placpost_treat placpost plactreat,cluster(regno) reg net_pcm placpost_treat placpost plactreat NMW grad2 unionmem ptwk female i.sic2 i.year i.gorwk,cluster(regno) * Log Wages reg ln_avwage placpost_treat placpost plactreat,cluster(regno) reg ln_avwage placpost_treat placpost plactreat NMW grad2 unionmem ptwk female i.sic2 i.year i.gorwk,cluster(regno) cap log close