# The impact of within-host coinfection interactions on between-host parasite transmission dynamics varies with spatial scale

## Cite this dataset

Keegan, Shaun; Pedersen, Amy; Fenton, Andrew (2024). The impact of within-host coinfection interactions on between-host parasite transmission dynamics varies with spatial scale [Dataset]. Dryad. https://doi.org/10.5061/dryad.tdz08kq68

## Abstract

Within-host interactions among coinfecting parasites can have major consequences for individual infection risk and disease severity. However, the impact of these within-host interactions on between-host parasite transmission, and the spatial scales over which they occur, remain unknown. We developed and applied a novel spatially explicit analysis to parasite infection data from a wild wood mouse (*Apodemus sylvaticus*) population. We previously demonstrated a strong within-host negative interaction between two wood mouse gastrointestinal parasites, the nematode *Heligmosomoides polygyrus,* and the coccidian *Eimeria hungaryensis*, using drug-treatment experiments. Here, we show this negative within-host interaction can significantly alter the between-host transmission dynamics of *E. hungaryensis*, but only within spatially-restricted neighbourhoods around each host. However, for the closely related species *E. apionodes*, which experiments show does not interact strongly with *H. polygyrus*, we did not find any effect on transmission over any spatial scale. Our results demonstrate that the effects of within-host coinfection interactions can ripple out beyond each host to alter the transmission dynamics of the parasites, but only over local scales that likely reflect the spatial dimension of transmission. Hence there may be knock-on consequences of drug treatments impacting the transmission of non-target parasites, altering infection risks even for non-treated individuals in the wider neighbourhood.

## README: The impact of within-host coinfection interactions on between-host parasite transmission dynamics varies with spatial scale ? ?️

**Overview ?**

These data were collected in 2012 as part of a broader piece of work exploring the parasite communities of the wood mouse (*Apodemus sylvaticus*). This code base takes input data from trapping grids and calculates neighbourhood prevalence relative to each individual on the grid. It does this by iteratively identifying each individual in the population as the ‘focal’ individual, and each other as a potential neighbour, with a distance to the focal individual calculated. Then neighbourhood prevalence and mean infection burden of the potentially interacting parasite (the nematode *Heligmosomoides polygyrus*) are calculated for each user-defined neighbourhood size around the focal individual. These are then able to be used in statistical models as an explanatory factor for the specified infection state (*Eimeria* presence/absence or intensity) of all focal individuals.

## Input Data Structure ?

The core data, included in `raw data.csv`

includes:

• Animal identifier

• Temporal data in DD/MM/YYYY format

• X & Y grid coordinates

• Animal demographic data

• Parasitological data

And more specifically:

Variable Name | Description |
---|---|

ID | ID code assigned to animal |

ID.CapDate | ID code assigned to animal combined with capture date |

X | X coordinates on the grid |

Y | X coordinates on the grid |

Capture.date | Temporal data in DD/MM/YYYY format |

Grid | Grid Designation |

Year | Capture Year |

Sex | Mouse Sex (M/F/NA) |

Age | Mouse Age (Adult/NotAdult/NA) |

treated.Y.N | Whether an animal has been treated with the anthelmintic ivermectin (0/1) |

EhungInt | Infection intensity of E. hungaryensis |

EhungInf | Presence or absence of E. hungaryensis (0/1) |

EappInt | Infection intensity of E. apionoides |

EappInf | Presence or absence of E. apionoides (0/1) |

H.poly.EPG | Infection intensity of H. polygyrus |

HpolINF | Presence or absence of H. polygyrus (0/1) |

## Output Data Structure - neighbourhood data generation

These files are titled:

DATA - Eapp_17.csv,DATA - Eapp_34.csv,DATA - Eapp_51.csv, DATA - Eapp_all.csv, DATA - Ehung_17.csv, DATA - Ehung_34.csv, DATA - Ehung_51.csv, DATA - Ehung_all.csv

Each file will have all of the following fields:

Variable Name | Description |
---|---|

ID | ID code assigned to animal |

ID.CapDate | ID code assigned to animal combined with capture date |

X | X coordinates on the grid |

Y | X coordinates on the grid |

Capture.date | Temporal data in DD/MM/YYYY format |

Grid | Grid Designation |

Year | Capture Year |

Sex | Mouse Sex (M/F/NA) |

Age | Mouse Age (Adult/NotAdult/NA) |

treated.Y.N | Whether an animal has been treated with the anthelmintic ivermectin (0/1) |

