
This folder contains codes and data necessary to reproduce main results in the published version of 
"Stock Market Spillovers via the Global Production Network: Transmission of U.S. Monetary Policy" by Julian di Giovanni and Galina Hale
Working paper version is available at : https://julian.digiovanni.ca/Papers/diGiovanni_Hale_StockGlobalNetwork.pdf 
The codes for the Internet Appendix results are available upon request.

Linear regressions were implemented in Stata.
SAR regressions were implemented in Matlab. 
Note on SAR: the matrices loaded are quite large and the bootstrap procedure with 500 replications take multiple hours to complete on the multi-core server

Content (referencing Figure and Table numbers in the paper):
Important note:  Preceision of data matrices was reduced in order to keep them to manageable size for sharing.
This leads to small discrepancies between the results in the paper and the replication results.

Figure 1. Distribution of Weighted Outdegree for WIOD
	Code: 	figure1.m which loads the following data and calls the following functions
		Data:  A_GO.mat
		Functions:  	matextract_fn.m
				plfit.m
				plplot_noslope.m

Figure 2. Closeness to U.S. Consumers
	Code: 	figure2.m which loads data
		Data: consusa.mat

Figure 3. Correlation of Stock Returns over the Entire Sample
	Code: 	figure3.m which loads data
		Data: 	A_GO.mat
			y_mi_raw.mat

Figure 4. WIOD Network Distance of Supply Linkages and the Correlation of Stock Returns
	Code: 	figure3.m which loads the following data and calls the following functions
		Data: 	A_GO.mat
			y_mi_raw.mat
		Functions:  	matextract_fn.m
				distance_bin.m

Figure 5. Distribution of Direct and Network Effects across Country-Sectors
	Code: 	Results_hist.m uses 
		Data: 	Output file T3.mat (to be run after T3_share.m)
	- also produces distribution of betas and rhos in the Internet Appendix

Figure 6. Distribution of Direct and Network Effects across Countries and Sectors
	Code: 	figure6.do which loads
		Data: 	figure6.dta

Table 1. Least-Squares Regression Estimation: Full Sample
	Code:  Table1_2_9_share.do which uses 
		Data:  	Table1_share.dta

Table 2. Least-Squares Regression Estimation: International and United States Sub-Samples
	Code:  	Table1_2_9_share.do which uses
		Data:  	Table1_share.dta

Table 3. Heterogeneous Spatial Autoregression Panel Estimation: Baseline Specification and Decompositions
	Code: 	T3_share.m which calls
		Functions: 	spregs_prep_fn.m 
				spregs_run_fn.m which calls 
					fn_ml_Npsi_NKbeta_Nsgmsq.m
					fn_varml_sandwich_Npsi_NKbeta_Nsgmsq.m
					decomposition_vec_fn.m
				spregs_bs_fn.m
		m-files:  	sample_prep.m which loads the following data
					Data:  	data_spatial_new.mat
						A_IC.mat
						A_GO.mat
						TAU_sec.mat (not used for benchmark results)		

Table 4. Comparing effects by United States' consumption to country-sector output ratio
	Code: 	group_decompositions.m which loads the results (to be run after T3_share.m) and control variables 
		Data: 	T3.mat
			xsection_for_matlab.mat
		Functions: group_decompositions_fn.m

Table 5. Total Impact of U.S. Monetary Policy Shocks: Baseline vs. Autarkic Scenario Empirical Counterfactuals
	Code:  	master_autarky.m which calls the following codes and functions
		Functions:  	spregs_autarky_prep_fn.m
				spregs_autarky_run_fn.m
				spregs_autarky_bs_fn.m
				tausec_extract_fn.m
				decomposition_vec_autarky_fn.m
				matextract_fn.m
		m-files: 	tables_autarky.m
				winsorising.m
				fn_ml_Npsi_NKbeta_Nsgmsq.m
				fn_varml_sandwich_Npsi_NKbeta_Nsgmsq.m
				sample_autarky_prep.m which loads the following data
					Data: 	data_spatial_new.mat
						A_IC.mat
						A_GO.mat
						TAU_sec.mat (not used for benchmark results)	

Table 6. Heterogeneous Spatial Autoregression Panel Estimation: Varying Sample Period and Weighting Matrix
	Code: 	T4Wavg.m 
		T4_16.m 
		T4_16Wavg.m 
		T4_16no08.m 
		T4_16no08Wavg.m 
		T4_16no09.m 
		T4_16no09Wavg.m 
		- all files call the same set of functions and m-files and data as T3_share 

Table 7. Heterogeneous Spatial Autoregression Panel Estimation: Robustness to Returns and Shock Measures
	Code: 	T6nT2y.m 
		T7DC.m 
		T7rDC.m 
		T7OW.m 
		T7NS.m 
		T7BRW.m
		- all files call the same set of functions and m-files and data as T3_share, except
		Function: 	spregs_prep_X_fn.m (for T6nT2y.m)

Table 8. Heterogeneous Spatial Autoregression Panel Estimation: Summary Results for Foreign Monetary Policy Shocks
	Code: 	T8ECB.m 
		T8BOE.m 
		T8For.m 
		- all files call the same set of functions and m-files and data as T3_share 
		
Table 9. Least-Squares Panel Estimation: Controlling for Global Financial Cycle Covariates
	Code:  	Table1_2_9_share.do which uses
		Data:  	Table1.dta

Table 10. Heterogeneous Spatial Autoregression Panel Estimation: Conditioning on the Global Financial Cycle
First stage (Stata):
	Code: 	FirstStage_share.do which uses
		Data: 	FirstStage_share.dta
Second stage (Matlab):
	Code: 	T6nMG.m
		- all files call the same set of functions and m-files and data as T3_share, except
		Function: 	spregs_prep_MG_fn.m

Tables A1 and A2.  
	Data:	data_spatial_new.dta
	The tables are obtained by tabulating raw data "if y_mi~=. "
	
