Data and code for the paper "Micro-scale foundation with error quantification for the approximation of dynamics on networks", Communications Physics, 2022, https://doi.org/10.1038/s42005-022-00834-1. Included: Matlab code to reproduce the figures and data for the figures Network data in .csv and .mat formats The code and data are stored in the following directories: compute_data data figures networks plotting pop_mod share stochastic theory NETWORK DATA The network data is contained within the "networks" directory. Each network has been saved as a .mat file, which can be loaded directly into matlab, or as a .csv file. The "networks" directory also contains the programs "write_csv" and "read_csv". The "write_csv" program was used to create the network csv data from the .mat data. The csv files can be read into matlab as sparse matrices using "read_csv". The csv data is an edglist in the format "x, y", which indicates that there is an undirected edge between nodes x and y. FIGURES The figures in the paper can be produced using the programs in the "plotting" directory. Each file in this directory creates an eps figure in the "figures" directory. These figures use data that is saved as .mat files in the "data/save" directory. FIGURE DATA (The program "fig_approx_lumping_description", which produces figure 1 in the paper, creates the data needed for that figure and does not used any saved data.) The data used in figures 2--4 in the paper can be reproduced using the programs in the "compute_data" directory. The program "fig_compareSIR" produces the data for figure 2 and should be quick to run (e.g. less than a minute). The data for figures 3 and 4 could take a significant amount of time to reproduce (e.g. up to two hours for some networks) and this data cannot be recreated by calling a single function. The process for each network is: 1) Run "data_errorSISa_intialise" (ensuring that the desired network name is present in the variable "names"). This runs stochastic simulations of the SISa model on the network in order to estimate the steady state infected fraction, saved in the variable "i0s". This is used as the initial condition in further stochastic simulations. 2a) To reproduce the data for figure 3, run "data_errorSISa_stochastic_timeseries". This runs multiple realisations of stochastic simulations of the SISa model on the network to produce a timeseries of the average number of infected, saved in the variable "xm". 2b) To reproduce the data for figure 4, run "data_errorSISa_stochastic". Thus runs a single stochastic simulation of the SISa model on the network in order to estimate the steady state infected fraction, saved in the variable "is". 3a) To reproduce the data for figure 3, run "data_errorSISa_pm_timeseries". This solves the population model approximation ODEs (saved in the variable "yl") and the ODEs that compute the bound on the population model approximation error (saved in the variable "zal"). 3b) To reproduce the data for figure 4, run "data_errorSISa_pm". This computes the steady state mean fraction of infected for the population model approximation, the error bound (saved in the variable "zb") and error approximation (saved in the variable "za"), as per the theory described in the paper. Note that the data stored by the programs in steps 1--3 are save in the "data" directory, but the data used by the figure plotting programs is called from the "data/save" directory. This is to help prevent accidental overwriting of data. OTHER DIRECTORYS The directories pop_mod share stochastic theory contain programs used by the programs described above. This includes code to solve the full master equation for small networks. The stochastic simulations use the Gillespie algorithm and other network dynamics can be fairly easily incorporated --- see the files in the "stochastic" directory for examples of how this may be done. The "startup" program can be called from the top directory to put all the folders on matlab's path. If any issues, please contact Jonathan Ward, J.A.Ward@leeds.ac.uk.