H.poly.EPG | Infection intensity of H. polygyrus |

HpolINF | Presence or absence of H. polygyrus (0/1) |

And files with "Ehung" in the file name will have:

Variable Name | Description |
---|---|

EhungInt | Infection intensity of E. hungaryensis |

EhungInf | Presence or absence of E. hungaryensis (0/1) |

While files with "Eapp" in the file name will have:

Variable Name | Description |
---|---|

EappInt | Infection intensity of E. apionoides |

EappInf | Presence or absence of E. apionoides (0/1) |

All files will have the following fields:

Term | Description |
---|---|

PropOnGrid_10 | Proportion of the neighbourhood on the grid at 10 metre radius around the focal host |

NemNoInf_10 | Number of individuals infected with H. polygyrus on the neighbourhood at 10 metre radius around the focal host |

NemNoUninf_10 | Number of individuals not infected with H. polygyrus on the neighbourhood at 10 metre radius around the focal host |

NemPrev_10 | Prevalence of H. polygyrus on the neighbourhood at 10 metre radius around the focal host |

NemNoTotal_10 | Number of hosts in the neighbourhood with H. polygyrus at 10 metre radius around the focal host |

NemTotBurden_10 | Total burden of H. polygyrus on the neighbourhood at 10 metre radius around the focal host |

NemMeanBurden_10 | Mean burden of H. polygyrus on the neighbourhood at 10 metre radius around the focal host |

EimNoInf_10 | Number of individuals infected with Eimeria on the neighbourhood at 10 metre radius around the focal host |

EimNoUninf_10 | Number of individuals not infected with Eimeria on the neighbourhood at 10 metre radius around the focal host |

EimPrev_10 | Prevalence of Eimeria on the neighbourhood at 10 metre radius around the focal host |

EimNoTotal_10 | Number of hosts in the neighbourhood with Eimeria at 10 metre radius around the focal host |

PropOnGrid_14.1 | Proportion of the neighbourhood on the grid at 14.1 metre radius around the focal host |

NemNoInf_14.1 | Number of individuals infected with H. polygyrus on the neighbourhood at 14.1 metre radius around the focal host |

NemNoUninf_14.1 | Number of individuals not infected with H. polygyrus on the neighbourhood at 14.1 metre radius around the focal host |

NemPrev_14.1 | Prevalence of H. polygyrus on the neighbourhood at 14.1 metre radius around the focal host |

NemNoTotal_14.1 | Number of hosts in the neighbourhood with H. polygyrus at 14.1 metre radius around the focal host |

NemTotBurden_14.1 | Total burden of H. polygyrus on the neighbourhood at 14.1 metre radius around the focal host |

NemMeanBurden_14.1 | Mean burden of H. polygyrus on the neighbourhood at 14.1 metre radius around the focal host |

EimNoInf_14.1 | Number of individuals infected with Eimeria on the neighbourhood at 14.1 metre radius around the focal host |

EimNoUninf_14.1 | Number of individuals not infected with Eimeria on the neighbourhood at 14.1 metre radius around the focal host |

EimPrev_14.1 | Prevalence of Eimeria on the neighbourhood at 14.1 metre radius around the focal host |

EimNoTotal_14.1 | Number of hosts in the neighbourhood with Eimeria at 14.1 metre radius around the focal host |

PropOnGrid_20 | Proportion of the neighbourhood on the grid at 20 metre radius around the focal host |

NemNoInf_20 | Number of individuals infected with H. polygyrus on the neighbourhood at 20 metre radius around the focal host |

NemNoUninf_20 | Number of individuals not infected with H. polygyrus on the neighbourhood at 20 metre radius around the focal host |

NemPrev_20 | Prevalence of H. polygyrus on the neighbourhood at 20 metre radius around the focal host |

NemNoTotal_20 | Number of hosts in the neighbourhood with H. polygyrus at 20 metre radius around the focal host |

NemTotBurden_20 | Total burden of H. polygyrus on the neighbourhood at 20 metre radius around the focal host |

NemMeanBurden_20 | Mean burden of H. polygyrus on the neighbourhood at 20 metre radius around the focal host |

EimNoInf_20 | Number of individuals infected with Eimeria on the neighbourhood at 20 metre radius around the focal host |

EimNoUninf_20 | Number of individuals not infected with Eimeria on the neighbourhood at 20 metre radius around the focal host |

EimPrev_20 | Prevalence of Eimeria on the neighbourhood at 20 metre radius around the focal host |

