# # 2000 data: NAICS Based Measure
#
# # NAICS is available in CBP data post 1997.
#
#
# # cbp employment raw data
# cbp <- fread(paste0("C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Raw Data/CBP/county/cbp",substr(st_yr,3,4),"co.txt"))
# cbp[,naics:=as.numeric(naics)]
# cbp <- cbp[!is.na(naics)]
#
# cbp[,imp_emp:=n1_4*2.5+n5_9*7+n10_19*15+n20_49*35+n50_99*75+n100_249*175+n250_499*375+n500_999*750+n1000_1*1250+n1000_2*2000+n1000_3*3750+n1000_4*10000]
#
# cbp[,imp_emp:=ifelse(!is.na(emp) & emp>0,emp,imp_emp)]
#
# cbp[,fips:=paste0(str_pad(fipstate,2,"left","0"),str_pad(fipscty,3,"left","0"))]
#
# cbp <- cbp[,c("fips","naics","imp_emp")]
#
# naics_sic <- fread("David Dorn/NAICS97_6_to_SIC87_4.csv")
# cbp <- merge(cbp,naics_sic,by.x="naics",by.y="naics6",allow.cartesian = T)
# cbp[,imp_emp:=imp_emp*weight]
#
# cbp[,emp_sic_n:=sum(imp_emp),by=sic4]
# cbp[,emp_fips:=sum(imp_emp),by=fips]
#
#
#
#
# us_imports <- fread("David Dorn/Imports_from_China_by_sic87dd_1991_2014.csv")
# us_imports <- us_imports[,c("sic87dd","l_import_usch_2000","l_import_usch_2007")]
# us_imports[,chg_st_ed:=l_import_usch_2007-l_import_usch_2000]
#
#
#
# emp_naics <- merge(cbp,us_imports[,c("chg_st_ed","sic87dd")],by.x="sic4",by.y="sic87dd",all.x=T)
#
# emp_naics[,chg_per_employee:=chg_st_ed/emp_sic_n]
#
# emp_naics[,w_chg_per_employee:=chg_per_employee*imp_emp/emp_fips]
#
# # d_tradeusch_pw_dr is our approximation of d_tradeusch_pw in ADH
# emp_czone <- emp_naics[,.(import_sensitivity=sum(w_chg_per_employee,na.rm=T)),by=fips]
#
#
#
#
# # Other country IV
# imports_oth <- fread("David Dorn/Imports_from_China_by_sic87dd_1991_2014.csv")
# imports_oth <- imports_oth[,c("sic87dd","l_import_otch_2000","l_import_otch_2007")]
# imports_oth[,chg_st_ed:=l_import_otch_2007-l_import_otch_2000]
#
# cbp <- fread(paste0("C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Raw Data/CBP/county/cbp",substr(st_yr-2,3,4),"co.txt"))
# cbp[,naics:=as.numeric(naics)]
# cbp <- cbp[!is.na(naics)]
#
# cbp[,imp_emp:=n1_4*2.5+n5_9*7+n10_19*15+n20_49*35+n50_99*75+n100_249*175+n250_499*375+n500_999*750+n1000_1*1250+n1000_2*2000+n1000_3*3750+n1000_4*10000]
#
# cbp[,imp_emp:=ifelse(!is.na(emp) & emp>0,emp,imp_emp)]
#
# cbp[,fips:=paste0(str_pad(fipstate,2,"left","0"),str_pad(fipscty,3,"left","0"))]
#
# cbp <- cbp[,c("fips","naics","imp_emp")]
#
# naics_sic <- fread("David Dorn/NAICS97_6_to_SIC87_4.csv")
# cbp <- merge(cbp,naics_sic,by.x="naics",by.y="naics6",allow.cartesian = T)
# cbp[,imp_emp:=imp_emp*weight]
#
# cbp[,emp_sic_n:=sum(imp_emp),by=sic4]
# cbp[,emp_fips:=sum(imp_emp),by=fips]
#
#
# emp_naics_oc <- merge(cbp,imports_oth[,c("chg_st_ed","sic87dd")],by.x="sic4",by.y="sic87dd",all.x=T)
#
# emp_naics_oc[,chg_per_employee:=chg_st_ed/emp_sic_n]
#
# emp_naics_oc[,w_chg_per_employee:=chg_per_employee*imp_emp/emp_fips]
#
# # tradeotch_pw_lag_dr is our approximation of tradeotch_pw_lag in ADH
# emp_naics_oc <- emp_naics_oc[,.(iv_import_sensitivity=sum(w_chg_per_employee,na.rm=T)),by=fips]
#
# measures <- merge(emp_czone,emp_naics_oc,by="fips")
#
# measures[,x_bin:=ntile(import_sensitivity,3)]
# measures[,iv_bin:=ntile(iv_import_sensitivity,100)]
#
# saveRDS(measures,"measures_county_levels_sic87dd.rds")
# pop_data <- list()
#
# pop_2000 <- get_decennial(geography = "county", variables = "P001001",year = 2000)
# pop_2000 <- pop_2000[,c("GEOID","value")]
# names(pop_2000) <- c("fips","population")
# pop_2000 <- data.table(pop_2000)
# pop_2000[,fips:=as.numeric(fips)]
# pop_2000[,year:=2000]
# pop_data[[1]] <- pop_2000
#
# #https://repository.duke.edu/catalog/f49b199b-1496-4636-91f3-36226c8e7f80
# pop_csv <- fread("county_population_2000_2010.csv")
# pop_csv <- pop_csv[year %in% 2001:2009, c("fips","tot_pop","year")]
# names(pop_csv) <- c("fips","population","year")
# pop_data[[2]] <- pop_csv
#
# i=3
# for(yr in 2010:2019){
# pop <- get_acs(geography = "county", variables = c("B01003_001"), year = yr)
# pop <- data.table(pop)
# pop <- dcast(pop,GEOID~variable,value.var = "estimate",fun.aggregate = sum)
# names(pop) <- c("fips","population")
# pop[,year:=yr]
# pop_data[[i]] <- pop
# i=i+1
# }
#
# pop_data <- do.call(rbind,pop_data)
#
# pop_data[,fips:=str_pad(as.character(fips),width = 5,side = "left",pad = "0")]
#
#
#
# #https://apps.bea.gov/regional/downloadzip.cfm
# county_data <- fread("bea_data_1969_2021.csv")
#
# county_data[,variable:=ifelse(Description=="Personal income (thousands of dollars)","total_income",
# ifelse(Description=="Population (persons) 1/","population",
# ifelse(Description=="Per capita personal income (dollars) 2/","income_per_capita","")))]
#
# county_data <- county_data[variable %in% c("income_per_capita")]
# county_data[,c("GeoName","Region","TableName","LineCode","IndustryClassification","Unit","Description"):=list(NULL)]
# setnames(county_data,"GeoFIPS","fips")
#
# county_data <- melt(county_data,id.vars = c("fips","variable"))
# county_data[,value:=as.numeric(value)]
# county_data <- dcast(county_data,fips+variable.1~variable,value.var = "value",fun.aggregate = sum)
# county_data[,variable.1:=as.numeric(as.character(variable.1))]
#
# setnames(county_data,"variable.1","year")
#
# unemp <- fread("la.data.64.County.txt")
# unemp <- unemp[substr(series_id,1,5)=="LAUCN"]
# unemp[,fips:=substr(series_id,6,10)]
# unemp <- unemp[substr(series_id,19,20)=="03"]
# unemp[,value:=as.numeric(value)]
# unemp <- unemp[,.(unemp_rate=mean(value,na.rm=T)),by=.(fips,year)]
# unemp[,c("series_id","period","footnote_codes"):=list(NULL)]
#
# county_data <- merge(county_data,unemp,by=c("fips","year"))
# county_data <- merge(county_data,pop_data,by=c("fips","year"))
#
# saveRDS(county_data,"county_data.rds")
# sod <- list()
# i=1
# for(fl in list.files(path="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Raw Data/SOD/data",full.names = T)){
# sod[[i]] <- fread(fl,select = c("YEAR","CERT","DEPSUMBR","DEPSUM","RSSDHCR","RSSDID","STCNTYBR","ASSET","UNINUMBR","SIMS_ESTABLISHED_DATE","SIMS_LATITUDE","SIMS_LONGITUDE","ADDRESBR"))
# i=i+1
# }
#
# sod <- rbindlist(sod,fill=T)
#
# sod[,DEPSUMBR:=str_remove_all(DEPSUMBR,",")]
# sod[,DEPSUM:=str_remove_all(DEPSUM,",")]
# sod[,ASSET:=str_remove_all(ASSET,",")]
#
# sod[,DEPSUMBR:= as.numeric(DEPSUMBR)]
# sod[,DEPSUM:= as.numeric(DEPSUM)]
# sod[,ASSET:= as.numeric(ASSET)]
#
# sod[,fips:=str_pad(STCNTYBR,5,"left","0")]
# sod[,SIMS_ESTABLISHED_DATE:=as.Date(SIMS_ESTABLISHED_DATE,"%m/%d/%Y")]
#
# sod[,br_id:=paste0(tolower(ADDRESBR),round(SIMS_LATITUDE,1),round(SIMS_LONGITUDE,1))]
#
#
#
#
# br <- list()
# i <- 1
# for(yr in 2001:2020){
# temp <- sod[YEAR==yr]
# temp_p <- sod[YEAR==(yr-1)]
# temp_a <- sod[YEAR==(yr+1)]
#
# # openings <- temp[year(SIMS_ESTABLISHED_DATE)==yr]
# openings <- temp[DEPSUMBR> 0 & !UNINUMBR %in% temp_p[DEPSUMBR> 0]$UNINUMBR]
# openings <- rbind(openings,temp[DEPSUMBR> 0 & !br_id %in% temp_p[DEPSUMBR> 0]$br_id])
# openings <- openings[!duplicated(openings)]
# openings <- openings[,.(openings=.N),by=fips]
#
#
# closings <- temp[DEPSUMBR> 0 & !UNINUMBR %in% temp_a[DEPSUMBR> 0]$UNINUMBR]
# closings <- rbind(closings,temp[DEPSUMBR> 0 & !br_id %in% temp_a[DEPSUMBR> 0]$br_id])
# closings <- closings[!duplicated(closings)]
# closings <- closings[,.(closings=.N),by=fips]
#
# temp<- data.table(fips=unique(sod$fips),YEAR=yr)
# temp <- merge(temp,openings,by="fips",all.x = T)
# temp <- merge(temp,closings,by="fips",all.x = T)
# temp[is.na(temp)] <- 0
#
# br[[i]] <- temp
# i=i+1
# }
#
# br <- do.call(rbind,br)
# setorder(br,fips,YEAR)
#
#
# saveRDS(sod,"sod_sum.rds")
# saveRDS(br,"br_open_close.rds")
measures <- readRDS("measures_county_levels_sic87dd.rds")
measures[,import_sensitivity:=(import_sensitivity-min(measures$import_sensitivity,na.rm=T)+1)]
measures[,iv_import_sensitivity:=(iv_import_sensitivity-min(measures$iv_import_sensitivity,na.rm=T)+1)]
measures[,high_x:=ntile(import_sensitivity,2)]
measures[,is_q:=ntile(import_sensitivity,4)]
measures[,is_top_q:=ifelse(is_q==4,1,0)]
measures[,iv_q:=ntile(iv_import_sensitivity,4)]
measures[,iv_top_q:=ifelse(iv_q==4,1,0)]
county_data <- readRDS("county_data.rds")
sod <- readRDS("sod_sum.rds")
us_imports_china <- fread("us_imports_china.csv")
ggplot(us_imports_china,aes(x=year,y=ch_imports_bn))+
geom_rect(mapping=aes(xmin=2000, xmax=2008, ymin=0, ymax=550),fill="gray90", alpha=0.9)+
geom_line()+geom_point()+
theme_minimal()+labs(x="",y="USD billions",title="U.S. imports of trade goods from China ")
Import sensitivity for each county was calculated by following
Autor,Dorn, and Hanson (2013). Data period 2000 to 2007.
Counties are categorized in to three groups: 1 - lowest third
sensitivity, 2 - middle third senstivitiy, 3 - top third sensitivity
County-level per capita number of branches and per capita deposits were normalized using the year 2000 values.
sod_county_year <- sod[,.(no_branches=.N,total_deposits=sum(DEPSUMBR,na.rm=T)),by=.(fips,YEAR)]
sod_county_year <- merge(sod_county_year,measures,by="fips")
sod_county_year <- merge(sod_county_year,county_data,by.y=c("fips","year"),by.x=c("fips","YEAR"))
sod_county_year[,no_branches:=no_branches/population]
sod_county_year[,total_deposits:=total_deposits/population]
sod_cy_sum <- sod_county_year[,.(no_branches=mean(no_branches),total_deposits=median(total_deposits)),by=.(YEAR,x_bin)]
temp <-sod_cy_sum[YEAR==2000,c("x_bin","no_branches","total_deposits")]
names(temp) <- c("x_bin","no_branches_st","total_deposits_st")
sod_cy_sum <- merge(sod_cy_sum,temp,by="x_bin")
sod_cy_sum[,no_branches:=no_branches/no_branches_st]
sod_cy_sum[,total_deposits:=total_deposits/total_deposits_st]
ggplot(sod_cy_sum[YEAR>=2000],aes(x=YEAR,y=no_branches,color=factor(x_bin)))+geom_line()+geom_point()+
theme_minimal()+
theme(legend.position = "bottom")+
ggtitle("Per capita number of branches")
ggplot(sod_cy_sum[YEAR>=2000 & YEAR<2020],aes(x=YEAR,y=total_deposits,color=factor(x_bin)))+geom_line()+geom_point()+
theme_minimal()+
theme(legend.position = "bottom")+
ggtitle("Per capita deposits")
sod_county_year <- sod[,.(bank_deposits=sum(DEPSUMBR,na.rm=T)),by=.(fips,YEAR,RSSDID)]
sod_county_year[,total_deposits:=sum(bank_deposits,na.rm=T),by=.(fips,YEAR)]
sod_county_year[,mkt_share2:=bank_deposits/total_deposits]
sod_county_year[,mkt_share2:=mkt_share2*mkt_share2]
sod_hhi <- sod_county_year[,.(hhi=sum(mkt_share2,na.rm = T)),by=.(fips,YEAR)]
sod_hhi <- merge(sod_hhi,measures,by="fips")
sod_hhi[, hhi := Winsorize(hhi, probs = c(0.025,0.975), na.rm = TRUE)]
sod_hhi <- sod_hhi[,.(hhi_mean=mean(hhi),hhi_median=median(hhi),hhi_q1=quantile(hhi,0.25),hhi_q3=quantile(hhi,0.75)),by=.(YEAR,x_bin)]
temp <-sod_hhi[YEAR==2000,c("x_bin","hhi_mean","hhi_median")]
names(temp) <- c("x_bin","hhi_mean_st","hhi_median_st")
sod_hhi <- merge(sod_hhi,temp,by="x_bin")
sod_hhi[,hhi_mean:=hhi_mean/hhi_mean_st]
sod_hhi[,hhi_median:=hhi_median/hhi_median_st]
ggplot(sod_hhi[YEAR>=2000 & YEAR<2020],aes(x=YEAR,y=hhi_mean,color=factor(x_bin)))+geom_line()+geom_point()+
theme_minimal()+
theme(legend.position = "bottom")+
ggtitle("Deposit concentration")
sod_county_year <- sod[,.(bank_deposits=sum(DEPSUMBR,na.rm=T)),by=.(fips,YEAR,RSSDID)]
sod_county_year[,total_deposits:=sum(bank_deposits,na.rm=T),by=.(fips,YEAR)]
sod_county_year[,mkt_share2:=bank_deposits/total_deposits]
sod_county_year[,mkt_share2:=mkt_share2*mkt_share2]
sod_hhi <- sod_county_year[,.(hhi=sum(mkt_share2,na.rm = T)),by=.(fips,YEAR)]
sod_chg <- sod[,.(no_branches=.N,total_deposits=sum(DEPSUMBR,na.rm=T)),by=.(fips,YEAR)]
sod_chg <- merge(sod_chg,county_data,by.x=c("fips","YEAR"),by.y = c("fips","year"))
sod_chg <- merge(sod_chg,sod_hhi,by= c("fips","YEAR"))
setorder(sod_chg,fips,YEAR)
sod_chg[,no_branches:=no_branches/population]
sod_chg[,total_deposits:=total_deposits/population]
sod_chg[,hhi_lag:=shift(hhi),by=fips]
sod_chg[,no_branches_lag:=shift(no_branches),by=fips]
sod_chg[,total_deposits_lag:=shift(total_deposits),by=fips]
sod_chg[,delta_hhi:=hhi/hhi_lag]
sod_chg[,delta_no_branches:=no_branches/no_branches_lag]
sod_chg[,delta_total_deposits:=total_deposits/total_deposits_lag]
sod_chg <- merge(sod_chg,measures,by="fips")
sod_chg[,state:=substr(fips,1,2)]
sod_chg[,state_yr:=paste(state,YEAR)]
r <- list()
r[[1]] <- felm(log(delta_no_branches)~is_top_q|YEAR|0|fips,data=sod_chg[YEAR %in% 2000:2007])
r[[2]] <- felm(log(delta_total_deposits)~is_top_q|YEAR|0|fips,data=sod_chg[YEAR %in% 2000:2007])
r[[3]] <- felm(log(delta_hhi)~is_top_q|YEAR|0|fips,data=sod_chg[YEAR %in% 2000:2007])
r[[4]] <- felm(log(delta_no_branches)~is_top_q|YEAR|0|fips,data=sod_chg[YEAR %in% 2008:2019])
r[[5]] <- felm(log(delta_total_deposits)~is_top_q|YEAR|0|fips,data=sod_chg[YEAR %in% 2008:2019])
r[[6]] <- felm(log(delta_hhi)~is_top_q|YEAR|0|fips,data=sod_chg[YEAR %in% 2008:2019])
stargazer(r,type="text",omit.stat = "ser",column.labels = c("2000-2007","2008-2019"),column.separate = c(3,3))
##
## ============================================================================================================================================
## Dependent variable:
## -------------------------------------------------------------------------------------------------------------------------------
## log(delta_no_branches) log(delta_total_deposits) log(delta_hhi) log(delta_no_branches) log(delta_total_deposits) log(delta_hhi)
## 2000-2007 2008-2019
## (1) (2) (3) (4) (5) (6)
## --------------------------------------------------------------------------------------------------------------------------------------------
## is_top_q -0.004*** -0.005*** 0.002* -0.001* -0.005*** -0.001
## (0.001) (0.001) (0.001) (0.001) (0.001) (0.001)
##
## --------------------------------------------------------------------------------------------------------------------------------------------
## Observations 19,277 19,277 19,277 33,019 33,019 33,019
## R2 0.002 0.013 0.002 0.015 0.007 0.003
## Adjusted R2 0.002 0.013 0.001 0.014 0.007 0.002
## ============================================================================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
main_st <- 2008
main_ed <- 2019
cont_st <- 2000
cont_ed <- 2007
# all 2008-2019
sod_st <- sod[YEAR==main_st,.(no_branches_st=.N,total_deposits_st=sum(DEPSUMBR,na.rm=T)),by=fips]
sod_st <- merge(sod_st,county_data[year==main_st],by="fips")
sod_st[,no_branches_pc_st:=no_branches_st/population]
sod_st[,total_deposits_pc_st:=total_deposits_st/population]
setnames(sod_hhi,"hhi","hhi_st")
sod_st <- merge(sod_st,sod_hhi[YEAR==main_st],by=c("fips"))
sod_ed <- sod[YEAR==main_ed,.(no_branches_ed=.N,total_deposits_ed=sum(DEPSUMBR,na.rm=T)),by=fips]
sod_ed <- merge(sod_ed,county_data[year==main_ed],by="fips")
sod_ed[,no_branches_pc_ed:=no_branches_ed/population]
sod_ed[,total_deposits_pc_ed:=total_deposits_ed/population]
setnames(sod_ed,c("income_per_capita","unemp_rate","population"),c("income_per_capita_ed","unemp_rate_ed","population_ed"))
setnames(sod_hhi,"hhi_st","hhi_ed")
sod_st <- merge(sod_st,sod_hhi[YEAR==main_ed],by=c("fips"))
sod_chg <- merge(sod_st,sod_ed,by="fips")
sod_chg[,sod_br_change:=no_branches_ed*100/no_branches_st-1]
sod_chg[,sod_deposit_change:=total_deposits_ed*100/total_deposits_st-1]
sod_chg[,sod_br_change_pc:=no_branches_pc_ed*100/no_branches_pc_st-1]
sod_chg[,sod_deposit_change_pc:=total_deposits_pc_ed*100/total_deposits_pc_st-1]
sod_chg[,hhi_change:=hhi_ed*100/hhi_st-1]
# all banks 2000-2008
sod_st <- sod[YEAR==cont_st,.(no_branches_st=.N,total_deposits_st=sum(DEPSUMBR,na.rm=T)),by=fips]
setnames(sod_hhi,"hhi_ed","hhi_st")
sod_st <- merge(sod_st,sod_hhi[YEAR==cont_st],by=c("fips"))
sod_ed <- sod[YEAR==cont_ed,.(no_branches_ed=.N,total_deposits_ed=sum(DEPSUMBR,na.rm=T)),by=fips]
setnames(sod_hhi,"hhi_st","hhi_ed")
sod_st <- merge(sod_st,sod_hhi[YEAR==cont_ed],by=c("fips"))
sod_chg_s <- merge(sod_st,sod_ed)
sod_chg_s[,sod_br_change_cont:=no_branches_ed*100/no_branches_st-1]
sod_chg_s[,sod_deposit_change_cont:=total_deposits_ed*100/total_deposits_st-1]
sod_chg_s[,hhi_change_cont:=hhi_ed*100/hhi_st-1]
sod_chg_s <- sod_chg_s[,c("fips","sod_br_change_cont","sod_deposit_change_cont","hhi_change_cont")]
reg_sample <- merge(sod_chg,sod_chg_s,by="fips",all.x=T)
reg_sample <- merge(reg_sample,measures,by="fips")
reg_sample[,import_sensitivity:=(import_sensitivity-min(reg_sample$import_sensitivity,na.rm=T)+1)]
reg_sample[,iv_import_sensitivity:=(iv_import_sensitivity-min(reg_sample$iv_import_sensitivity,na.rm=T)+1)]
reg_sample[,statefips:=substr(fips,1,2)]
This is similar to main results of Autor,Dorn, and Hanson
(2013), but at county-level.
log(import sensitivity) is instrumented using
log(iv import sensitivity) which is based on the import
growth in other developed countries. (same as Autor,Dorn, and Hanson
(2013))
log-log specification has more first stage power.
ggplot(reg_sample[log(iv_import_sensitivity)>1 & log(iv_import_sensitivity)<2.5],aes(x=log(iv_import_sensitivity),y=log(import_sensitivity)))+geom_point()+geom_smooth(method="lm")
var_list <- c("sod_br_change","sod_br_change_pc","sod_deposit_change","sod_deposit_change_pc","hhi_change","population","income_per_capita","import_sensitivity","iv_import_sensitivity")
stargazer(reg_sample[,..var_list],type="text",summary.stat = c("mean","sd","p25","median","p75","N"))
##
## ============================================================================
## Statistic Mean St. Dev. Pctl(25) Median Pctl(75) N
## ----------------------------------------------------------------------------
## sod_br_change 88.593 17.176 78.851 89.476 99.000 2,747
## sod_br_change_pc 87.814 18.186 76.413 87.751 99.908 2,747
## sod_deposit_change 133.560 46.108 111.904 127.371 146.880 2,747
## sod_deposit_change_pc 131.313 39.927 112.738 127.168 143.827 2,747
## hhi_change 107.430 27.173 93.006 102.559 117.198 2,747
## population 86,658.340 228,507.200 11,103 25,981 64,391 2,747
## income_per_capita 33,771.630 8,775.446 28,247.5 32,400 37,330 2,747
## import_sensitivity 14.522 4.979 12.747 13.561 14.940 2,747
## iv_import_sensitivity 4.659 3.436 3.162 3.915 5.150 2,747
## ----------------------------------------------------------------------------
The first table below regresses the change in number of branches at
county level from 2008 to 2019. Column 4 uses
per capita
branches change
controls = "log(income_per_capita)+log(population)"
r <- list()
r[[1]] <- felm(sod_br_change_cont~is_top_q+log(income_per_capita)+log(population)|statefips|0|statefips,data=reg_sample)
r[[2]] <- felm(sod_deposit_change_cont~is_top_q+log(income_per_capita)+log(population)|statefips|0|statefips,data=reg_sample)
r[[3]] <- felm(hhi_change_cont~is_top_q+log(income_per_capita)+log(population)|statefips|0|statefips,data=reg_sample)
r[[4]] <- felm(sod_br_change_pc~is_top_q+log(income_per_capita)+log(population)|statefips|0|statefips,data=reg_sample)
r[[5]] <- felm(sod_deposit_change_pc~is_top_q+log(income_per_capita)+log(population)|statefips|0|statefips,data=reg_sample)
r[[6]] <- felm(hhi_change~is_top_q+log(income_per_capita)+log(population)|statefips|0|statefips,data=reg_sample)
stargazer(r,type="text",omit.stat = "ser",no.space = T,column.labels = c("2000-2007","2008-2019"),column.separate = c(3,3))
##
## ===================================================================================================================================
## Dependent variable:
## ------------------------------------------------------------------------------------------------------------
## sod_br_change_cont sod_deposit_change_cont hhi_change_cont sod_br_change_pc sod_deposit_change_pc hhi_change
## 2000-2007 2008-2019
## (1) (2) (3) (4) (5) (6)
## -----------------------------------------------------------------------------------------------------------------------------------
## is_top_q -0.893 0.061 2.452** 0.410 -0.785 -1.317
## (0.924) (3.326) (1.173) (0.747) (2.192) (1.512)
## log(income_per_capita) 13.269*** 37.849*** -0.423 -0.756 25.548*** -8.547**
## (2.781) (8.484) (2.752) (2.110) (4.639) (4.052)
## log(population) 3.950*** 10.122*** 0.594 -3.642*** 1.313 0.557
## (0.921) (2.345) (0.870) (0.373) (1.177) (0.596)
## -----------------------------------------------------------------------------------------------------------------------------------
## Observations 2,745 2,745 2,745 2,747 2,747 2,747
## R2 0.127 0.168 0.038 0.235 0.142 0.043
## Adjusted R2 0.113 0.155 0.022 0.223 0.127 0.027
## ===================================================================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
r <- list()
r[[1]] <- felm(sod_br_change_cont~log(income_per_capita)+log(population)|statefips|(log(import_sensitivity)~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[2]] <- felm(sod_deposit_change_cont~log(income_per_capita)+log(population)|statefips|(log(import_sensitivity)~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[3]] <- felm(hhi_change_cont~log(income_per_capita)+log(population)|statefips|(log(import_sensitivity)~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[4]] <- felm(sod_br_change_pc~log(income_per_capita)+log(population)|statefips|(log(import_sensitivity)~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[5]] <- felm(sod_deposit_change_pc~log(income_per_capita)+log(population)|statefips|(log(import_sensitivity)~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[6]] <- felm(hhi_change~log(income_per_capita)+log(population)|statefips|(log(import_sensitivity)~log(iv_import_sensitivity))|statefips,data=reg_sample)
stargazer(r,type="text",omit.stat = "ser",no.space = T,column.labels = c("2000-2007","2008-2019"),column.separate = c(3,3))
##
## ===========================================================================================================================================
## Dependent variable:
## ------------------------------------------------------------------------------------------------------------
## sod_br_change_cont sod_deposit_change_cont hhi_change_cont sod_br_change_pc sod_deposit_change_pc hhi_change
## 2000-2007 2008-2019
## (1) (2) (3) (4) (5) (6)
## -------------------------------------------------------------------------------------------------------------------------------------------
## log(income_per_capita) 12.996*** 36.985*** -0.709 -1.197 25.455*** -7.652*
## (2.702) (8.236) (2.656) (2.023) (4.715) (3.797)
## log(population) 4.051*** 10.352*** 0.595 -3.536*** 1.362 0.357
## (0.923) (2.366) (0.863) (0.369) (1.096) (0.594)
## `log(import_sensitivity)(fit)` -7.755** -14.992* 3.094 -6.368*** -4.231 11.325**
## (3.605) (7.861) (3.117) (2.089) (9.581) (4.526)
## -------------------------------------------------------------------------------------------------------------------------------------------
## Observations 2,745 2,745 2,745 2,747 2,747 2,747
## R2 0.129 0.168 0.036 0.236 0.141 0.043
## Adjusted R2 0.115 0.154 0.020 0.223 0.127 0.027
## ===========================================================================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
r <- list()
r[[1]] <- felm(sod_br_change_cont~log(income_per_capita)+log(population)|statefips|(is_top_q~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[2]] <- felm(sod_deposit_change_cont~log(income_per_capita)+log(population)|statefips|(is_top_q~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[3]] <- felm(hhi_change_cont~log(income_per_capita)+log(population)|statefips|(is_top_q~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[4]] <- felm(sod_br_change_pc~log(income_per_capita)+log(population)|statefips|(is_top_q~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[5]] <- felm(sod_deposit_change_pc~log(income_per_capita)+log(population)|statefips|(is_top_q~log(iv_import_sensitivity))|statefips,data=reg_sample)
r[[6]] <- felm(hhi_change~log(income_per_capita)+log(population)|statefips|(is_top_q~log(iv_import_sensitivity))|statefips,data=reg_sample)
stargazer(r,type="text",omit.stat = "ser",no.space = T,column.labels = c("2000-2007","2008-2019"),column.separate = c(3,3))
##
## ===================================================================================================================================
## Dependent variable:
## ------------------------------------------------------------------------------------------------------------
## sod_br_change_cont sod_deposit_change_cont hhi_change_cont sod_br_change_pc sod_deposit_change_pc hhi_change
## 2000-2007 2008-2019
## (1) (2) (3) (4) (5) (6)
## -----------------------------------------------------------------------------------------------------------------------------------
## log(income_per_capita) 12.676*** 36.366*** -0.581 -1.460 25.281*** -7.185*
## (2.728) (8.202) (2.681) (1.981) (4.766) (3.842)
## log(population) 4.012*** 10.277*** 0.610 -3.568*** 1.341 0.414
## (0.919) (2.375) (0.866) (0.370) (1.133) (0.594)
## `is_top_q(fit)` -4.043* -7.815** 1.613 -3.320*** -2.206 5.904**
## (2.013) (3.692) (1.651) (1.114) (4.879) (2.506)
## -----------------------------------------------------------------------------------------------------------------------------------
## Observations 2,745 2,745 2,745 2,747 2,747 2,747
## R2 0.124 0.166 0.038 0.229 0.141 0.032
## Adjusted R2 0.110 0.152 0.022 0.216 0.127 0.016
## ===================================================================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
measures <- readRDS("measures_county_levels_sic87dd.rds")
measures[,import_sensitivity:=(import_sensitivity-min(measures$import_sensitivity,na.rm=T)+1)]
measures[,iv_import_sensitivity:=(iv_import_sensitivity-min(measures$iv_import_sensitivity,na.rm=T)+1)]
measures[,high_x:=ntile(import_sensitivity,2)-1]
measures[,low_x:=2-high_x]
measures[,rev_x_bin:=3-x_bin]
measures[,is_q:=ntile(import_sensitivity,4)]
measures[,is_top_q:=ifelse(is_q==4,1,0)]
sod <- readRDS("sod_sum.rds")
asset_w <- sod[,c("CERT","YEAR","ASSET")]
asset_w <- asset_w[!duplicated(asset_w)]
asset_w[,tot_assets:=sum(ASSET,na.rm=T),by=YEAR]
asset_w[,w_asset:=ASSET/tot_assets]
asset_w[,q80:=quantile(ASSET,0.8,na.rm=T),by=YEAR]
asset_w[,q95:=quantile(ASSET,0.95,na.rm=T),by=YEAR]
asset_w[,size:=ifelse(ASSET <q80,1,ifelse(ASSET<q95,2,0))]
bank_import_exposure <- sod[YEAR %in% 1994:2000]
bank_import_exposure <- bank_import_exposure[,.(county_deposits=sum(DEPSUMBR,na.rm=T)),by=.(CERT,fips)]
bank_import_exposure <- merge( bank_import_exposure,measures,by="fips")
bank_import_exposure[,total_deposits:=sum(county_deposits,na.rm=T),by=CERT]
bank_import_exposure[,wa_exposure:=county_deposits*import_sensitivity/total_deposits]
bank_import_exposure <- bank_import_exposure[,.(wa_exposure=sum(wa_exposure,na.rm=T)),by=CERT]
bank_import_exposure[,exp_q:=ntile(wa_exposure,4)]
bank_import_exposure[,exp_top_q:=ifelse(exp_q==4,1,0)]
bank_import_exposure[,exp_bin:=ntile(bank_import_exposure,3)]
rw_inst <- fread("C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Raw Data/RateWatch/Deposit_InstitutionDetails.txt")
rw_inst <- rw_inst[,c("ACCT_NBR","RSSD_ID","CERT_NBR","STATE_FPS","CNTY_FPS")]
rw_inst[,fips:=paste0(str_pad(STATE_FPS,2,"left","0"),str_pad(CNTY_FPS,3,"left","0"))]
rw_inst[,c("STATE_FPS","CNTY_FPS"):=list(NULL)]
rw_summary <- readRDS("C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Raw Data/RateWatch/rate_watch_summary_12MCD10K_weekly.rds")
rw_summary[,year:=year(qtr)]
# rw_summary <- rw_summary[,.(mean_apy=mean(mean_apy,na.rm=T),median_apy=median(median_apy,na.rm=T)),by=.(year,ACCOUNTNUMBER,PRD_TYP_JOIN)]
rw_summary <- merge(rw_summary,rw_inst,by.x="ACCOUNTNUMBER",by.y="ACCT_NBR")
# rw_bank <- rw_summary[,.(mean_apy=mean(mean_apy,na.rm=T),median_apy=median(median_apy,na.rm = T)),by=.(year,PRD_TYP_JOIN,CERT_NBR)]
# rw_county <- rw_summary[,.(mean_apy=mean(mean_apy,na.rm=T),median_apy=median(median_apy,na.rm = T)),by=.(year,PRD_TYP_JOIN,fips)]
# rw_bank_county <- rw_summary[,.(mean_apy=mean(mean_apy,na.rm=T),median_apy=median(median_apy,na.rm = T)),by=.(year,PRD_TYP_JOIN,CERT_NBR,fips)]
reg_sample <- merge(measures,rw_summary,by="fips")
reg_sample <- merge(bank_import_exposure,reg_sample,by.x="CERT",by.y="CERT_NBR")
reg_sample[,fips_qt:=paste(fips,qtr)]
reg_sample[,bank_qt:=paste(CERT,qtr)]
reg_sample[,state:=substr(fips,1,2)]
reg_sample[,state_qt:=paste(state,year)]
reg_sample <- reg_sample[log(1+wa_exposure)>=2 & log(1+wa_exposure)<=4 & log(import_sensitivity)>=2 & log(import_sensitivity)<=4]
reg_sample <- merge(reg_sample,asset_w[,c("CERT","YEAR","w_asset","ASSET","size")],by.x=c("CERT","year"),by.y=c("CERT","YEAR"))
reg_sample[,is_top_q_exp_top_q:=ifelse(is_top_q==1 & exp_top_q==1,1,0)]
reg_sample[,mn:=mean(mean_apy),by=qtr]
reg_sample[,rate_diff:=mean_apy-mn]
Data: The following results are based on RateWatch data. RateWatch data starts in 2001, and provides deposit rates for different products offered by each branch weekly.
Sample: Bank-county-year-product level. For each, bank-county-year-product, mean_apy, was calculated and was used as the dependent variable. Key product types are CD, SAV, MM, and INTCK (checking).
Key variables:
import_sensitivity: County-level sensitivity to Chinese imports based on Autor et al, 2013
is_top_q: This is a dummy variable that takes the value 1 if the import_sensitivity is in the forth quartile
wa_exposure: This is a bank-level variable, which calculates the weighted average exposure to chinese imports based on the county-level deposit composition
exp_top_q: takes the value 1 if wa_exposure is in the forth quartile
Specification: County, Year, Bank, and Product type fixed effects. Standard errors clustered at bank level
Main takeaway: Banks that are more exposed to Chinese imports (based on wa_exposure) offer higher rates in counties that are less exposed to Chinese imports?
cd_rates <- reg_sample[,.(mean_apy=mean(mean_apy),sd_apy=sd(mean_apy),count=.N),by=qtr]
cd_rates <- cd_rates %>%
mutate(
lower_ci = mean_apy - 1.96 * sd_apy ,
upper_ci = mean_apy + 1.96 * sd_apy
)
ggplot(cd_rates, aes(x = qtr, y = mean_apy)) +
geom_line() +
geom_ribbon(aes(ymin = lower_ci, ymax = upper_ci), alpha = 0.3) +
labs(x = "", y = "12 Month 10k CD Rate") +
theme_minimal()
cd_rates <- reg_sample[,.(mean_apy=mean(rate_diff),sd_apy=sd(mean_apy),count=.N),by=.(year,is_top_q_exp_top_q)]
cd_rates[,mean_apy_min:=mean_apy[which.min(year)],by=is_top_q_exp_top_q]
cd_rates[,mean_apy:=mean_apy-mean_apy_min]
ggplot(cd_rates, aes(x = year, y = mean_apy,color=factor(is_top_q_exp_top_q))) +
geom_line() +
labs(x = "", y = "12 Month 10k CD Rate") +
theme_minimal()
\[ apy=log(import.sensitivity) + State*Week FE+Bank*WeekFE\]
Q: “Before going to the interaction of county exposure and bank exposure, did you first examine the effect of county exposure alone on deposit rates? Basically the same regression with county, year, bank and product type fixed effects.”
A: Not able to use county fixed effects since import sensitivity is not time varying. Used state*yr fixed effects instead
min_yr = 2000
max_yr = 2007
r <- list()
reg_formula <- as.formula("mean_apy~log(import_sensitivity)|state_qt+bank_qt|0|CERT")
r[[1]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~factor(is_q)|state_qt+bank_qt|0|CERT")
r[[2]] <- felm(reg_formula,data=reg_sample[ year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~is_top_q|state_qt+bank_qt|0|CERT")
r[[3]] <- felm(reg_formula,data=reg_sample[ year>=min_yr & year<=max_yr])
min_yr = 2008
max_yr = 2019
reg_formula <- as.formula("mean_apy~log(import_sensitivity)|state_qt+bank_qt|0|CERT")
r[[4]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~factor(is_q)|state_qt+bank_qt|0|CERT")
r[[5]] <- felm(reg_formula,data=reg_sample[ year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~is_top_q|state_qt+bank_qt|0|CERT")
r[[6]] <- felm(reg_formula,data=reg_sample[ year>=min_yr & year<=max_yr])
stargazer(r,type="text",column.labels = c("2000-2007","2008-2019"),column.separate = c(3,3),omit.stat = "ser")
##
## ===================================================================================
## Dependent variable:
## -----------------------------------------------------------
## mean_apy
## 2000-2007 2008-2019
## (1) (2) (3) (4) (5) (6)
## -----------------------------------------------------------------------------------
## log(import_sensitivity) 0.030 -0.047**
## (0.029) (0.019)
##
## factor(is_q)2 0.002 0.002
## (0.013) (0.009)
##
## factor(is_q)3 -0.002 -0.018*
## (0.015) (0.010)
##
## factor(is_q)4 -0.003 -0.021**
## (0.016) (0.010)
##
## is_top_q -0.003 -0.012**
## (0.010) (0.006)
##
## -----------------------------------------------------------------------------------
## Observations 3,187,263 3,187,263 3,187,263 4,316,471 4,316,471 4,316,471
## R2 0.935 0.935 0.935 0.960 0.960 0.960
## Adjusted R2 0.883 0.883 0.883 0.907 0.907 0.907
## ===================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Size=1 => Small Bank
Size=2 => Medium Bank
Size=0
=> Large Bank
min_yr = 2000
max_yr = 2007
r <- list()
reg_formula <- as.formula("mean_apy~log(import_sensitivity)*factor(size)|state_qt+bank_qt|0|CERT")
r[[1]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~is_top_q*factor(size)|state_qt+bank_qt|0|CERT")
r[[2]] <- felm(reg_formula,data=reg_sample[ year>=min_yr & year<=max_yr])
min_yr = 2008
max_yr = 2019
reg_formula <- as.formula("mean_apy~log(import_sensitivity)*factor(size)|state_qt+bank_qt|0|CERT")
r[[3]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr ])
reg_formula <- as.formula("mean_apy~is_top_q*factor(size)|state_qt+bank_qt|0|CERT")
r[[4]] <- felm(reg_formula,data=reg_sample[ year>=min_yr & year<=max_yr])
stargazer(r,type="text",column.labels = c("2000-2007","2008-2019"),column.separate = c(2,2),omit.stat = "ser")
##
## =============================================================================
## Dependent variable:
## ---------------------------------------
## mean_apy
## 2000-2007 2008-2019
## (1) (2) (3) (4)
## -----------------------------------------------------------------------------
## log(import_sensitivity) -0.006 -0.066***
## (0.042) (0.024)
##
## is_top_q -0.024 -0.023***
## (0.015) (0.008)
##
## factor(size)1
## (0.000) (0.000) (0.000) (0.000)
##
## factor(size)2
## (0.000) (0.000) (0.000) (0.000)
##
## log(import_sensitivity):factor(size)1 0.074 0.079
## (0.066) (0.052)
##
## log(import_sensitivity):factor(size)2 0.063 0.011
## (0.068) (0.051)
##
## is_top_q:factor(size)1 0.040* 0.042**
## (0.023) (0.017)
##
## is_top_q:factor(size)2 0.044* 0.009
## (0.024) (0.013)
##
## -----------------------------------------------------------------------------
## Observations 3,187,263 3,187,263 4,316,471 4,316,471
## R2 0.935 0.935 0.960 0.960
## Adjusted R2 0.883 0.883 0.907 0.907
## =============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
\[ apy=import.sensitivity.top.q \times bank.exposure.top.q + County*Week FE+Bank*Week FE+ ProductTypeFE\]
min_yr = 2000
max_yr = 2007
r <- list()
reg_formula <- as.formula("mean_apy~is_top_q*exp_top_q|state_qt+bank_qt|0|CERT")
r[[1]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~factor(is_q)*exp_top_q|state_qt+bank_qt|0|CERT")
r[[2]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~log(import_sensitivity)*exp_top_q|state_qt+bank_qt|0|CERT")
r[[3]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
min_yr = 2008
max_yr = 2019
reg_formula <- as.formula("mean_apy~is_top_q*exp_top_q|state_qt+bank_qt|0|CERT")
r[[4]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~factor(is_q)*exp_top_q|state_qt+bank_qt|0|CERT")
r[[5]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~log(import_sensitivity)*exp_top_q|state_qt+bank_qt|0|CERT")
r[[6]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
stargazer(r,type="text",column.labels = c("2000-2007","2008-2019"),column.separate = c(3,3),omit.stat = "ser")
##
## =============================================================================================
## Dependent variable:
## -----------------------------------------------------------
## mean_apy
## 2000-2007 2008-2019
## (1) (2) (3) (4) (5) (6)
## ---------------------------------------------------------------------------------------------
## is_top_q 0.009 -0.001
## (0.012) (0.007)
##
## factor(is_q)2 0.008 0.005
## (0.014) (0.009)
##
## factor(is_q)3 0.004 -0.016
## (0.017) (0.010)
##
## factor(is_q)4 0.013 -0.007
## (0.018) (0.011)
##
## log(import_sensitivity) 0.075* -0.011
## (0.039) (0.022)
##
## exp_top_q
## (0.000) (0.000) (0.000) (0.000) (0.000) (0.000)
##
## is_top_q:exp_top_q -0.032 -0.036***
## (0.021) (0.014)
##
## factor(is_q)2:exp_top_q -0.030 -0.020
## (0.040) (0.026)
##
## factor(is_q)3:exp_top_q -0.034 -0.017
## (0.045) (0.033)
##
## factor(is_q)4:exp_top_q -0.062 -0.054*
## (0.048) (0.032)
##
## log(import_sensitivity):exp_top_q -0.112* -0.098**
## (0.058) (0.044)
##
## ---------------------------------------------------------------------------------------------
## Observations 3,187,263 3,187,263 3,187,263 4,316,471 4,316,471 4,316,471
## R2 0.935 0.935 0.935 0.960 0.960 0.960
## Adjusted R2 0.883 0.883 0.883 0.907 0.907 0.907
## =============================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Size=1 => Small Bank
Size=2 => Medium Bank
Size=0
=> Large Bank
min_yr = 2000
max_yr = 2007
r <- list()
reg_formula <- as.formula("mean_apy~is_top_q*exp_top_q*factor(size)|state_qt+bank_qt|0|CERT")
r[[1]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~log(import_sensitivity)*log(wa_exposure)*factor(size)|state_qt+bank_qt|0|CERT")
r[[2]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
min_yr = 2008
max_yr = 2019
reg_formula <- as.formula("mean_apy~is_top_q*exp_top_q*factor(size)|state_qt+bank_qt|0|CERT")
r[[3]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
reg_formula <- as.formula("mean_apy~log(import_sensitivity)*log(wa_exposure)*factor(size)|state_qt+bank_qt|0|CERT")
r[[4]] <- felm(reg_formula,data=reg_sample[year>=min_yr & year<=max_yr])
stargazer(r,type="text",column.labels = c("2000-2007","2008-2019"),column.separate = c(2,2),omit.stat = "ser")
##
## ==============================================================================================
## Dependent variable:
## ---------------------------------------
## mean_apy
## 2000-2007 2008-2019
## (1) (2) (3) (4)
## ----------------------------------------------------------------------------------------------
## is_top_q -0.012 -0.017*
## (0.017) (0.008)
##
## exp_top_q
## (0.000) (0.000)
##
## log(import_sensitivity) 3.576* 1.113
## (1.881) (0.770)
##
## log(wa_exposure)
## (0.000) (0.000)
##
## factor(size)1
## (0.000) (0.000) (0.000) (0.000)
##
## factor(size)2
## (0.000) (0.000) (0.000) (0.000)
##
## is_top_q:exp_top_q -0.042 -0.026
## (0.035) (0.020)
##
## is_top_q:factor(size)1 0.021 0.062***
## (0.029) (0.020)
##
## is_top_q:factor(size)2 0.062** 0.025*
## (0.029) (0.015)
##
## exp_top_q:factor(size)1
## (0.000) (0.000)
##
## exp_top_q:factor(size)2
## (0.000) (0.000)
##
## is_top_q:exp_top_q:factor(size)1 0.060 -0.036
## (0.050) (0.035)
##
## is_top_q:exp_top_q:factor(size)2 -0.040 -0.030
## (0.053) (0.031)
##
## log(import_sensitivity):log(wa_exposure) -1.333* -0.439
## (0.700) (0.288)
##
## log(import_sensitivity):factor(size)1 -3.506* -0.316
## (1.925) (0.876)
##
## log(import_sensitivity):factor(size)2 -2.350 -0.372
## (2.008) (0.897)
##
## log(wa_exposure):factor(size)1
## (0.000) (0.000)
##
## log(wa_exposure):factor(size)2
## (0.000) (0.000)
##
## log(import_sensitivity):log(wa_exposure):factor(size)1 1.332* 0.156
## (0.715) (0.323)
##
## log(import_sensitivity):log(wa_exposure):factor(size)2 0.908 0.150
## (0.746) (0.332)
##
## ----------------------------------------------------------------------------------------------
## Observations 3,187,263 3,187,263 4,316,471 4,316,471
## R2 0.935 0.935 0.960 0.960
## Adjusted R2 0.883 0.883 0.907 0.907
## ==============================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
sod <- readRDS("sod_sum.rds")
sod <- sod[!is.na(UNINUMBR)]
setorder(sod,UNINUMBR,YEAR)
sod[,lagged_DEPSUMBR:= shift(DEPSUMBR,n=1,type="lag"),by=.(UNINUMBR)]
sod[,deposit_growth:= DEPSUMBR/(lagged_DEPSUMBR+1)-1]
sod <- sod[deposit_growth<1 & deposit_growth > - 0.25]
# sod <- sod[deposit_growth<2 & deposit_growth > - 0.5]
sod[,state:=substr(fips,1,2)]
sod[,state_yr:=paste(state,YEAR)]
sod[,county_yr:=paste(fips,YEAR)]
sod[,bank_yr:=paste(CERT,YEAR)]
sod <- readRDS("sod_sum.rds")
sod <- sod[,.(deposits_bank_fips=sum(DEPSUMBR,na.rm=T)),by=.(YEAR,CERT,fips)]
setorder(sod,fips,CERT,YEAR)
sod[,lagged_deposits_bank_fips:= shift(deposits_bank_fips,n=1,type="lag"),by=.(fips,CERT)]
sod[,deposit_growth:= deposits_bank_fips/(lagged_deposits_bank_fips+1)-1]
sod <- sod[deposit_growth<10 & deposit_growth > - 0.2]
sod[,state:=substr(fips,1,2)]
sod[,state_yr:=paste(state,YEAR)]
sod[,county_yr:=paste(fips,YEAR)]
sod[,bank_yr:=paste(CERT,YEAR)]
reg_sample <- merge(sod,measures,by="fips")
reg_sample <- merge(bank_import_exposure,reg_sample,by="CERT")
reg_sample[,is_top_q_exp_top_q:=ifelse(exp_top_q==1 & is_top_q==1,1,0)]
plot_summary <- reg_sample[YEAR<=2019,.(deposit_growth=mean(deposit_growth,na.rm=T)),by=.(YEAR,is_top_q_exp_top_q)]
ggplot(plot_summary,aes(x=YEAR,y=deposit_growth,color=factor(is_top_q_exp_top_q)))+geom_line()
reg_formula_2 <- as.formula("deposit_growth~is_top_q*exp_top_q|bank_yr+state_yr|0|CERT")
reg_formula_1 <- as.formula("deposit_growth~is_top_q|bank_yr+state_yr|0|CERT")
r_t <- list()
r_t[[1]] <- felm(reg_formula_1,data=reg_sample[YEAR %in% 1996:1999])
r_t[[2]] <- felm(reg_formula_2,data=reg_sample[YEAR %in% 1996:1999 ])
r_t[[3]] <- felm(reg_formula_1,data=reg_sample[YEAR %in% 2000:2007])
r_t[[4]] <- felm(reg_formula_2,data=reg_sample[YEAR %in% 2000:2007])
r_t[[5]] <- felm(reg_formula_1,data=reg_sample[YEAR %in% 2008:2019])
r_t[[6]] <- felm(reg_formula_2,data=reg_sample[YEAR %in% 2008:2019])
stargazer(r_t,type="text",no.space = T,omit.stat = "ser",column.labels = c("1996-1999","2000-2007","2008-2019"),column.separate = c(2,2,2),
add.lines=list(c("Bank*Yr",rep("Y",6)),c("State*Yr",rep("Y",6))))
##
## =============================================================================
## Dependent variable:
## ----------------------------------------------------------
## deposit_growth
## 1996-1999 2000-2007 2008-2019
## (1) (2) (3) (4) (5) (6)
## -----------------------------------------------------------------------------
## is_top_q -0.015** 0.027*** -0.024*** 0.023*** -0.011*** 0.010**
## (0.008) (0.009) (0.005) (0.008) (0.003) (0.004)
## exp_top_q
## (0.000) (0.000) (0.000)
## is_top_q:exp_top_q -0.127*** -0.150*** -0.066***
## (0.017) (0.012) (0.007)
## -----------------------------------------------------------------------------
## Bank*Yr Y Y Y Y Y Y
## State*Yr Y Y Y Y Y Y
## Observations 85,082 85,082 183,561 183,561 278,289 278,289
## R2 0.466 0.467 0.349 0.351 0.246 0.247
## Adjusted R2 -0.071 -0.069 -0.044 -0.041 -0.014 -0.014
## =============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01