This repository contains codes and data used for analysis in the article "Noise-Induced Effects in Collective Dynamics and Inferring Interactions from Data".
-
Generate polarisation time-series for a given set of parameters: A matlab code (/Figure_2/Gillespie_stochastic_process.m) can be used to compute the polarization/order parameter.
- The important parameters that need to be set are N (system size), r1, r2, r3, r4 (which are for different reaction rates).
- N = 50, 100, 200; r1 = 0.01; r2 = 1; r3 = 0 (for pairwise model) & 0.08 (for ternay model)
- Other parameters include Tint, Tend.
- Tint = 50;
- Tend = Tint*Number of iterations. Set number of iterations in this formula to 1000000.
- Parameter rel is for number of realizations/replicates of the simulations.
- Set rel >= 1. For 1 realization with 1 million iterations may take around 10-15 mins. If the system is out of memory reduce the number of iterations.
- The output is a time series array (S) of size (number of iterations*rel), and an array (tSample) storing system time.
- Autocorrelation time of the time series (est_tau) can be calculated. exp_tau is the expected autocorrealtion time for the given reaction rate and system size parameters.
- The important parameters that need to be set are N (system size), r1, r2, r3, r4 (which are for different reaction rates).
-
Reconstruct Deterministic and Stochastic part from time series: A matlab code (/Figure_2/SDE_different_Dt.m) can be used to reconstruct the underlying functions from the time series for different time scales. This code can generate all plots in Figure 2 of the main text of the paper.
- Run one column of the time series array (for e.g., S(:,1)) at a time on this code.
- In line 8: Set different time scales over which you want to calculate the deterministic and the stochastic part.
- Uncomment line 33 and set the exact parameters used to generate the time series using code /Figure_2/Gillespie_stochastic_process.m
- The code uses tSample from the code /Figure_2/Gillespie_stochastic_process.m (or from real data) for calculaing Tint in line 35. One can also set Tint manually here.
- Plotting begins from line 76.
-
Figure 3A and B: Run the previous code (/Figure_2/SDE_different_Dt.m) to generate plots for Distance between the expected and the derived Deterministic function for pairwise model (r3 = 0) and the ternary model (r3 = 0.08), as a function of a more continuous
$\Delta t$ . - Figure 3C: Run /Figure_3/optDt_changing_r1.m to generate the data for the figure (r1 = s = flip(1./(2*(10:10:200))), r2 = 1, r3 = 0.08, N = size = 50) and use plot or scatter command in matlab to plot optimal Dt vs Correlation time.
- Figure 3D: Run /Figure_3optDt_changingN.m to generate the data for the figure (r1 = 0.01, r2 = 1, r3 = 0.08, N = size = 50:1:200) and use plot or scatter command in matlab to plot optimal Dt vs Correlation time.
-
Figure 4A:
- Use code /Figure_2/Gillespie_stochastic_process.m to generate three time series for the pairwise model (r1 = 0.01, r2 = 1, r3 = 0) for N = 50, 100 and 200.
- Run each of these time series on code /Figure_2/SDE_different_Dt.m to calculate Distance between the expected and the derived Stochastic function as a function of
$\delta t$ .
-
Figure 4B:
- Use code /Figure_4/varying_resolution.m to generate time series with different resolution. Set r1 = 0.01, r2 = 1, r3 = 0 for the pairwise model.
- Perform the above step for different N (50, 100, 200). The outputs will be stored in the folder Characterizing_noise/pairwise/varying_resolution/N_15, for example.
-
Figure 4C
- Perform the steps to generate Figure 4A for the ternary models case (r1 = 0.01, r2 = 1, r3 = 0.08).
-
Figure 4D
- Perform the steps in Figure 4B for the ternary models case (r1 = 0.01, r2 = 1, r3 = 0.08).
-
Figure 4E and 4F
- Generate a time series using code /Figure_2/Gillespie_stochastic_process.m with Tint = 10 and 50 for the pairwise model (r1 = 0.01, r2 = 1, r3 = 0) for N = 50.
- Run these time series on code /Figure4/noise_analysis.m to get the plots 4E and 4F.
-
Figure 4G and 4H
- Perform the steps used to generate Figure 4E and 4F for the ternary model case ((r1 = 0.01, r2 = 1, r3 = 0.08)) for N = 50.