EimNoTotal_20 | Number of hosts in the neighbourhood with Eimeria at 20 metre radius around the focal host |

PropOnGrid_22.4 | Proportion of the neighbourhood on the grid at 22.4 metre radius around the focal host |

NemNoInf_22.4 | Number of individuals infected with H. polygyrus on the neighbourhood at 22.4 metre radius around the focal host |

NemNoUninf_22.4 | Number of individuals not infected with H. polygyrus on the neighbourhood at 22.4 metre radius around the focal host |

NemPrev_22.4 | Prevalence of H. polygyrus on the neighbourhood at 22.4 metre radius around the focal host |

NemNoTotal_22.4 | Number of hosts in the neighbourhood with H. polygyrus at 22.4 metre radius around the focal host |

NemTotBurden_22.4 | Total burden of H. polygyrus on the neighbourhood at 22.4 metre radius around the focal host |

NemMeanBurden_22.4 | Mean burden of H. polygyrus on the neighbourhood at 22.4 metre radius around the focal host |

EimNoInf_22.4 | Number of individuals infected with Eimeria on the neighbourhood at 22.4 metre radius around the focal host |

EimNoUninf_22.4 | Number of individuals not infected with Eimeria on the neighbourhood at 22.4 metre radius around the focal host |

EimPrev_22.4 | Prevalence of Eimeria on the neighbourhood at 22.4 metre radius around the focal host |

EimNoTotal_22.4 | Number of hosts in the neighbourhood with Eimeria at 22.4 metre radius around the focal host |

PropOnGrid_28.3 | Proportion of the neighbourhood on the grid at 28.3 metre radius around the focal host |

NemNoInf_28.3 | Number of individuals infected with H. polygyrus on the neighbourhood at 28.3 metre radius around the focal host |

NemNoUninf_28.3 | Number of individuals not infected with H. polygyrus on the neighbourhood at 28.3 metre radius around the focal host |

NemPrev_28.3 | Prevalence of H. polygyrus on the neighbourhood at 28.3 metre radius around the focal host |

NemNoTotal_28.3 | Number of hosts in the neighbourhood with H. polygyrus at 28.3 metre radius around the focal host |

NemTotBurden_28.3 | Total burden of H. polygyrus on the neighbourhood at 28.3 metre radius around the focal host |

NemMeanBurden_28.3 | Mean burden of H. polygyrus on the neighbourhood at 28.3 metre radius around the focal host |

EimNoInf_28.3 | Number of individuals infected with Eimeria on the neighbourhood at 28.3 metre radius around the focal host |

EimNoUninf_28.3 | Number of individuals not infected with Eimeria on the neighbourhood at 28.3 metre radius around the focal host |

EimPrev_28.3 | Prevalence of Eimeria on the neighbourhood at 28.3 metre radius around the focal host |

EimNoTotal_28.3 | Number of hosts in the neighbourhood with Eimeria at 28.3 metre radius around the focal host |

PropOnGrid_30 | Proportion of the neighbourhood on the grid at 30 metre radius around the focal host |

NemNoInf_30 | Number of individuals infected with H. polygyrus on the neighbourhood at 30 metre radius around the focal host |

NemNoUninf_30 | Number of individuals not infected with H. polygyrus on the neighbourhood at 30 metre radius around the focal host |

NemPrev_30 | Prevalence of H. polygyrus on the neighbourhood at 30 metre radius around the focal host |

NemNoTotal_30 | Number of hosts in the neighbourhood with H. polygyrus at 30 metre radius around the focal host |

NemTotBurden_30 | Total burden of H. polygyrus on the neighbourhood at 30 metre radius around the focal host |

NemMeanBurden_30 | Mean burden of H. polygyrus on the neighbourhood at 30 metre radius around the focal host |

EimNoInf_30 | Number of individuals infected with Eimeria on the neighbourhood at 30 metre radius around the focal host |

EimNoUninf_30 | Number of individuals not infected with Eimeria on the neighbourhood at 30 metre radius around the focal host |

EimPrev_30 | Prevalence of Eimeria on the neighbourhood at 30 metre radius around the focal host |

EimNoTotal_30 | Number of hosts in the neighbourhood with Eimeria at 30 metre radius around the focal host |

PropOnGrid_31.6 | Proportion of the neighbourhood on the grid at 31.6 metre radius around the focal host |

NemNoInf_31.6 | Number of individuals infected with H. polygyrus on the neighbourhood at 31.6 metre radius around the focal host |

NemNoUninf_31.6 | Number of individuals not infected with H. polygyrus on the neighbourhood at 31.6 metre radius around the focal host |

