Replication Material for "Social Interactions and Legislative Activity",
Nathan Canen, Matthew O. Jackson and Francesco Trebbi
Journal of the European Economic Association, forthcoming


Thank you for your interest in our work. The replication material consists of three separate folders: 

1. "Structural Estimation Replication": this replicates the structural estimation, 
2. "Generating All Tables, Figures and Additional Results": this loads data and the structural estimates, and 
outputs all Figures and Tables found in the main text (except for Table 2); 
3. "Reduced Form (Table 2 and Appendix F)": this reproduces Table 2 and Appendix F (the reduced form results). 

We describe each subfolder in turn, in detail:



*************************************************************************************************************
                               1. Folder "Structural Estimation Replication"
*************************************************************************************************************

This folder contains the codes that replicate our structural estimation results described in Section 5 and 6.
This folder outputs the results used in those sections. However, the actual tables and figures are output using  
the subsequent folder. Hence, the "Structural Estimation Replication" folder is most useful to those wishing to
reestimate/replicate our model (rather than replicating the tables/figures themselves).

This folder should be used as follows:

- "StructuralEst_Replicate.m" is the main code, which (structurally) estimates our model, as described in Section 5.
One simply has to "run" the code.

             - For the results in the main text, please set "Specification = 1" in line 14. 
               This will output the file "Results_Spec1.mat"

             - For the results in Appendix (Table E.1), please set "Specification = 2" in line 14.
               This will output the file "Results_Spec2.mat"

- The main file calls the following auxiliary files:

Data:
             - "StructuralCovariates_Matlab.mat" is the main dataset at the politician x Congress level, as described 
               in Section 3. This includes the variables for cosponsorships, Words in Floor Speeches, winning margins, 
               and those used as covariates (e.g., Committee assignments, tenure, etc.).

             - "billsforgamma.mat" is the dataset for individual bills. It includes whether that bill passed or not, 
               and its sponsor. It is used to construct the average pass rate per politician per Congress.

Estimation:

             - "gmm_obj_emp.m" is the GMM objective function, based on Section 5.3. It is minimized in the main code.
             - "gmm_indiv_moments_emp.m" are the moments at the individual level (before they are averaged it). It is
               called for to compute the matrix \Omega (Appendix D), required for standard errors.
             - "gradient_moments_emp.m" computed the analytical derivative matrix of the individual moments. It is used
               in the computation of standard errors. See Appendix D.


               

*************************************************************************************************************
                    2. Folder "Generating All Tables, Figures and Additional Results"
*************************************************************************************************************

This folder loads the structural estimation results ("Results_Spec1.mat" and "Results_Spec2.mat") output above, as well 
as additional data, to generate the actual Tables and Figures in the text.

This folder should be used as follows:

- "MainAnalysis.m" is the main code, which outputs most of the Tables and Figures in the text. To use it, please run 
***one section at a time*** (e.g., using "Run and Advance" in Matlab). This is because later Tables might use variables
constructed for previous ones. Each section will load an appropriate data and output a clearly labeled equivalent Table.

- This main file calls the same datasets outlined in (1), the outputs described above, as well as the following additional codes:

             - For Figure 2, it calls the data on directed House graphs, present in the same folder (i.e, "_housedgraph.csv"),
               together with the data on the politicians related to each column of those graphs ("_HouseDWFinal.csv").
               
             - For Table 5, it further calls the data on combined House graphs ("_housecgraphs.csv")

             - For Figure 7, it further calls "AdjacencyUniversity_8years.csv", which is the data on alumni networks 
               (who attended the same university within 8 years as others).


This main code outputs all Tables and Figures except for Figure 1 and Figure 4 (both are simulations of the model), which can
be replicated using the codes below, Appendix B.3, and Table 2 and Appendix F (see the next folder):


- "Fig1.m" reproduces Figure 1 in the text, simulating the model as explained in the notes to Figure 1, and using the best 
response iteration in Appendix B.

- "Fig4.m" reproduces Figure 4 in the text, simulating the model as explained in the notes to Figure 4 and Appendix B.

- "AppendixB_G_Examples.m" reproduces the Appendix B.3 examples of how our model produces a rich class of networks in equilibrium.




*************************************************************************************************************
                               3. Folder "Reduced Form (Table 2 and Appendix F)"
*************************************************************************************************************

This folder outputs the results in Table 2 and Appendix F. All instructions for the latter are within the appropriate subfolder.
For Table 2, please use:

            - "Table2.do" loads "Table2.dta" and outputs Table 2 from the main text. 
            - "Table2.dta" is simply a Stata version of the dataset in folder 1. above.





Nathan Canen, University of Houston
Matthew O. Jackson, Stanford University and External Faculty of Santa Fe Institute
Francesco Trebbi, University of California - Berkeley, Haas School of Business; CEPR and NBER
