The attached files are for "Corrigendum to "Trading and Information Diffusion in Over-the-Counter Markets"".
It contains the code for
--- the algorthm to find the equilibrium objects for general networks.
--- the updated Figure 2

For the equlibrium coefficients in a general network:
1. adjust the network A (and the parameters) in eq_gen.m. It displays the T^i matrices and the coefficients y_i and z^i_ij-s for each dealer i. 

For Figure 2:
1. run eq_star.m to generate the equilibrium objects of the star network. Stored in welfSandV.mat. This code implements the analytical formulas we derive.
2. run eq_complete.m to generate the equilibrium objects of the complete  network numerically. Stored in complete.mat.
3. run eq_circ.m to generate the equilibrium objects of the circulant  networks numerically. Stored in circulant2rev.mat.
4. run fig2generator2 to generate the figure from these files.

Caveat:
The convergence of these algorithms might be sensitive to the starting point, especially in large, irregular networks. In each code, we use the coefficients without the indirect effect for the starting point as it improves robustness in our experience. Also, if for some set of parameters there is no convergence, these codes autmoatically perturb the starting point and retry 5 times. In eq_complete.m, eq_circ we also exploit the symmetry of these networks to improve robustness. In our experence, this method is usually sufficient to generate a figure very close to the one we included in the corrigendum. (To illustrate the possible imprecisions, we also include the data circulant_lastgenerated.mat and complete_lastgenerated.mat which contains the result of an arbitrary run, as opposed to the smoothest picture we managed to obtain by running the code a few times.)

Still, if the reader need to calculate the fixed point for a large set of parameters and networks, further optimization of the robustness of the the code might be neccessary. 