NemPrev_31.6 | Prevalence of H. polygyrus on the neighbourhood at 31.6 metre radius around the focal host |

NemNoTotal_31.6 | Number of hosts in the neighbourhood with H. polygyrus at 31.6 metre radius around the focal host |

NemTotBurden_31.6 | Total burden of H. polygyrus on the neighbourhood at 31.6 metre radius around the focal host |

NemMeanBurden_31.6 | Mean burden of H. polygyrus on the neighbourhood at 31.6 metre radius around the focal host |

EimNoInf_31.6 | Number of individuals infected with Eimeria on the neighbourhood at 31.6 metre radius around the focal host |

EimNoUninf_31.6 | Number of individuals not infected with Eimeria on the neighbourhood at 31.6 metre radius around the focal host |

EimPrev_31.6 | Prevalence of Eimeria on the neighbourhood at 31.6 metre radius around the focal host |

EimNoTotal_31.6 | Number of hosts in the neighbourhood with Eimeria at 31.6 metre radius around the focal host |

PropOnGrid_36.1 | Proportion of the neighbourhood on the grid at 36.1 metre radius around the focal host |

NemNoInf_36.1 | Number of individuals infected with H. polygyrus on the neighbourhood at 36.1 metre radius around the focal host |

NemNoUninf_36.1 | Number of individuals not infected with H. polygyrus on the neighbourhood at 36.1 metre radius around the focal host |

NemPrev_36.1 | Prevalence of H. polygyrus on the neighbourhood at 36.1 metre radius around the focal host |

NemNoTotal_36.1 | Number of hosts in the neighbourhood with H. polygyrus at 36.1 metre radius around the focal host |

NemTotBurden_36.1 | Total burden of H. polygyrus on the neighbourhood at 36.1 metre radius around the focal host |

NemMeanBurden_36.1 | Mean burden of H. polygyrus on the neighbourhood at 36.1 metre radius around the focal host |

EimNoInf_36.1 | Number of individuals infected with Eimeria on the neighbourhood at 36.1 metre radius around the focal host |

EimNoUninf_36.1 | Number of individuals not infected with Eimeria on the neighbourhood at 36.1 metre radius around the focal host |

EimPrev_36.1 | Prevalence of Eimeria on the neighbourhood at 36.1 metre radius around the focal host |

EimNoTotal_36.1 | Number of hosts in the neighbourhood with Eimeria at 36.1 metre radius around the focal host |

PropOnGrid_40 | Proportion of the neighbourhood on the grid at 40 metre radius around the focal host |

NemNoInf_40 | Number of individuals infected with H. polygyrus on the neighbourhood at 40 metre radius around the focal host |

NemNoUninf_40 | Number of individuals not infected with H. polygyrus on the neighbourhood at 40 metre radius around the focal host |

NemPrev_40 | Prevalence of H. polygyrus on the neighbourhood at 40 metre radius around the focal host |

NemNoTotal_40 | Number of hosts in the neighbourhood with H. polygyrus at 40 metre radius around the focal host |

NemTotBurden_40 | Total burden of H. polygyrus on the neighbourhood at 40 metre radius around the focal host |

NemMeanBurden_40 | Mean burden of H. polygyrus on the neighbourhood at 40 metre radius around the focal host |

EimNoInf_40 | Number of individuals infected with Eimeria on the neighbourhood at 40 metre radius around the focal host |

EimNoUninf_40 | Number of individuals not infected with Eimeria on the neighbourhood at 40 metre radius around the focal host |

EimPrev_40 | Prevalence of Eimeria on the neighbourhood at 40 metre radius around the focal host |

EimNoTotal_40 | Number of hosts in the neighbourhood with Eimeria at 40 metre radius around the focal host |

PropOnGrid_50 | Proportion of the neighbourhood on the grid at 50 metre radius around the focal host |

NemNoInf_50 | Number of individuals infected with H. polygyrus on the neighbourhood at 50 metre radius around the focal host |

NemNoUninf_50 | Number of individuals not infected with H. polygyrus on the neighbourhood at 50 metre radius around the focal host |

NemPrev_50 | Prevalence of H. polygyrus on the neighbourhood at 50 metre radius around the focal host |

NemNoTotal_50 | Number of hosts in the neighbourhood with H. polygyrus at 50 metre radius around the focal host |

NemTotBurden_50 | Total burden of H. polygyrus on the neighbourhood at 50 metre radius around the focal host |

