DOI: 10.5061/dryad.tdz08kq68
title: The impact of within-host coinfection interactions on between-host parasite transmission dynamics varies with spatial scale

description: 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.
description: # 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: 1. 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); 2. 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); 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.