Skip to content

Commit

Permalink
Estimates using ZORI #268 #260
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagohermo committed Aug 1, 2023
1 parent 3f580b5 commit b3e4280
Show file tree
Hide file tree
Showing 11 changed files with 2,867 additions and 0 deletions.
2 changes: 2 additions & 0 deletions analysis/fd_zori/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!output/*.csv
!output/*.dta
41 changes: 41 additions & 0 deletions analysis/fd_zori/code/estimates.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
clear all
set more off
adopath + ../../../lib/stata/min_wage/ado
set maxvar 32000

program main
local instub "../../../drive/derived_large/estimation_samples"
local outstub "../output"

define_controls
local controls "`r(economic_controls)'"
local cluster = "statefips"

local mw_wkp_var "mw_wkp_F"

use "`instub'/zipcode_months.dta", clear
xtset zipcode_num year_month

gen mw_wkp_F = F4.mw_wkp_tot_17
gen mw_res_F = F4.mw_res

estimate_dist_lag_model, depvar(ln_zori_23) ///
dyn_var(`mw_wkp_var') w(4) stat_var(mw_res_F) ///
controls(`controls') absorb(year_month) ///
cluster(`cluster') model_name(time_FE)

estimate_dist_lag_model, depvar(ln_zori_23) ///
dyn_var(`mw_wkp_var') w(4) stat_var(mw_res_F) ///
controls(`controls') absorb(cbsa_num##year_month) ///
cluster(`cluster') model_name(cbsa_time_FE)

clear
foreach ff in time_FE cbsa_time_FE {
append using ../temp/estimates_`ff'.dta
}

save "`outstub'/estimates_zori.dta", replace
export delimited "`outstub'/estimates_zori.csv", replace
end

main
36 changes: 36 additions & 0 deletions analysis/fd_zori/code/figures.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
clear all
set more off
adopath + ../../../lib/stata/min_wage/ado
set maxvar 32000
set scheme s2color, permanently

program main
local instub "../output"

use "`instub'/estimates_zori.dta", replace
make_bounds

local y_label "-0.1(0.02).14"
sum at
local w = r(max)

offset_x_axis

plot_dynamics_both, model(time_FE) dyn_var(mw_wkp_F) ///
legend_dyn_var(Workplace MW (4th Lead)) y_label(`y_label') ///
color_dyn_var(navy) symbol_dyn_var(cirlce) ///
stat_var(mw_res_F) legend_stat_var(Residence MW (4th Lead)) ///
color_stat_var(maroon) symbol_stat_var(square) ///
x_label(-`w'(1)`w') name(time_FE)

plot_dynamics_both, model(cbsa_time_FE) dyn_var(mw_wkp_F) ///
legend_dyn_var(Workplace MW (4th Lead)) y_label(`y_label') ///
color_dyn_var(navy) symbol_dyn_var(cirlce) ///
stat_var(mw_res_F) legend_stat_var(Residence MW (4th Lead)) ///
color_stat_var(maroon) symbol_stat_var(square) ///
x_label(-`w'(1)`w') name(cbsa_time_FE)

end


main
40 changes: 40 additions & 0 deletions analysis/fd_zori/code/make.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /usr/bin/env python
#****************************************************
# GET LIBRARY
#****************************************************
import subprocess, shutil, os
from distutils.dir_util import copy_tree
copy_tree("../../../lib/python/gslab_make", "./gslab_make") # Copy from gslab tools stored locally
from gslab_make.get_externals import *
from gslab_make.make_log import *
from gslab_make.make_links import *
from gslab_make.make_link_logs import *
from gslab_make.run_program import *
from gslab_make.dir_mod import *

#****************************************************
# MAKE.PY STARTS
#****************************************************
# SET DEFAULT OPTIONS
set_option(link_logs_dir = '../output/')
set_option(output_dir = '../output/', temp_dir = '../temp/')
clear_dirs('../temp/')
clear_dirs('../output/')

envir_vars = os.getenv('PATH')
if envir_vars is None:
envir_vars = os.getenv('Path')

stata = "StataMP-64"
if "StataSE" in envir_vars:
stata = "StataSE-64"

start_make_logging()

run_stata(program = 'estimates.do', executable = stata)
run_stata(program = 'figures.do', executable = stata)

end_make_logging()

shutil.rmtree('gslab_make')
input('\n Press <Enter> to exit.')
Loading

0 comments on commit b3e4280

Please sign in to comment.