NemMeanBurden_50 | Mean burden of H. polygyrus on the neighbourhood at 50 metre radius around the focal host |

EimNoInf_50 | Number of individuals infected with Eimeria on the neighbourhood at 50 metre radius around the focal host |

EimNoUninf_50 | Number of individuals not infected with Eimeria on the neighbourhood at 50 metre radius around the focal host |

EimPrev_50 | Prevalence of Eimeria on the neighbourhood at 50 metre radius around the focal host |

EimNoTotal_50 | Number of hosts in the neighbourhood with Eimeria at 50 metre radius around the focal host |

## Output Data Structure - statistical model output files

These files are titled:

STATS - Eapp INF NHMeanburden 17.csv, STATS - Eapp INF NHMeanburden 34.csv, STATS - Eapp INF NHMeanburden 51.csv, STATS - Eapp INF NHMeanburden all.csv, STATS - Eapp INF NHprev 17.csv, STATS - Eapp INF NHprev 34.csv, STATS - Eapp INF NHprev 51.csv, STATS - Eapp INF NHprev all.csv, STATS - Eapp Int NHMeanburden 17.csv, STATS - Eapp Int NHMeanburden 34.csv, STATS - Eapp Int NHMeanburden 51.csv, STATS - Eapp Int NHMeanburden all.csv, STATS - Eapp Int NHprev 17.csv, STATS - Eapp Int NHprev 34.csv, STATS - Eapp Int NHprev 51.csv, STATS - Eapp Int NHprev all.csv, STATS - Ehung INF NHMeanburden 17.csv, STATS - Ehung INF NHMeanburden 34.csv, STATS - Ehung INF NHMeanburden 51.csv, STATS - Ehung INF NHMeanburden all.csv, STATS - Ehung INF NHprev 17.csv, STATS - Ehung INF NHprev 34.csv, STATS - Ehung INF NHprev 51.csv, STATS - Ehung INF NHprev all.csv, STATS - Ehung Int NHMeanburden 17.csv, STATS - Ehung Int NHMeanburden 34.csv, STATS - Ehung Int NHMeanburden 51.csv, STATS - Ehung Int NHMeanburden all.csv, STATS - Ehung Int NHprev 17.csv, STATS - Ehung Int NHprev 34.csv, STATS - Ehung Int NHprev 51.csv, STATS - Ehung Int NHprev all.csv

Which contain the statistical outputs of the models run with the file `run.statistical.analysis.R`

. These files contain the following columns.

Term | Description |
---|---|

dist | Neighbourhood radius around the focal host (metres) |

estimates | Model estimate of the primary predictor variable |

lowerCI | Lower 95% credible interval of estimate of the primary predictor variable |

upperCI | Upper 95% credible interval of estimate of the primary predictor variable |

estimates.tothosts | Model estimate of the predictor variable total number of hosts |

lowerCI.tothosts | Lower 95% credible interval of estimate of the predictor variable total number of hosts |

upperCI.tothosts | Upper 95% credible interval of estimate of the predictor variable total number of hosts |

estimates.EimNHprev | Model estimate of the predictor variable Eimeria prevalence in the neighbourhood |

lowerCI.EimNHprev | Lower 95% credible interval of estimate of the predictor variable Eimeria prevalence in the neighbourhood |

upperCI.EimNHprev | Upper 95% credible interval of estimate of the predictor variable Eimeria prevalence in the neighbourhood |

estimates.HpolINF | Model estimate of the predictor variable H. polygyrus infection status of the focal host |

lowerCI.HpolINF | Lower 95% credible interval of estimate of the predictor variable H. polygyrus infection status of the focal host |

upperCI.HpolINF | Upper 95% credible interval of estimate of the predictor variable H. polygyrus infection status of the focal host |

estimates.Sex | Model estimate of the predictor variable focal host Sex |

lowerCI.Sex | Lower 95% credible interval of estimate of the predictor variable focal host Sex |

upperCI.Sex | Upper 95% credible interval of estimate of the predictor variable focal host Sex |

estimates.Age | Model estimate of the predictor variable focal host Age |

lowerCI.Age | Lower 95% credible interval of estimate of the predictor variable focal host Age |

upperCI.Age | Upper 95% credible interval of estimate of the predictor variable focal host Age |

estimates.capdate1 | Model estimate of the predictor variable capture date* |

lowerCI.capdate1 | Lower 95% credible interval of estimate of the predictor variable capture date* |

upperCI.capdate1 | Upper 95% credible interval of estimate of the predictor variable capture date* |

