*Install necessary packages ssc install ivreg2 ssc install xtivreg2 ssc install ranktest set matsize 800 set more off use Michler_Balagtas.dta, clear ********************************************************************* ****Generate Variables for Regressions******************************* ********************************************************************* *Consumption Growth sort VDSA_HH_id tindex gen LnC_t = ln(Con_per_cap) by VDSA_HH_id: gen LnC_tp1 = LnC_t[_n+1] gen LnC = LnC_tp1-LnC_t label variable LnC "Log Consumption Growth from t to t+1" drop LnC_t LnC_tp1 order LnC, before(Stn_Name) *Scale Term gen scale_mon=( Inc_per_cap/ Con_per_cap)^2 label variable scale_mon "(Y/c)^2" *Scaled Rainfall Variable gen sP6_SD=scale_mon*SD_pre6 label variable sP6_SD "Scaled 6 Month Rainfall Variance" gen sP4_SD=scale_mon*SD_pre4 label variable sP4_SD "Scaled 4 Month Rainfall Variance" *Generate village time interactions terms xi I.Vil_id*I.tindex, prefix(X_) ********************************************************************* ****Table 1********************************************************** ********************************************************************* sort Quarter by Quarter: sum Inc_per_cap Con_per_cap Land pre_6mon scale_mon sP6_SD ********************************************************************* ****Table 2********************************************************** ********************************************************************* xtset VDSA_HH_id tindex ****OLS Regression, Panel A, Column 1******************************** reg LnC sP6_SD Land X_Vil_id_102-X_VilXtin_112_32, vce(cluster VDSA_HH_id) ****First Stage IV, Panel B, Column 2******************************** *Generate Variables for IV sort VDSA_HH_id tindex by VDSA_HH_id: gen scale_t1=scale_mon[_n-1] label variable scale_t1 "1 mon lag of scale term" by VDSA_HH_id: gen scale_t2=scale_mon[_n-2] label variable scale_t2 "2 mon lag of scale term" order scale_t1 scale_t2, after(sP4_SD) regress scale_mon scale_t1 scale_t2 Land X_Vil_id_102-X_VilXtin_112_32, cluster( VDSA_HH_id ) *generate IV predict double IVhat label variable IVhat "predicted value for scaled term" gen IV_P6=IVhat*SD_pre6 label variable IV_P6 "IV of Scaled Term" ****IV Regression, Panel A, Column 2********************************* ivregress gmm LnC Land X_Vil_id_102-X_VilXtin_112_32 (sP6_SD = IV_P6), wmatrix(cluster VDSA_HH_id ) ****FD Regression, Panel A, Column 3********************************* reg d.LnC d.sP6_SD d.Land X_Vil_id_102-X_VilXtin_112_32, vce(cluster VDSA_HH_id ) ****First Stage FDIV, Panel B, Column 2****************************** *generate FDIV regress d.scale_mon scale_t1 scale_t2 d.Land X_Vil_id_102-X_VilXtin_112_32, vce(cluster VDSA_HH_id ) predict double dIVhat label variable dIVhat "First Difference predicted value for scaled term" *generate FDIV gen dIV_P6=dIVhat*SD_pre6 label variable dIV_P6 "First Difference IV of Scaled Term" order dIVhat dIV_P6, before(X_Vil_id_102) ****FDIV Regression, Panel A, Column 4******************************* ivregress gmm d.LnC d.Land X_Vil_id_102-X_VilXtin_112_32 (d.sP6_SD = dIV_P6), wmatrix(cluster VDSA_HH_id ) ********************************************************************* ****Generate Variables for Quartile Regressions********************** ********************************************************************* gen scale_1 = scale_mon if Inc_quart==1 replace scale_1 = 0 if Inc_quart!=1 gen scale_2 = scale_mon if Inc_quart==2 replace scale_2 = 0 if Inc_quart!=2 gen scale_3 = scale_mon if Inc_quart==3 replace scale_3 = 0 if Inc_quart!=3 gen scale_4 = scale_mon if Inc_quart==4 replace scale_4 = 0 if Inc_quart!=4 order scale_1 scale_2 scale_3 scale_4, after( scale_mon ) *Scaled Rainfall Variable gen s_1_P6_SD=scale_1*SD_pre6 label variable s_1_P6_SD "Quartile 1 Scaled 6 Month Rainfall Variance" gen s_2_P6_SD=scale_2*SD_pre6 label variable s_2_P6_SD "Quartile 2 Scaled 6 Month Rainfall Variance" gen s_3_P6_SD=scale_3*SD_pre6 label variable s_3_P6_SD "Quartile 3 Scaled 6 Month Rainfall Variance" gen s_4_P6_SD=scale_4*SD_pre6 label variable s_4_P6_SD "Quartile 4 Scaled 6 Month Rainfall Variance" ********************************************************************* ****Table 4********************************************************** ********************************************************************* ****OLS Regression, Column 1***************************************** reg LnC s_1_P6_SD s_2_P6_SD s_3_P6_SD s_4_P6_SD Land I.Vil_id##I.tindex, vce(cluster VDSA_HH_id) ****First Stage IV, Not reported************************************* *IV for Correlated Measurement Errors by VDSA_HH_id: gen scale_1_t1=scale_1[_n-1] label variable scale_1_t1 "Quartile 1 1 mon lag of scale term" by VDSA_HH_id: gen scale_1_t2=scale_1[_n-2] label variable scale_1_t2 "Quartile 1 2 mon lag of scale term" by VDSA_HH_id: gen scale_2_t1=scale_2[_n-1] label variable scale_2_t1 "Quartile 2 1 mon lag of scale term" by VDSA_HH_id: gen scale_2_t2=scale_2[_n-2] label variable scale_2_t2 "Quartile 2 2 mon lag of scale term" by VDSA_HH_id: gen scale_3_t1=scale_3[_n-1] label variable scale_3_t1 "Quartile 3 1 mon lag of scale term" by VDSA_HH_id: gen scale_3_t2=scale_3[_n-2] label variable scale_3_t2 "Quartile 3 2 mon lag of scale term" by VDSA_HH_id: gen scale_4_t1=scale_4[_n-1] label variable scale_4_t1 "Quartile 4 1 mon lag of scale term" by VDSA_HH_id: gen scale_4_t2=scale_4[_n-2] label variable scale_4_t2 "Quartile 4 2 mon lag of scale term" order scale_t1 scale_t2 scale_1_t1 scale_1_t2 scale_2_t1 scale_2_t2 scale_3_t1 scale_3_t2 scale_4_t1 scale_4_t2, after(s_4_P6_SD) *generate IV IVs regress scale_1 scale_1_t1 scale_1_t2 Land I.Vil_id##I.tindex, cluster( VDSA_HH_id ) predict double IV_1hat label variable IV_1hat "Quartile 1 predicted value for scaled term" regress scale_2 scale_2_t1 scale_2_t2 Land I.Vil_id##I.tindex, cluster( VDSA_HH_id ) predict double IV_2hat label variable IV_2hat "Quartile 2 predicted value for scaled term" regress scale_3 scale_3_t1 scale_3_t2 Land I.Vil_id##I.tindex, cluster( VDSA_HH_id ) predict double IV_3hat label variable IV_3hat "Quartile 3 predicted value for scaled term" regress scale_4 scale_4_t1 scale_4_t2 Land I.Vil_id##I.tindex, cluster( VDSA_HH_id ) predict double IV_4hat label variable IV_4hat "Quartile 4 predicted value for scaled term" *generate IV interactions gen IV_1_P6=IV_1hat*SD_pre6 if Inc_quart==1 replace IV_1_P6=0 if Inc_quart!=1 label variable IV_1_P6 "Quartile 1 IV of Scaled Term" gen IV_2_P6=IV_2hat*SD_pre6 if Inc_quart==2 replace IV_2_P6=0 if Inc_quart!=2 label variable IV_2_P6 "Quartile 2 IV of Scaled Term" gen IV_3_P6=IV_3hat*SD_pre6 if Inc_quart==3 replace IV_3_P6=0 if Inc_quart!=3 label variable IV_3_P6 "Quartile 3 IV of Scaled Term" gen IV_4_P6=IV_4hat*SD_pre6 if Inc_quart==4 replace IV_4_P6=0 if Inc_quart!=4 label variable IV_4_P6 "Quartile 4 IV of Scaled Term" order IVhat IV_1hat IV_2hat IV_3hat IV_4hat IV_P6 IV_1_P6 IV_2_P6 IV_3_P6 IV_4_P6, after(scale_4_t2) ****IV Regression, Column 2****************************************** ivregress gmm LnC Land X_Vil_id_102-X_VilXtin_112_32 (s_1_P6_SD s_2_P6_SD s_3_P6_SD s_4_P6_SD = IV_1_P6 IV_2_P6 IV_3_P6 IV_4_P6), wmatrix(cluster VDSA_HH_id ) ****FD Regression, Column 3****************************************** reg d.LnC d.s_1_P6_SD d.s_2_P6_SD d.s_3_P6_SD d.s_4_P6_SD d.Land I.Vil_id##I.tindex, vce(cluster VDSA_HH_id ) ****First Stage FDIV, Not reported*********************************** *generate FDIV IVs regress d.scale_1 scale_1_t1 scale_1_t2 d.Land I.Vil_id##I.tindex, cluster( VDSA_HH_id ) predict double dIV_1hat label variable dIV_1hat "Quartile 1 FD predicted value for scaled term" regress d.scale_2 scale_2_t1 scale_2_t2 d.Land I.Vil_id##I.tindex, cluster( VDSA_HH_id ) predict double dIV_2hat label variable dIV_2hat "Quartile 2 FD predicted value for scaled term" regress d.scale_3 scale_3_t1 scale_3_t2 d.Land I.Vil_id##I.tindex, cluster( VDSA_HH_id ) predict double dIV_3hat label variable dIV_3hat "Quartile 3 FD predicted value for scaled term" regress d.scale_4 scale_4_t1 scale_4_t2 d.Land I.Vil_id##I.tindex, cluster( VDSA_HH_id ) predict double dIV_4hat label variable dIV_4hat "Quartile 4 FD predicted value for scaled term" *generate FDIV interactions gen dIV_1_P6=dIV_1hat*SD_pre6 if Inc_quart==1 replace dIV_1_P6=0 if Inc_quart!=1 label variable dIV_1_P6 "Quartile 1 FD IV of Scaled Term" gen dIV_2_P6=dIV_2hat*SD_pre6 if Inc_quart==2 replace dIV_2_P6=0 if Inc_quart!=2 label variable dIV_2_P6 "Quartile 2 FD IV of Scaled Term" gen dIV_3_P6=dIV_3hat*SD_pre6 if Inc_quart==3 replace dIV_3_P6=0 if Inc_quart!=3 label variable dIV_3_P6 "Quartile 3 FD IV of Scaled Term" gen dIV_4_P6=dIV_4hat*SD_pre6 if Inc_quart==4 replace dIV_4_P6=0 if Inc_quart!=4 label variable dIV_4_P6 "Quartile 4 FD IV of Scaled Term" order IVhat dIV_1hat dIV_2hat dIV_3hat dIV_4hat dIV_P6 dIV_1_P6 dIV_2_P6 dIV_3_P6 dIV_4_P6, before(X_Vil_id_102) ****FDIV Regression, Column 4**************************************** ivregress gmm d.LnC d.Land X_Vil_id_102-X_VilXtin_112_32 (d.s_1_P6_SD d.s_2_P6_SD d.s_3_P6_SD d.s_4_P6_SD = dIV_1_P6 dIV_2_P6 dIV_3_P6 dIV_4_P6), wmatrix(cluster VDSA_HH_id )