estimates.capdate2 | Model estimate of the predictor variable capture date* |

lowerCI.capdate2 | Lower 95% credible interval of estimate of the predictor variable capture date* |

upperCI.capdate2 | Upper 95% credible interval of estimate of the predictor variable capture date* |

estimates.intercept | Model estimate of the model intercept |

lowerCI.intercept | Lower 95% credible interval of estimate of the model intercept |

upperCI.intercept | Upper 95% credible interval of estimate of the model intercept |

estimates.raneff | Model estimate of the random effect |

lowerCI.raneff | Lower 95% credible interval of estimate of the random effect |

upperCI.raneff | Upper 95% credible interval of estimate of the random effect |

*Capture date is a second-order polynomial variable which is why there are two estimates for this.

## Instructions for use ??

There are three ways to recreate the figures in the paper:

- from scratch, generating the neighbourhood data files (step #1 below), followed by running the statistical analysis code (step #2) and the plotting code to generate the figures (step #3);
- use the previously-generated neighbourhood data files (“DATA -…csv”) and just run the statistical analysis code (step #2) and the plotting code to generate the figures (step #3);
- use the previously-generated statistical output files (“STATS - …csv”) and just run the plotting code to generate the figures (step #3).

**Step 1: Open file** `execute.parasite.function.R`

. This file takes raw data (described below) and generates neighbourhood data files that includes information on number of neighbours, and their infection statuses, for each focal capture in the raw data set. These neighbourhood data files ("DATA - …csv") are then used for the statistical analyses in step #2 below.

Lines 6 - 22 clears the environment and loads the required data file ("raw data.csv"), helper function files (`exppoints.R`

, `make.dist.vector.R`

, `prop.on.grid.R`

) and package (`gtools`

).

Lines 26 - 37 sets up distance matrices and calculates the range of distances to be used as neighbourhood sizes.

Lines 41 - 61 defines the neighbour and focal variables to be used and then prepares the dataframes accordingly.

Lines 65 - 94 defines column names for the output dataframes.

Lines 98 - 106 runs the parasite function across the selected temporal ranges.

Lines 110 - 119 write output files for these runs ("DATA - …csv").

**Step 2: Open file** `run.statistical.analysis.R`

. This file runs Bayesian Generalised Linear Mixed Effects Models on the data generated by the file above to determine the effect of neighbour parasites on focal parasites at increasing spatial scales and specified time windows. Outputs are stored in csv files ("STATS - …csv"`) used to generate the plots in step #3 below.

Line 8 clears the environment.

Line 12 - 22 loads the data output from the neighbourhood analysis generated in the execute.parasite.function.R file ("DATA - …csv").

Line 26 - 28 loads the required helper function file (`model.run.R`

) and statistical package (`brms`

).

Line 33 sets the labels to be used which is a list of the distances which have been selected.

Lines 42 - 60 selects response and explanatory parasites and variable names.

Lines 65 - 85 runs the appropriate suite of models.

Lines 90 - 136 saves the output files for the models that have been run ("STATS - …csv").

**Step 3: Open file** `combined.plotting.code.R`

. This file generates multipanel plots showing *H. polygyrus* neighbourhood effects on both *E. hungaryensis* (left-hand column) and *E. apionodes* (right-hand column) focal infection status (y-axis) against neighbourhood size (x-axis) for the different time windows (panels). Uses statistical output files (“STATS - …csv”) generated from Step 2.

Line 8 clears the environment.

Lines 12 - 58 loads the appropriate statistical output files generated in the run.statistical.analysis.R file (“STATS - …csv”).

Lines 64 – 73 creates functions to colour code points, depending whether the 95% CIs cross zero.

Line 78 sets the labels to be used which is a list of the distances which have been selected.

Lines 83 – 84 generate the output pdf with an appropriate name.

Lines 91- 94 sets plotting parameters (layout, margins etc).

Lines 97 – 162 creates a function (`plotfunc`

) for creating the paired *E. hungaryensis* and *E. apionodes* plots for each time window in turn.

Lines 166 – 170 calls `plotfunc`

for each time window in turn.

Lines 174 - 189 adds a single x-axis label for the whole plot and species labels for the two columns.

Lines 193 – 198 adds an appropriate single y-axis label, depending on the neighbourhood and focal variables.

Line 200 closes the pdf.

## Funding

Natural Environment Research Council, Award: NE/I024038/1

Natural Environment Research Council, Award: NE/I026367/1

Wellcome Trust, Award: 095831