Introduction
The typical dataset produced for the ecological study of infectious diseases is inherently complex: it can include local, regional, or global patterns of host–parasite interactions across large historical or evolutionary temporal scales (Barrile et al. Reference Barrile, Augustine, Porensky, Duchardt, Shoemaker, Hartway, Derner, Hunter and Davidson2023; Filion et al. Reference Filion, Eriksson, Jorge, Niebuhr and Poulin2020; Mahon et al. Reference Mahon, Sack, Aleuy, Barbera, Brown, Buelow, Civitello, Cohen, de Wit, Forstchen, Halliday, Heffernan, Knutie, Korotasz, Larson, Rumschlag, Selland, Shepack, Vincent and Rohr2024; Pedersen and Davies Reference Pedersen and Davies2009). These big data can be integrated into diverse statistical approaches to predict disease risk or identify the drivers of parasite diversity and distribution in single- or multi-host systems (Buhnerkempe et al. Reference Buhnerkempe, Roberts, Dobson, Heesterbeek, Hudson and Lloyd-Smith2015; Doherty et al. Reference Doherty, Chai, Cope, de Angeli Dutra, Milotic, Ni, Park and Filion2021; Stephens et al. Reference Stephens, Altizer, Smith, Alonso Aguirre, Brown, Budischak, Byers, Dallas, Jonathan Davies, Drake, Ezenwa, Farrell, Gittleman, Han, Huang, Hutchinson, Johnson, Nunn, Onstad, Park, Vazquez-Prokopec, Schmidt and Poulin2016). Statistical approaches in disease ecology are often grouped into categories such as classical difference-finding tests (Student’s t-test, various ANOVA tests, chi-squared test, correlation tests, etc.), regression-based models in frequentist and Bayesian frameworks (linear regressions, generalised linear models, multilevel or hierarchical models, etc.), and machine-learning methods (random forests, gradient boosting, logistic bagging, etc.). However, these distinctions can obscure the fact that many commonly used techniques, such as t-tests, ANOVA, and linear regression, are part of a unified modelling framework. A more useful distinction lies in their inferential goals and their capacity to accommodate key data features, including hierarchical structure, nonlinearity, and uncertainty. These differences ultimately determine their suitability for complex ecological datasets. Many of the statistical challenges we highlight, such as pseudoreplication, hierarchical structure, and the limitations of null-hypothesis significance testing, have been recognised in ecology for decades (Hurlbert Reference Hurlbert1984). However, the rapid expansion of large, heterogeneous datasets in disease macroecology introduces new combinations of these challenges, including overlapping spatial, phylogenetic, and sampling biases (Doherty et al. Reference Doherty, Chai, Cope, de Angeli Dutra, Milotic, Ni, Park and Filion2021; Filion et al. Reference Filion, Doherty, Poulin and Godfrey2022). As a result, existing general statistical guidance is not always sufficient to inform model choice in these contexts.
While a number of these tests can adequately address the general questions asked in disease ecology, others are simply not suited to account for the large-scale and intricate nature of big data and unravel the complex patterns that are fundamental to host–parasite interactions (virulence, host immunity, phylogeny, etc.) (Acevedo et al. Reference Acevedo, Dillemuth, Flick, Faldyn and Elderd2019; Fountain-Jones et al. Reference Fountain-Jones, Pearse, Escobar, Alba-Casals, Carver, Davies, Kraberger, Papeş, Vandegrift, Worsley-Tonks and Craft2018; Lymbery et al. Reference Lymbery, Morine, Kanani, Beatty and Morgan2014). Indeed, there has been a push by statisticians in recent decades for researchers to reassess how they analyse data, emphasising a more thoughtful and practical approach when testing the relationship between variables, e.g., reassessing the reliance on p-value–centric significance testing (Leek and Peng Reference Leek and Peng2015; Nakagawa and Cuthill Reference Nakagawa and Cuthill2007; Sterne and Smith Reference Sterne and Smith2001; Wasserstein, Schirm & Lazar Reference Wasserstein, Schirm and Lazar2019). These considerations prioritise the inclusion of meaningful explanatory variables and the uncertainty surrounding predictions, which can become critical when testing for patterns and projecting risks of emerging zoonotic infectious diseases, which is further complicated by the fact that most disease datasets are themselves sparse and incomplete. Difference-finding tests remain useful in controlled experimental contexts where assumptions are met and the goal is to test specific, well-defined hypotheses, but their applicability becomes more limited as ecological datasets increase in complexity. Importantly, concerns about irreproducibility are often driven not by the statistical framework itself, but by analytical practices such as selective reporting, multiple testing, and insufficient documentation of modelling decisions.
Despite the increasing importance and availability of more robust and adaptable statistical methods like Bayesian modelling and machine learning for complex ecological data (Ellison Reference Ellison2004; Peters et al. Reference Peters, Havstad, Cushing, Tweedie, Fuentes and Villanueva-Rosales2014; Wilson et al. Reference Wilson, Lapen, Provencher and Wilson2024), simpler and less flexible difference-finding tests still hold a firm place in disease ecology (see Box 1). This may reflect the poor adoption of more modern approaches in the basic training of biostatistics in higher education curricula. For instance, studies in the UK and USA both found that undergraduate and graduate students misuse or even lack the knowledge to run rudimentary statistical analyses commonly used by researchers in biological or life sciences (A’Brook and Weyers Reference A’Brook and Weyers1996; National Research Council 2003; Metz Reference Metz2008; Weissgerber et al. Reference Weissgerber, Garovic, Milin-Lazovic, Winham, Obradovic, Trzeciakowski and Milic2016). This lack of statistical training stagnates the advancement and learning of proper inference testing (Carver et al. Reference Carver, Everson, Gabrosek, Horton, Lock, Mocko, Rossman, Rowell, Velleman, Witmer and Wood2016; Maurer et al. Reference Maurer, Hudiburgh, Werwinski and Bailer2019). Moreover, researchers and mentors tend to stick to the same analyses throughout their careers for various reasons, which could influence the methodological approaches of their students, further impeding discovery and statistical innovations (Smaldino and McElreath Reference Smaldino and McElreath2016; Ziliak and McCloskey Reference Ziliak and McCloskey2008). If this were the case, how then can we expect students and early-career researchers to adopt suitable statistical methods for the often complex datasets found in disease ecology? We emphasise that our framework does not distinguish between statistical models themselves, e.g., GLMMs, but rather between different inferential goals and analytical workflows; in many cases, frequentist and Bayesian approaches share similar model structures but differ in how inference is conducted.
Box 1.
Box 1. Here, we provide a broad overview of the statistical methods used by disease ecologists since the term was popularised in the mid 1990s (Grenfell and Dobson Reference Grenfell and Dobson1995). We searched in Web of Science for all publication records ranging from 1995 to 2024 inclusively using a suite of search words representing the four most common general types of statistical tests that exist in the wider field of ecology. We found a total of 7,483 publications matching our search criteria (see Box 1 Methods in Supplementary Material for our search words), with most publications using some type of difference-finding test (2,407 publications), followed closely by frequentist modelling (2,372 publications) and Bayesian modelling (2,234 publications), with machine learning methods being the least used (470 publications). We assumed that researchers would include statistical methods at least in the abstract in approximately equal proportion across the four types. Frequentist and Bayesian modelling caught up to difference-finding tests around the year 2007, with roughly equal proportions split between the three from that year onward. The use of machine learning shows a relatively slower pace of adoption compared to other established methods, before becoming more widely accepted (Box 1, Figure 3). Worryingly, and given the increasing calls from many groups to move away from traditional p-value significance tests, we also find that the number of publications using more traditional difference-finding tests has remained relatively steady at around 25% of publications since 2008; this type was as commonly used as frequentist and Bayesian modelling in 2024. Encouragingly though, the increasing use of machine learning since around 2017 appears to be partly making up for a slight decrease in Bayesian modelling.
Choosing a proper statistical analysis can easily become a daunting task if we do not first take the time to ask the right questions. Before getting bogged down in data purgatory and statistical significance fishing expeditions, we suggest some key considerations when exploring data and before running actual analyses. We walk you through some of the main types of modelling approaches useful for disease ecology, and provide a basic decision tree to help choose between these different strategies based on three simple questions (Figure 1): How much do you know about the system? How much do you care about the accuracy of your predictors? How much bias in the data are you working with? Based on your answers, we suggest statistical approaches that work well for different ecological data contexts and provide examples of disease-ecology studies and R coding snippets to help readers start their own analyses. We emphasise that spatial scale is used here illustratively and that model choice should ultimately depend on data structure, research aims, and available information rather than scale per se. The following sections present three example contexts (local, regional, and global) to demonstrate how analytical strategies may vary with data characteristics, not as rigid prescriptions. Having gone through our own journeys of self-motivated education in biostatistics, we hope that this perspective will serve as a useful guide for those navigating through the complex and constantly evolving landscape of statistical inference.
Figure 1.
Decision tree based on three important questions (coded in green, blue, and purple) useful for analysing data in parasite or disease ecology. The first decision is based on five overarching questions applicable to any host–parasite system: Who? (which species are investigated); Where? (what spatial patterns are there); What? (what are the hosts and the life cycle of the pathogen); How? (what determines pathogen transmission); When? (what is the seasonal or temporal patterns of the pathogen). Full arrows represent recommended pathways of analysis, whereas dashed arrows represent atypical approaches, which may depend on the system investigated. Superscripted numbers refer to R packages or tutorials available in the resources section.
Figure 1. Long description
The flowchart is organized into four horizontal tiers, each associated with a vertical label on the left.
1. Top Tier (Green): How much do you know about the system?
Five boxes ask: Who? (species), Where? (spatial determinants), What? (life cycle), How? (transmission drivers), and When? (temporal variability). Arrows lead to three outcomes: Extensive knowledge, Partial knowledge, or Poor knowledge of the system.
2. Second Tier (Blue): How much do you care about the accuracy of the predictors?
Two boxes offer: Determinants of relationships and Predictive and forecasting methods. Solid lines connect knowledge levels to these goals, with a dashed line from Poor knowledge to Predictive methods.
3. Third Tier (Orange): Recommended approaches.
Three boxes list statistical methods: Generalized linear mixed models (l m e 4 super 1), Bayesian methods (b r m s super 2), and Machine learning (randomForest super 3, g b m super 4, caret super 5).
4. Bottom Tier (Purple): How much bias in the data are you working with?
A series of binary decisions (Yes or No) begins with: Presence of collinearity between predictors (psych super 6)?
- If Yes: Are all predictors biologically relevant? (leads to pruning).
- If No: Is there spatial clustering?
- If Yes: Spatial autocorrelation super 7.
- If No: Working in a multi-species system?
- If Yes: Phylogenetic metrics super 8.
- If No: Presence of hierarchical data?
- Leads to final outputs: Structured super 9 (line graph) or Hierarchical with underlying effects super 10 (box diagram).
Diagnosing common analytical mismatches
To move beyond general recommendations, we highlight common mismatches between data structure and analytical approach in disease macroecology. These mismatches often arise when the complexity of the data is not aligned with the assumptions or capabilities of the chosen model. First, ignoring hierarchical structure, such as repeated sampling across sites, hosts, or time, can lead to pseudoreplication, inflated Type I error rates, and overconfident parameter estimates. Second, applying overly flexible or data-intensive models to small or well-controlled datasets can result in overfitting and reduced interpretability, without improving inference. Third, using predictive models on spatially biased or unevenly sampled datasets can produce spurious correlations and limit the transferability of results across regions or time periods. Identifying these mismatches prior to analysis provides a practical framework for selecting appropriate statistical tools and improving the robustness of ecological inference.
Analytical pathways in disease ecology
Disease ecologists looking for answers to some of the most complicated scientific questions in their field have access to an expanding range of statistical tools, increasing the odds of applying a suboptimal test for the system they are investigating. Here, we provide general recommendations for parasitologists to apply to their own system, with readily executable R scripts for guidance (see Supplementary Material). These R scripts include simple instructions that are detailed enough to understand the first main steps for each analysis, including data exploration and generic modelling. We will showcase three different scenarios that represent, at least from our point of view, the main analytical pathways in disease ecology. Throughout the text, we use pathogens (viruses, bacteria, fungi, and protists) and parasites (helminths and other metazoans) interchangeably, as both can cause disease, and both are studied in disease or parasite ecology. We emphasise that the following examples use spatial scale as a heuristic rather than a rule; the goal is to illustrate how analytical strategies often correspond to, but are not determined by, differences in data complexity, sample structure, and available information. Generally speaking, as we transition from a relatively small-scale local system to a large-scale global one (Fritsch et al. Reference Fritsch, Lischke, Meyer and Murrell2020), we naturally lose resolution and the ability to understand what drives parasite prevalence (How much do you know about the system?) (Figure 2). Because of this loss of resolution, researchers typically care more about accurate predictions of disease emergence rather than how a system naturally operates (How much do you care about the accuracy of your predictors?). This is especially true if there is an urgent need for disease risk mapping, e.g., predicting emergence of a novel infectious zoonotic disease. In turn, uncertainty typically increases and precision decreases with geographical scale, and varying sampling intensity can introduce different forms of bias, which limits the kinds of statistical tests that ought to be used (How much bias in the data are you working with?). Below, we highlight these biases and suggest common statistical approaches depending on the data context of the study system (Figure 1), while emphasising that alternative frameworks, e.g., GAMs, SEMs, or hierarchical Bayesian models, may be equally appropriate depending on data availability and research aims.
Figure 2.
Scale of study system and how it generally impacts the knowledge of the system, and the inherent biases that can be found in the data. These will also impact how much researchers should care about the accuracy of the model predictors. Note that host and parasite phylogenetic patterns will also increase in scale and in complexity with an increase in geographical scale.
Figure 2. Long description
The diagram is structured between two large horizontal arrows.
* At the top, a blue arrow points to the left, labeled ‘How much do you know about the system?’. This indicates that knowledge is highest at smaller scales.
* At the bottom, a red arrow points to the right, labeled ‘How much bias in the data are you working with? How much do you care about the accuracy of your predictors?’. This indicates that bias and the need for accuracy increase with scale.
Between these arrows are three vertical columns representing different scales:
1. Local scale (Left): Features a simple phylogenetic tree with four tips above a small 3D landscape of a green field and a single stream.
2. Regional scale (Center): Features a moderately complex phylogenetic tree with seven tips above a larger 3D island landscape with hills and a winding river.
3. Global scale (Right): Features a highly complex, dense phylogenetic tree with many branches above a 3D image of the Earth.
The complexity of the phylogenetic trees and the geographical representations increases linearly from left to right.
Figure 3.
(Box 1): Stacked area chart showing the yearly proportion of publications of the four general statistical approaches common in disease ecology. The second y-axis represents the total number of publications per year for all types (dashed line).
Figure 3. Long description
The x-axis represents Year from 1995 to 2024. The primary y-axis on the left shows the Proportion of publications from 0% to 100%. The secondary y-axis on the right shows Total publications from 0 to 600.
Four statistical categories are stacked vertically:
* Machine learning (purple): Occupies the bottom layer. It remains near 0% until approximately 2015, then shows a steady increase to roughly 20% by 2023.
* Bayesian modelling (teal): The second layer from the bottom. It starts at nearly 0% in 1995, begins a significant expansion around 2003, and grows to occupy about 25% of the total proportion by 2023.
* Frequentist modelling (green): The third layer. It maintains a relatively consistent thickness of about 25% to 35% throughout the entire period, though its vertical position shifts as the layers below it grow.
* Difference-finding tests (salmon): The top layer. In 1995, it dominated nearly 65% of the chart. By 2023, its proportion has contracted significantly to approximately 25%.
A dashed black line representing the total number of publications per year starts at approximately 75 in 1995, remains low until 2003, and then shows a steep, near-linear increase, peaking at 600 publications around 2022 before a slight dip in 2023.
Example 1: local-scale systems
Local-scale systems refer to studies confined to a single landscape, population, or ecosystem where environmental variation and host diversity are limited. These systems are ideal for answering system-specific questions or testing ecological and evolutionary theory due to their relative simplicity and because most potential sources of bias can be explicitly measured or controlled. Applying an extremely powerful statistical method requiring complex model building or some sort of stochastic element (machine learning) will probably achieve the wrong goal (predicting instead of understanding), be time-consuming, and is akin to killing a fly with a bazooka, i.e., overkill. In most cases, whether investigating the ecological drivers of a parasite or trying to get a deeper understand of mechanisms leading to higher abundance or prevalence of a given disease-causing agent, a generalised linear mixed-effects model (GLMM) will be appropriate. This can be done with the ‘glmer’ function in the lme4 package (Bates et al. Reference Bates, Maechler, Bolker and Walker2015). These frequentist models are very useful to provide a clear understanding of the potential drivers of ecological phenomena while also allowing to account for biasing covariates and hierarchical data, such as controlling for a known pathogen covariate, e.g., body mass, and random intercepts for sampling site or host species and, when justified, random slopes for temporal or environmental covariates (Burnham and Anderson Reference Burnham and Anderson2002; Zuur, Ieno and Elphick Reference Zuur, Ieno and Elphick2010) (see Part 1 in Supplementary Material). A critical diagnostic step at this scale is assessing whether observations are independent. When repeated measurements occur across sites, hosts, or time, failing to account for grouping structure can result in pseudoreplication and inflated statistical significance. In such cases, mixed-effects models provide a straightforward and widely accepted correction. If no such grouping exists, a standard generalised linear model (GLM) is sufficient. This type of analysis requires a priori decisions when building your model, i.e., which variables to include based on your knowledge of the system. Model selection using information criteria (AIC, WAIC, or cross-validation) remains essential for identifying parsimonious models and avoiding over-fitting. As these methods are relatively well known and have steadily been used for the past 30 years or so (see Box 1), we will not discuss them extensively here (for more information, see Zuur et al. Reference Zuur, Ieno, Walker, Saveliev and Smith2009). Alternative frameworks such as generalised additive models (GAMs) or structural-equation models (SEMs) may be equally useful depending on the dataset and research objectives. GAMs are particularly effective when relationships between predictors and response variables are nonlinear or involve smooth gradients across space or time, while SEMs can explicitly represent causal hypotheses through linked equations and are valuable when indirect or mediating effects between ecological variables are of interest.
Example 2: regional-scale systems
Regional-scale systems encompass multiple populations or landscapes within a biogeographic region, where spatial heterogeneity and inter-community interactions become more influential. Transitioning from local to regional systems, thereby crossing landscape boundaries, naturally increases the complexity of the investigated data, but also the number of biases present in the system. For instance, increasing the spatial scale also increases the interactions among different host and parasite species; this adds an additional layer of complexity as local-scale drivers tend to dilute at large spatial scales (Cohen et al. Reference Cohen, Civitello, Brace, Feichtinger, Ortega, Richardson, Sauer, Liu and Rohr2016). Another key challenge at this scale is distinguishing true ecological patterns from artefacts of sampling effort. Uneven sampling across regions can create apparent spatial trends that reflect observation bias rather than biological processes. Incorporating hierarchical structure, spatial random effects, or explicitly modelling sampling effort can help mitigate these issues. Moreover, interactions between different communities or metapopulations will add a significant amount of complexity to any disease system, exponentially increasing the number of biases when trying to disentangle disease patterns and spread. For example, how can you be sure that the abundance of an investigated parasite is not driven by an increase in the biodiversity of alternative hosts present in the wider community, potentially diluting or boosting parasite host range? Even though statistical methods allow for the inclusion of such phylogenetic interactions since the early 1990s (Harvey and Pagel Reference Harvey and Pagel1991), the adoption rate of these methods among disease ecologists remains slow (Filion et al. Reference Filion, Doherty, Poulin and Godfrey2022). Other metrics, such as connectivity between landscape patches and habitat density (Correa Ayram et al. Reference Correa Ayram, Mendoza, Etter and Salicrup2016), must also be considered. As such, an approach incorporating more powerful and adaptable statistics is needed. Luckily for disease ecologists, other types of models other than standard GLMs exist to overcome such issues. In this light, Bayesian methods provide key improvements, allowing researchers to consider community-wide interactions, more complex hierarchical data, host and parasite phylogenies, and more (Banner et al. Reference Banner, Irvine, Rodhouse and O’Hara2020; Filion et al. Reference Filion, Doherty, Poulin and Godfrey2022).
A principal advantage of Bayesian modelling is its capacity to incorporate prior information, allowing estimates to adjust according to existing knowledge of the system. From our point of view, the main differences between frequentist and Bayesian statistics are mostly philosophical, as Bayesian models report credible intervals instead of confidence intervals. As such, a credible interval would give the user a 95% probability that the true value of the predictors lies within this interval, as opposed to a confidence interval, which defines that in n number of repeated experiments, the confidence interval would contain the true predictor value 95% of the time (Kruschke Reference Kruschke2010). However, these methods still require the user to have some a priori knowledge about the system they are investigating, as they need specific priors for each variable to run efficiently. While there are a few functions in the main R packages that offer a comprehensive Bayesian approach to most systems, e.g., ‘get_prior’ in the brms package (Bürkner Reference Bürkner2017, Reference Bürkner2018), the recommendations for priors are to account for the distribution family of the response variable and any random effects, and do not offer any consideration for the predictors. This is where having some knowledge of the system is very useful. For example, if investigating the effect of temperature on cercarial emergence in an intertidal snail or on mosquito emergence in a vector-borne disease system, you would expect that an increase in this variable would result in higher parasite abundance based on an a priori literature search and would therefore adjust the priors for this coefficient accordingly based on the expectation you have in your system. Without any kind of knowledge on the system, the model would default to ‘flat’ priors, thus offering no real advantage of switching to Bayesian from frequentist modelling. Another key improvement in these methods is that they are highly customisable, but also have a wide online community to support the improvement of novel methods4 (see Part 2 in Supplementary Material). Like with frequentist approaches, model selection (BIC, LOO-CV, etc.) helps select the model that best balances fit with complexity. Many of the conveniences often attributed to Bayesian models, such as model flexibility or phylogenetic integration, actually stem from particular software implementations rather than from Bayesian inference itself. For instance, numerous tutorials that are constantly evolving allow users to include phylogenetic information8 or create SEMs11 using brms, facilitating the switch to these methods and improving the range of tools available to any end-user.
Example 3: global-scale systems
Finally, going from regional systems to even wider spatial scales (continental or near-global studies) tends to exponentially increase the complexity of the data and covariate structuring. For example, helminth diversity in anuran amphibians is primarily driven by the distance between sampling locations at global scales, whereas climatic effects overshadow spatial distance at regional scales (Martins et al. Reference Martins, Poulin and Gonçalves-Souza2021). In vector-borne systems, avian influenza (H5N1) is known to be regionally driven by the presence of suitable habitats for waterfowl species like wetlands, poultry farming, and seasonal migration of waterfowl (Gilbert et al. Reference Gilbert, Xiao, Domenech, Lubroth, Martin and Slingenbergh2006). However, when spatial scale was increased, the same authors found that regional drivers of avian influenza spread lost their significance and were overpowered by socioeconomic factors and the large migration patterns of waterfowl (Gilbert et al. Reference Gilbert, Xiao, Pfeiffer, Epprecht, Boles, Czarnecki, Chaitaweesub, Kalpravidh, Minh, Otte, Martin and Slingenbergh2008). Thus, a new category of biases, i.e., large-scale biases (socioeconomic factors, climate change, community stability, etc.), can become predominant at global scales, even though they may have little or no influence at local scales (de Angeli Dutra and Poulin Reference de Angeli Dutra and Poulin2024; Mora et al. Reference Mora, McKenzie, Gaw, Dean, von Hammerstein, Knudson, Setter, Smith, Webster, Patz and Franklin2022; Sokolow et al. Reference Sokolow, Nova, Jones, Wood, Lafferty, Garchitorena, Hopkins, Lund, MacDonald, LeBoa, Peel, Mordecai, Howard, Buck, Lopez-Carr, Barry, Bonds and De Leo2022). Global-scale analyses can still yield strong mechanistic insights (e.g., Wilson et al. Reference Wilson, Lapen, Provencher and Wilson2024, global Toxoplasma prevalence), demonstrating that large spatial coverage does not preclude inference about drivers. While disentangling and quantifying the relevant drivers of parasite abundance becomes more of a mission at increasing scales of geography, an advanced category of statistical tools exists to help researchers deal with this level of complex data. Having gone on our own fishing expeditions due to the large quantity of available databases at these scales (see Doherty et al. Reference Doherty, Chai, Cope, de Angeli Dutra, Milotic, Ni, Park and Filion2021), we posit that, in these systems, a careful hypothesis-driven approach should be prioritised. This is where machine learning approaches thrive, especially if one is considering more accurate forecasting of disease emergence patterns.
Most machine learning approaches tend to be robust to the inclusion of many predictor variables and are flexible when it comes to the distribution of the response variable (Elith, Leathwick and Hastie Reference Elith, Leathwick and Hastie2008). They also allow for nonlinear and threshold effects to be detected using marginal plots, a particularly useful tool when investigating large-scale data (Kuhn and Johnson Reference Kuhn and Johnson2013). Because of the stochastic nature of these approaches, model structuring is mostly determined by the data used, and thus few a priori decisions are generally required. As these methods are relatively recent, we include more detailed considerations below. We note that machine learning approaches are not limited to global or regional scales; they can also be effective in local contexts when dense temporal or surveillance datasets are available, e.g., seasonal influenza forecasting. Other frameworks such as hybrid Bayesian–machine-learning methods or SEMs may also serve similar predictive or explanatory roles, depending on data type and objectives. Despite their flexibility and predictive power, machine learning approaches are not universally appropriate. In disease macroecology, datasets are often spatially biased, sparse, or unevenly sampled, which can lead to overfitting and poor transferability of models across regions or time periods. Without careful validation, models may capture artefacts of sampling effort rather than true ecological processes, limiting their usefulness for inference and prediction. Despite their flexibility, machine-learning models are sensitive to data leakage, hyperparameter choices, and spatial autocorrelation. Without explicit reporting of these elements, results may vary substantially across repeated analyses, limiting reproducibility and comparability between studies.
To help curb limitations in machine learning inference, something that is particularly useful when it comes to machine learning is knowing how to create a repeatable model with your dataset. Most literature recommendations tend to suggest using about 2/3 of your database to train your model (hereafter called the training dataset), leaving about 1/3 of the data as a validating dataset (Kuhn and Johnson Reference Kuhn and Johnson2013). When choosing your training dataset, a careful and balanced approach should be considered, as it will further determine the robustness of your results. For instance, take any given disease with 1,000 records of presence/absence locations worldwide, with 950 being locations with no disease detection and 50 being locations with actual records. If the training dataset is imbalanced and includes a disproportionally high number of absence locations, the model’s relevancy will decrease since the validating dataset missed a great deal of information, i.e., predicting bias towards absence data. This will subsequently lead to more problems as this newly trained model will return a very high accuracy (in this example, about 95%), because it will be able to predict most of the data 100% of the time! A good way to avoid such issues lies with careful planning and execution. First, remixing all the rows in your dataset before creating your training and validating datasets is a good way to make sure that there is no ‘data clumping’ (see Kuhn and Johnson Reference Kuhn and Johnson2013 for details on this method). Second, approaches that circumvent this sampling bias when creating the training dataset, such as oversampling rare instances or undersampling the majority group, will help achieve a balanced and accurate model. Third, and this is perhaps the most relevant for new machine learning users, there are built-in functions in R packages, such as the ‘sampling’ function in the caret package (Kuhn Reference Kuhn2008), that can create a balanced sampling design between response variable categories. However, as with any approach, there are a few downsides with machine learning methods. For instance, they tend to behave erratically when presented with a suite of collinear variables, giving weight to only one predictor while systematically rejecting all others, with no repeatable patterns between model runs (Elith, Leathwick and Hastie Reference Elith, Leathwick and Hastie2008).
In addition, machine learning methods tend to be data hungry, requiring a vast amount of data to run efficiently (Domingos Reference Domingos2012). Another key limitation of machine learning approaches is their susceptibility to overfitting, particularly when predictors are numerous relative to sample size or when data are spatially biased, a common feature of global disease datasets. In such cases, models may perform well on training data but fail to generalise to new regions or time periods, limiting their usefulness for forecasting. Often, this happens when the model has too many predictors and tries to analyse the noise of the data instead. A simple workaround is to start with a simpler model with few predictors, and build up from there (Domingos Reference Domingos2012). We provide detailed examples of machine learning using a few of the most popular R packages for ecologists (Part 3 in Supplementary Material), such as caret, gbm (Ridgeway et al. Reference Ridgeway, Edwards, Kriegler, Schroedl, Southworth, Greenwell, Boehmke and Cunningham2024), and randomForest (Liaw and Wiener Reference Liaw and Wiener2002). Ensuring model transferability, i.e., the ability to make reliable predictions beyond the training domain, should therefore be a central consideration when applying these methods, particularly in global disease risk mapping. While simple train/test splits are widely used, alternative approaches such as k-fold cross-validation or spatial blocking may provide more robust estimates of model performance, particularly in spatially structured ecological datasets where observations are not independent.
Other considerations
At this point, the reader will have noticed that we have barely mentioned anything about difference-finding tests (ANOVAs, t-tests, and others). This is because we caution against an overreliance on p-value–centric significance testing in complex ecological datasets, particularly when model assumptions are not met or when analytical decisions are not transparently reported (Leek and Peng Reference Leek and Peng2015; Nakagawa and Cuthill Reference Nakagawa and Cuthill2007; Sterne and Smith Reference Sterne and Smith2001; Wasserstein, Schirm and Lazar Reference Wasserstein, Schirm and Lazar2019). These tests can have inflexible assumptions about the nature of the data they can analyse, which limits their applicability when dealing with hierarchical structures, random effects, phylogenetic signals, or substantial data biases. From our point of view, assessing differences between groups from p-values alone as opposed to calculating relevant effect sizes retains little biological value when comparing patterns across studies, something that could become critical with the increasing rate of emerging infectious diseases worldwide (Baker et al. Reference Baker, Mahmud, Miller, Rajeev, Rasambainarivo, Rice, Takahashi, Tatem, Wagner, Wang, Wesolowski and Metcalf2022). That said, difference-finding tests remain useful in small-scale, controlled experiments or well-balanced study designs where assumptions are met, and the goal is to test specific hypotheses in controlled settings, e.g., lab-based experiments. A concise overview of the strengths, limitations, and typical use cases of each analytical approach is provided in Table 1 to help readers select appropriate methods.
Table 1.
Summary of common statistical approaches used in disease macroecology

Table 1. Long description
The table consists of four columns and four rows of data.
* Row 1: Difference-finding tests (e.g., t-tests, A N O V A s). Strengths include simple implementation and suitability for small experiments. Limitations include inflexible assumptions and poor handling of hierarchical data. Typical use cases are preliminary comparisons and controlled laboratory studies.
* Row 2: Frequentist models (e.g., G L M s, G L M M s). Strengths include transparent inference and broad software support. Limitations include limited flexibility for complex dependencies. Typical use cases are local- to regional-scale ecological datasets.
* Row 3: Bayesian models (e.g., hierarchical, phylogenetic). Strengths include incorporating prior knowledge and handling hierarchical data. Limitations include being computationally intensive and requiring prior specification. Typical use cases are regional- to continental-scale analyses.
* Row 4: Machine-learning models (e.g., random forests, boosted trees, neural networks). Strengths include handling large nonlinear datasets and strong predictive accuracy. Limitations include limited interpretability and risk of overfitting. Typical use cases are predictive mapping and global-scale risk assessment.
We strongly recommend that researchers present the underlying code that generated their results in such a way that is fully transparent, easily understood with detailed instructions included in the script, and easily reproduced with the data provided. Like the R scripts that were provided in this paper, readers should be able to download the scripts and the data from a paper and, within minutes to hours (pending proper package installation and the type of analysis), obtain the same major results as in the paper (within the same margin of error if working with Bayesian or machine learning methods). We also encourage authors to include examples of residual and predictive checks in their code, e.g., plotting residuals vs. fitted values, visualising posterior predictions, or comparing observed vs. predicted data, to verify model fit and performance.
Within the past few years, we have also seen an exponential growth of specialised machine learning models known as large language models (LLMs) such as OpenAI’s GPT-512 and Meta’s Llama13. These LLMs can be useful to help write scripts for statistical analyses in R or Python, as they are capable of synthesising innumerable quantities of scripts and queries from the internet (although, see Chen et al. Reference Chen, Tworek, Jun, Yuan, Henrique Ponde de Oliveira, Kaplan, Edwards, Burda, Nicholas, Brockman, Ray, Puri, Krueger, Petrov, Khlaaf, Sastry, Mishkin, Chan, Gray, Ryder, Pavlov, Power, Kaiser, Bavarian, Winter, Tillet, Such, Cummings, Plappert, Chantzis, Barnes, Herbert-Voss, Guss, Nichol, Paino, Tezak, Tang, Babuschkin, Balaji, Jain, Saunders, Hesse, Carr, Leike, Achiam, Misra, Morikawa, Radford, Knight, Brundage, Murati, Mayer, Welinder, McGrew, Amodei, McCandlish, Sutskever and Zaremba2021). These LLMs are becoming useful and powerful tools to help build or improve R and Python scripts using simple prompts for the purpose of statistical tests in practically any area of research. Here, we urge caution upon those who are just beginning to learn how to write their own scripts. Regardless of your needs, we strongly encourage that you have a solid foundation in R or Python coding before copy-pasting and running codes generated solely by LLMs. In our experience, this will undoubtedly save a lot of headaches and time as these prompt-generated codes are often imperfect and can hide subtle mistakes if you are not familiar with script writing. Moreover, because hallucination rates remain disproportionately high in most current LLMs, blindly trusting an LLM-generated script without domain knowledge can easily lead to biased results. In short, just because it is convenient does not mean it is reliable. Learning basic coding from a good guide in data science (e.g., Wickham et al. Reference Wickham, Çetinkaya-Rundel and Grolemund2023) will set you on the right path. The recommendations presented here are most relevant to ecological and disease-ecological studies, where hierarchical sampling and natural variability are common, rather than to tightly controlled experimental systems.
Future perspectives
Disease macroecology is an ever-expanding field, and with increasing amounts of ecological, environmental, and molecular data becoming available, these illustrative analytical frameworks will continue to evolve. The purpose of this perspective was to provide simple examples of how data characteristics, scale, and research objectives can guide appropriate statistical approaches without implying that a single ‘best model’ exists for any given context. Rather than advocating for any single class of models, our goal is to align analytical choices with data structure, inference goals, and the limitations inherent to ecological datasets. Future methodological developments should focus on flexibility, combining interpretability from classical models with the predictive capacity of machine learning, and on transparent model validation so that results remain reproducible across platforms and data sources.
We urge disease ecologists to move away from difference-finding tests and stop relying solely on p-values. Too often, when preparing comparative or meta-analyses, we find ourselves having to reject potentially useful studies or datapoints from our dataset because of poorly reported results. We suggest that disease ecologists report the predictive power of each model predictor, i.e., effect sizes and confidence or credible intervals (for machine learning, the relative variable influence). In addition, authors should include sufficient information on model structure, diagnostics, and data-processing steps so that analyses can be independently verified and reproduced. With the current rate of emerging infectious diseases worldwide, we urge disease ecologists to adopt a standardised statistical protocol when publishing their data and their scripts, and to keep innovating in the methods and tools they use in an open and transparent way. Continued integration of flexible analytical frameworks, combining interpretability from classical models with the predictive capacity of modern computational methods, will further strengthen the field. We strongly believe that only then will researchers begin to fully grasp the drivers and patterns of parasite occurrence to build more accurate guidelines and better forecast future emergence of disease.
Rather than reiterating general statistical principles, our goal is to contextualise them within the specific challenges of disease macroecology, where scale, bias, and data heterogeneity interact in ways that complicate standard analytical workflows. By explicitly linking these data characteristics to their statistical consequences, we provide a practical framework to support more transparent, reproducible, and context-dependent analytical decisions.
Introduction
The typical dataset produced for the ecological study of infectious diseases is inherently complex: it can include local, regional, or global patterns of host–parasite interactions across large historical or evolutionary temporal scales (Barrile et al. Reference Barrile, Augustine, Porensky, Duchardt, Shoemaker, Hartway, Derner, Hunter and Davidson2023; Filion et al. Reference Filion, Eriksson, Jorge, Niebuhr and Poulin2020; Mahon et al. Reference Mahon, Sack, Aleuy, Barbera, Brown, Buelow, Civitello, Cohen, de Wit, Forstchen, Halliday, Heffernan, Knutie, Korotasz, Larson, Rumschlag, Selland, Shepack, Vincent and Rohr2024; Pedersen and Davies Reference Pedersen and Davies2009). These big data can be integrated into diverse statistical approaches to predict disease risk or identify the drivers of parasite diversity and distribution in single- or multi-host systems (Buhnerkempe et al. Reference Buhnerkempe, Roberts, Dobson, Heesterbeek, Hudson and Lloyd-Smith2015; Doherty et al. Reference Doherty, Chai, Cope, de Angeli Dutra, Milotic, Ni, Park and Filion2021; Stephens et al. Reference Stephens, Altizer, Smith, Alonso Aguirre, Brown, Budischak, Byers, Dallas, Jonathan Davies, Drake, Ezenwa, Farrell, Gittleman, Han, Huang, Hutchinson, Johnson, Nunn, Onstad, Park, Vazquez-Prokopec, Schmidt and Poulin2016). Statistical approaches in disease ecology are often grouped into categories such as classical difference-finding tests (Student’s t-test, various ANOVA tests, chi-squared test, correlation tests, etc.), regression-based models in frequentist and Bayesian frameworks (linear regressions, generalised linear models, multilevel or hierarchical models, etc.), and machine-learning methods (random forests, gradient boosting, logistic bagging, etc.). However, these distinctions can obscure the fact that many commonly used techniques, such as t-tests, ANOVA, and linear regression, are part of a unified modelling framework. A more useful distinction lies in their inferential goals and their capacity to accommodate key data features, including hierarchical structure, nonlinearity, and uncertainty. These differences ultimately determine their suitability for complex ecological datasets. Many of the statistical challenges we highlight, such as pseudoreplication, hierarchical structure, and the limitations of null-hypothesis significance testing, have been recognised in ecology for decades (Hurlbert Reference Hurlbert1984). However, the rapid expansion of large, heterogeneous datasets in disease macroecology introduces new combinations of these challenges, including overlapping spatial, phylogenetic, and sampling biases (Doherty et al. Reference Doherty, Chai, Cope, de Angeli Dutra, Milotic, Ni, Park and Filion2021; Filion et al. Reference Filion, Doherty, Poulin and Godfrey2022). As a result, existing general statistical guidance is not always sufficient to inform model choice in these contexts.
While a number of these tests can adequately address the general questions asked in disease ecology, others are simply not suited to account for the large-scale and intricate nature of big data and unravel the complex patterns that are fundamental to host–parasite interactions (virulence, host immunity, phylogeny, etc.) (Acevedo et al. Reference Acevedo, Dillemuth, Flick, Faldyn and Elderd2019; Fountain-Jones et al. Reference Fountain-Jones, Pearse, Escobar, Alba-Casals, Carver, Davies, Kraberger, Papeş, Vandegrift, Worsley-Tonks and Craft2018; Lymbery et al. Reference Lymbery, Morine, Kanani, Beatty and Morgan2014). Indeed, there has been a push by statisticians in recent decades for researchers to reassess how they analyse data, emphasising a more thoughtful and practical approach when testing the relationship between variables, e.g., reassessing the reliance on p-value–centric significance testing (Leek and Peng Reference Leek and Peng2015; Nakagawa and Cuthill Reference Nakagawa and Cuthill2007; Sterne and Smith Reference Sterne and Smith2001; Wasserstein, Schirm & Lazar Reference Wasserstein, Schirm and Lazar2019). These considerations prioritise the inclusion of meaningful explanatory variables and the uncertainty surrounding predictions, which can become critical when testing for patterns and projecting risks of emerging zoonotic infectious diseases, which is further complicated by the fact that most disease datasets are themselves sparse and incomplete. Difference-finding tests remain useful in controlled experimental contexts where assumptions are met and the goal is to test specific, well-defined hypotheses, but their applicability becomes more limited as ecological datasets increase in complexity. Importantly, concerns about irreproducibility are often driven not by the statistical framework itself, but by analytical practices such as selective reporting, multiple testing, and insufficient documentation of modelling decisions.
Despite the increasing importance and availability of more robust and adaptable statistical methods like Bayesian modelling and machine learning for complex ecological data (Ellison Reference Ellison2004; Peters et al. Reference Peters, Havstad, Cushing, Tweedie, Fuentes and Villanueva-Rosales2014; Wilson et al. Reference Wilson, Lapen, Provencher and Wilson2024), simpler and less flexible difference-finding tests still hold a firm place in disease ecology (see Box 1). This may reflect the poor adoption of more modern approaches in the basic training of biostatistics in higher education curricula. For instance, studies in the UK and USA both found that undergraduate and graduate students misuse or even lack the knowledge to run rudimentary statistical analyses commonly used by researchers in biological or life sciences (A’Brook and Weyers Reference A’Brook and Weyers1996; National Research Council 2003; Metz Reference Metz2008; Weissgerber et al. Reference Weissgerber, Garovic, Milin-Lazovic, Winham, Obradovic, Trzeciakowski and Milic2016). This lack of statistical training stagnates the advancement and learning of proper inference testing (Carver et al. Reference Carver, Everson, Gabrosek, Horton, Lock, Mocko, Rossman, Rowell, Velleman, Witmer and Wood2016; Maurer et al. Reference Maurer, Hudiburgh, Werwinski and Bailer2019). Moreover, researchers and mentors tend to stick to the same analyses throughout their careers for various reasons, which could influence the methodological approaches of their students, further impeding discovery and statistical innovations (Smaldino and McElreath Reference Smaldino and McElreath2016; Ziliak and McCloskey Reference Ziliak and McCloskey2008). If this were the case, how then can we expect students and early-career researchers to adopt suitable statistical methods for the often complex datasets found in disease ecology? We emphasise that our framework does not distinguish between statistical models themselves, e.g., GLMMs, but rather between different inferential goals and analytical workflows; in many cases, frequentist and Bayesian approaches share similar model structures but differ in how inference is conducted.
Box 1. Here, we provide a broad overview of the statistical methods used by disease ecologists since the term was popularised in the mid 1990s (Grenfell and Dobson Reference Grenfell and Dobson1995). We searched in Web of Science for all publication records ranging from 1995 to 2024 inclusively using a suite of search words representing the four most common general types of statistical tests that exist in the wider field of ecology. We found a total of 7,483 publications matching our search criteria (see Box 1 Methods in Supplementary Material for our search words), with most publications using some type of difference-finding test (2,407 publications), followed closely by frequentist modelling (2,372 publications) and Bayesian modelling (2,234 publications), with machine learning methods being the least used (470 publications). We assumed that researchers would include statistical methods at least in the abstract in approximately equal proportion across the four types. Frequentist and Bayesian modelling caught up to difference-finding tests around the year 2007, with roughly equal proportions split between the three from that year onward. The use of machine learning shows a relatively slower pace of adoption compared to other established methods, before becoming more widely accepted (Box 1, Figure 3). Worryingly, and given the increasing calls from many groups to move away from traditional p-value significance tests, we also find that the number of publications using more traditional difference-finding tests has remained relatively steady at around 25% of publications since 2008; this type was as commonly used as frequentist and Bayesian modelling in 2024. Encouragingly though, the increasing use of machine learning since around 2017 appears to be partly making up for a slight decrease in Bayesian modelling.
Choosing a proper statistical analysis can easily become a daunting task if we do not first take the time to ask the right questions. Before getting bogged down in data purgatory and statistical significance fishing expeditions, we suggest some key considerations when exploring data and before running actual analyses. We walk you through some of the main types of modelling approaches useful for disease ecology, and provide a basic decision tree to help choose between these different strategies based on three simple questions (Figure 1): How much do you know about the system? How much do you care about the accuracy of your predictors? How much bias in the data are you working with? Based on your answers, we suggest statistical approaches that work well for different ecological data contexts and provide examples of disease-ecology studies and R coding snippets to help readers start their own analyses. We emphasise that spatial scale is used here illustratively and that model choice should ultimately depend on data structure, research aims, and available information rather than scale per se. The following sections present three example contexts (local, regional, and global) to demonstrate how analytical strategies may vary with data characteristics, not as rigid prescriptions. Having gone through our own journeys of self-motivated education in biostatistics, we hope that this perspective will serve as a useful guide for those navigating through the complex and constantly evolving landscape of statistical inference.
Decision tree based on three important questions (coded in green, blue, and purple) useful for analysing data in parasite or disease ecology. The first decision is based on five overarching questions applicable to any host–parasite system: Who? (which species are investigated); Where? (what spatial patterns are there); What? (what are the hosts and the life cycle of the pathogen); How? (what determines pathogen transmission); When? (what is the seasonal or temporal patterns of the pathogen). Full arrows represent recommended pathways of analysis, whereas dashed arrows represent atypical approaches, which may depend on the system investigated. Superscripted numbers refer to R packages or tutorials available in the resources section.
Figure 1. Long description
The flowchart is organized into four horizontal tiers, each associated with a vertical label on the left.
1. Top Tier (Green): How much do you know about the system?
Five boxes ask: Who? (species), Where? (spatial determinants), What? (life cycle), How? (transmission drivers), and When? (temporal variability). Arrows lead to three outcomes: Extensive knowledge, Partial knowledge, or Poor knowledge of the system.
2. Second Tier (Blue): How much do you care about the accuracy of the predictors?
Two boxes offer: Determinants of relationships and Predictive and forecasting methods. Solid lines connect knowledge levels to these goals, with a dashed line from Poor knowledge to Predictive methods.
3. Third Tier (Orange): Recommended approaches.
Three boxes list statistical methods: Generalized linear mixed models (l m e 4 super 1), Bayesian methods (b r m s super 2), and Machine learning (randomForest super 3, g b m super 4, caret super 5).
4. Bottom Tier (Purple): How much bias in the data are you working with?
A series of binary decisions (Yes or No) begins with: Presence of collinearity between predictors (psych super 6)?
- If Yes: Are all predictors biologically relevant? (leads to pruning).
- If No: Is there spatial clustering?
- If Yes: Spatial autocorrelation super 7.
- If No: Working in a multi-species system?
- If Yes: Phylogenetic metrics super 8.
- If No: Presence of hierarchical data?
- Leads to final outputs: Structured super 9 (line graph) or Hierarchical with underlying effects super 10 (box diagram).
Diagnosing common analytical mismatches
To move beyond general recommendations, we highlight common mismatches between data structure and analytical approach in disease macroecology. These mismatches often arise when the complexity of the data is not aligned with the assumptions or capabilities of the chosen model. First, ignoring hierarchical structure, such as repeated sampling across sites, hosts, or time, can lead to pseudoreplication, inflated Type I error rates, and overconfident parameter estimates. Second, applying overly flexible or data-intensive models to small or well-controlled datasets can result in overfitting and reduced interpretability, without improving inference. Third, using predictive models on spatially biased or unevenly sampled datasets can produce spurious correlations and limit the transferability of results across regions or time periods. Identifying these mismatches prior to analysis provides a practical framework for selecting appropriate statistical tools and improving the robustness of ecological inference.
Analytical pathways in disease ecology
Disease ecologists looking for answers to some of the most complicated scientific questions in their field have access to an expanding range of statistical tools, increasing the odds of applying a suboptimal test for the system they are investigating. Here, we provide general recommendations for parasitologists to apply to their own system, with readily executable R scripts for guidance (see Supplementary Material). These R scripts include simple instructions that are detailed enough to understand the first main steps for each analysis, including data exploration and generic modelling. We will showcase three different scenarios that represent, at least from our point of view, the main analytical pathways in disease ecology. Throughout the text, we use pathogens (viruses, bacteria, fungi, and protists) and parasites (helminths and other metazoans) interchangeably, as both can cause disease, and both are studied in disease or parasite ecology. We emphasise that the following examples use spatial scale as a heuristic rather than a rule; the goal is to illustrate how analytical strategies often correspond to, but are not determined by, differences in data complexity, sample structure, and available information. Generally speaking, as we transition from a relatively small-scale local system to a large-scale global one (Fritsch et al. Reference Fritsch, Lischke, Meyer and Murrell2020), we naturally lose resolution and the ability to understand what drives parasite prevalence (How much do you know about the system?) (Figure 2). Because of this loss of resolution, researchers typically care more about accurate predictions of disease emergence rather than how a system naturally operates (How much do you care about the accuracy of your predictors?). This is especially true if there is an urgent need for disease risk mapping, e.g., predicting emergence of a novel infectious zoonotic disease. In turn, uncertainty typically increases and precision decreases with geographical scale, and varying sampling intensity can introduce different forms of bias, which limits the kinds of statistical tests that ought to be used (How much bias in the data are you working with?). Below, we highlight these biases and suggest common statistical approaches depending on the data context of the study system (Figure 1), while emphasising that alternative frameworks, e.g., GAMs, SEMs, or hierarchical Bayesian models, may be equally appropriate depending on data availability and research aims.
Scale of study system and how it generally impacts the knowledge of the system, and the inherent biases that can be found in the data. These will also impact how much researchers should care about the accuracy of the model predictors. Note that host and parasite phylogenetic patterns will also increase in scale and in complexity with an increase in geographical scale.
Figure 2. Long description
The diagram is structured between two large horizontal arrows.
* At the top, a blue arrow points to the left, labeled ‘How much do you know about the system?’. This indicates that knowledge is highest at smaller scales.
* At the bottom, a red arrow points to the right, labeled ‘How much bias in the data are you working with? How much do you care about the accuracy of your predictors?’. This indicates that bias and the need for accuracy increase with scale.
Between these arrows are three vertical columns representing different scales:
1. Local scale (Left): Features a simple phylogenetic tree with four tips above a small 3D landscape of a green field and a single stream.
2. Regional scale (Center): Features a moderately complex phylogenetic tree with seven tips above a larger 3D island landscape with hills and a winding river.
3. Global scale (Right): Features a highly complex, dense phylogenetic tree with many branches above a 3D image of the Earth.
The complexity of the phylogenetic trees and the geographical representations increases linearly from left to right.
(Box 1): Stacked area chart showing the yearly proportion of publications of the four general statistical approaches common in disease ecology. The second y-axis represents the total number of publications per year for all types (dashed line).
Figure 3. Long description
The x-axis represents Year from 1995 to 2024. The primary y-axis on the left shows the Proportion of publications from 0% to 100%. The secondary y-axis on the right shows Total publications from 0 to 600.
Four statistical categories are stacked vertically:
* Machine learning (purple): Occupies the bottom layer. It remains near 0% until approximately 2015, then shows a steady increase to roughly 20% by 2023.
* Bayesian modelling (teal): The second layer from the bottom. It starts at nearly 0% in 1995, begins a significant expansion around 2003, and grows to occupy about 25% of the total proportion by 2023.
* Frequentist modelling (green): The third layer. It maintains a relatively consistent thickness of about 25% to 35% throughout the entire period, though its vertical position shifts as the layers below it grow.
* Difference-finding tests (salmon): The top layer. In 1995, it dominated nearly 65% of the chart. By 2023, its proportion has contracted significantly to approximately 25%.
A dashed black line representing the total number of publications per year starts at approximately 75 in 1995, remains low until 2003, and then shows a steep, near-linear increase, peaking at 600 publications around 2022 before a slight dip in 2023.
Example 1: local-scale systems
Local-scale systems refer to studies confined to a single landscape, population, or ecosystem where environmental variation and host diversity are limited. These systems are ideal for answering system-specific questions or testing ecological and evolutionary theory due to their relative simplicity and because most potential sources of bias can be explicitly measured or controlled. Applying an extremely powerful statistical method requiring complex model building or some sort of stochastic element (machine learning) will probably achieve the wrong goal (predicting instead of understanding), be time-consuming, and is akin to killing a fly with a bazooka, i.e., overkill. In most cases, whether investigating the ecological drivers of a parasite or trying to get a deeper understand of mechanisms leading to higher abundance or prevalence of a given disease-causing agent, a generalised linear mixed-effects model (GLMM) will be appropriate. This can be done with the ‘glmer’ function in the lme4 package (Bates et al. Reference Bates, Maechler, Bolker and Walker2015). These frequentist models are very useful to provide a clear understanding of the potential drivers of ecological phenomena while also allowing to account for biasing covariates and hierarchical data, such as controlling for a known pathogen covariate, e.g., body mass, and random intercepts for sampling site or host species and, when justified, random slopes for temporal or environmental covariates (Burnham and Anderson Reference Burnham and Anderson2002; Zuur, Ieno and Elphick Reference Zuur, Ieno and Elphick2010) (see Part 1 in Supplementary Material). A critical diagnostic step at this scale is assessing whether observations are independent. When repeated measurements occur across sites, hosts, or time, failing to account for grouping structure can result in pseudoreplication and inflated statistical significance. In such cases, mixed-effects models provide a straightforward and widely accepted correction. If no such grouping exists, a standard generalised linear model (GLM) is sufficient. This type of analysis requires a priori decisions when building your model, i.e., which variables to include based on your knowledge of the system. Model selection using information criteria (AIC, WAIC, or cross-validation) remains essential for identifying parsimonious models and avoiding over-fitting. As these methods are relatively well known and have steadily been used for the past 30 years or so (see Box 1), we will not discuss them extensively here (for more information, see Zuur et al. Reference Zuur, Ieno, Walker, Saveliev and Smith2009). Alternative frameworks such as generalised additive models (GAMs) or structural-equation models (SEMs) may be equally useful depending on the dataset and research objectives. GAMs are particularly effective when relationships between predictors and response variables are nonlinear or involve smooth gradients across space or time, while SEMs can explicitly represent causal hypotheses through linked equations and are valuable when indirect or mediating effects between ecological variables are of interest.
Example 2: regional-scale systems
Regional-scale systems encompass multiple populations or landscapes within a biogeographic region, where spatial heterogeneity and inter-community interactions become more influential. Transitioning from local to regional systems, thereby crossing landscape boundaries, naturally increases the complexity of the investigated data, but also the number of biases present in the system. For instance, increasing the spatial scale also increases the interactions among different host and parasite species; this adds an additional layer of complexity as local-scale drivers tend to dilute at large spatial scales (Cohen et al. Reference Cohen, Civitello, Brace, Feichtinger, Ortega, Richardson, Sauer, Liu and Rohr2016). Another key challenge at this scale is distinguishing true ecological patterns from artefacts of sampling effort. Uneven sampling across regions can create apparent spatial trends that reflect observation bias rather than biological processes. Incorporating hierarchical structure, spatial random effects, or explicitly modelling sampling effort can help mitigate these issues. Moreover, interactions between different communities or metapopulations will add a significant amount of complexity to any disease system, exponentially increasing the number of biases when trying to disentangle disease patterns and spread. For example, how can you be sure that the abundance of an investigated parasite is not driven by an increase in the biodiversity of alternative hosts present in the wider community, potentially diluting or boosting parasite host range? Even though statistical methods allow for the inclusion of such phylogenetic interactions since the early 1990s (Harvey and Pagel Reference Harvey and Pagel1991), the adoption rate of these methods among disease ecologists remains slow (Filion et al. Reference Filion, Doherty, Poulin and Godfrey2022). Other metrics, such as connectivity between landscape patches and habitat density (Correa Ayram et al. Reference Correa Ayram, Mendoza, Etter and Salicrup2016), must also be considered. As such, an approach incorporating more powerful and adaptable statistics is needed. Luckily for disease ecologists, other types of models other than standard GLMs exist to overcome such issues. In this light, Bayesian methods provide key improvements, allowing researchers to consider community-wide interactions, more complex hierarchical data, host and parasite phylogenies, and more (Banner et al. Reference Banner, Irvine, Rodhouse and O’Hara2020; Filion et al. Reference Filion, Doherty, Poulin and Godfrey2022).
A principal advantage of Bayesian modelling is its capacity to incorporate prior information, allowing estimates to adjust according to existing knowledge of the system. From our point of view, the main differences between frequentist and Bayesian statistics are mostly philosophical, as Bayesian models report credible intervals instead of confidence intervals. As such, a credible interval would give the user a 95% probability that the true value of the predictors lies within this interval, as opposed to a confidence interval, which defines that in n number of repeated experiments, the confidence interval would contain the true predictor value 95% of the time (Kruschke Reference Kruschke2010). However, these methods still require the user to have some a priori knowledge about the system they are investigating, as they need specific priors for each variable to run efficiently. While there are a few functions in the main R packages that offer a comprehensive Bayesian approach to most systems, e.g., ‘get_prior’ in the brms package (Bürkner Reference Bürkner2017, Reference Bürkner2018), the recommendations for priors are to account for the distribution family of the response variable and any random effects, and do not offer any consideration for the predictors. This is where having some knowledge of the system is very useful. For example, if investigating the effect of temperature on cercarial emergence in an intertidal snail or on mosquito emergence in a vector-borne disease system, you would expect that an increase in this variable would result in higher parasite abundance based on an a priori literature search and would therefore adjust the priors for this coefficient accordingly based on the expectation you have in your system. Without any kind of knowledge on the system, the model would default to ‘flat’ priors, thus offering no real advantage of switching to Bayesian from frequentist modelling. Another key improvement in these methods is that they are highly customisable, but also have a wide online community to support the improvement of novel methods4 (see Part 2 in Supplementary Material). Like with frequentist approaches, model selection (BIC, LOO-CV, etc.) helps select the model that best balances fit with complexity. Many of the conveniences often attributed to Bayesian models, such as model flexibility or phylogenetic integration, actually stem from particular software implementations rather than from Bayesian inference itself. For instance, numerous tutorials that are constantly evolving allow users to include phylogenetic information8 or create SEMs11 using brms, facilitating the switch to these methods and improving the range of tools available to any end-user.
Example 3: global-scale systems
Finally, going from regional systems to even wider spatial scales (continental or near-global studies) tends to exponentially increase the complexity of the data and covariate structuring. For example, helminth diversity in anuran amphibians is primarily driven by the distance between sampling locations at global scales, whereas climatic effects overshadow spatial distance at regional scales (Martins et al. Reference Martins, Poulin and Gonçalves-Souza2021). In vector-borne systems, avian influenza (H5N1) is known to be regionally driven by the presence of suitable habitats for waterfowl species like wetlands, poultry farming, and seasonal migration of waterfowl (Gilbert et al. Reference Gilbert, Xiao, Domenech, Lubroth, Martin and Slingenbergh2006). However, when spatial scale was increased, the same authors found that regional drivers of avian influenza spread lost their significance and were overpowered by socioeconomic factors and the large migration patterns of waterfowl (Gilbert et al. Reference Gilbert, Xiao, Pfeiffer, Epprecht, Boles, Czarnecki, Chaitaweesub, Kalpravidh, Minh, Otte, Martin and Slingenbergh2008). Thus, a new category of biases, i.e., large-scale biases (socioeconomic factors, climate change, community stability, etc.), can become predominant at global scales, even though they may have little or no influence at local scales (de Angeli Dutra and Poulin Reference de Angeli Dutra and Poulin2024; Mora et al. Reference Mora, McKenzie, Gaw, Dean, von Hammerstein, Knudson, Setter, Smith, Webster, Patz and Franklin2022; Sokolow et al. Reference Sokolow, Nova, Jones, Wood, Lafferty, Garchitorena, Hopkins, Lund, MacDonald, LeBoa, Peel, Mordecai, Howard, Buck, Lopez-Carr, Barry, Bonds and De Leo2022). Global-scale analyses can still yield strong mechanistic insights (e.g., Wilson et al. Reference Wilson, Lapen, Provencher and Wilson2024, global Toxoplasma prevalence), demonstrating that large spatial coverage does not preclude inference about drivers. While disentangling and quantifying the relevant drivers of parasite abundance becomes more of a mission at increasing scales of geography, an advanced category of statistical tools exists to help researchers deal with this level of complex data. Having gone on our own fishing expeditions due to the large quantity of available databases at these scales (see Doherty et al. Reference Doherty, Chai, Cope, de Angeli Dutra, Milotic, Ni, Park and Filion2021), we posit that, in these systems, a careful hypothesis-driven approach should be prioritised. This is where machine learning approaches thrive, especially if one is considering more accurate forecasting of disease emergence patterns.
Most machine learning approaches tend to be robust to the inclusion of many predictor variables and are flexible when it comes to the distribution of the response variable (Elith, Leathwick and Hastie Reference Elith, Leathwick and Hastie2008). They also allow for nonlinear and threshold effects to be detected using marginal plots, a particularly useful tool when investigating large-scale data (Kuhn and Johnson Reference Kuhn and Johnson2013). Because of the stochastic nature of these approaches, model structuring is mostly determined by the data used, and thus few a priori decisions are generally required. As these methods are relatively recent, we include more detailed considerations below. We note that machine learning approaches are not limited to global or regional scales; they can also be effective in local contexts when dense temporal or surveillance datasets are available, e.g., seasonal influenza forecasting. Other frameworks such as hybrid Bayesian–machine-learning methods or SEMs may also serve similar predictive or explanatory roles, depending on data type and objectives. Despite their flexibility and predictive power, machine learning approaches are not universally appropriate. In disease macroecology, datasets are often spatially biased, sparse, or unevenly sampled, which can lead to overfitting and poor transferability of models across regions or time periods. Without careful validation, models may capture artefacts of sampling effort rather than true ecological processes, limiting their usefulness for inference and prediction. Despite their flexibility, machine-learning models are sensitive to data leakage, hyperparameter choices, and spatial autocorrelation. Without explicit reporting of these elements, results may vary substantially across repeated analyses, limiting reproducibility and comparability between studies.
To help curb limitations in machine learning inference, something that is particularly useful when it comes to machine learning is knowing how to create a repeatable model with your dataset. Most literature recommendations tend to suggest using about 2/3 of your database to train your model (hereafter called the training dataset), leaving about 1/3 of the data as a validating dataset (Kuhn and Johnson Reference Kuhn and Johnson2013). When choosing your training dataset, a careful and balanced approach should be considered, as it will further determine the robustness of your results. For instance, take any given disease with 1,000 records of presence/absence locations worldwide, with 950 being locations with no disease detection and 50 being locations with actual records. If the training dataset is imbalanced and includes a disproportionally high number of absence locations, the model’s relevancy will decrease since the validating dataset missed a great deal of information, i.e., predicting bias towards absence data. This will subsequently lead to more problems as this newly trained model will return a very high accuracy (in this example, about 95%), because it will be able to predict most of the data 100% of the time! A good way to avoid such issues lies with careful planning and execution. First, remixing all the rows in your dataset before creating your training and validating datasets is a good way to make sure that there is no ‘data clumping’ (see Kuhn and Johnson Reference Kuhn and Johnson2013 for details on this method). Second, approaches that circumvent this sampling bias when creating the training dataset, such as oversampling rare instances or undersampling the majority group, will help achieve a balanced and accurate model. Third, and this is perhaps the most relevant for new machine learning users, there are built-in functions in R packages, such as the ‘sampling’ function in the caret package (Kuhn Reference Kuhn2008), that can create a balanced sampling design between response variable categories. However, as with any approach, there are a few downsides with machine learning methods. For instance, they tend to behave erratically when presented with a suite of collinear variables, giving weight to only one predictor while systematically rejecting all others, with no repeatable patterns between model runs (Elith, Leathwick and Hastie Reference Elith, Leathwick and Hastie2008).
In addition, machine learning methods tend to be data hungry, requiring a vast amount of data to run efficiently (Domingos Reference Domingos2012). Another key limitation of machine learning approaches is their susceptibility to overfitting, particularly when predictors are numerous relative to sample size or when data are spatially biased, a common feature of global disease datasets. In such cases, models may perform well on training data but fail to generalise to new regions or time periods, limiting their usefulness for forecasting. Often, this happens when the model has too many predictors and tries to analyse the noise of the data instead. A simple workaround is to start with a simpler model with few predictors, and build up from there (Domingos Reference Domingos2012). We provide detailed examples of machine learning using a few of the most popular R packages for ecologists (Part 3 in Supplementary Material), such as caret, gbm (Ridgeway et al. Reference Ridgeway, Edwards, Kriegler, Schroedl, Southworth, Greenwell, Boehmke and Cunningham2024), and randomForest (Liaw and Wiener Reference Liaw and Wiener2002). Ensuring model transferability, i.e., the ability to make reliable predictions beyond the training domain, should therefore be a central consideration when applying these methods, particularly in global disease risk mapping. While simple train/test splits are widely used, alternative approaches such as k-fold cross-validation or spatial blocking may provide more robust estimates of model performance, particularly in spatially structured ecological datasets where observations are not independent.
Other considerations
At this point, the reader will have noticed that we have barely mentioned anything about difference-finding tests (ANOVAs, t-tests, and others). This is because we caution against an overreliance on p-value–centric significance testing in complex ecological datasets, particularly when model assumptions are not met or when analytical decisions are not transparently reported (Leek and Peng Reference Leek and Peng2015; Nakagawa and Cuthill Reference Nakagawa and Cuthill2007; Sterne and Smith Reference Sterne and Smith2001; Wasserstein, Schirm and Lazar Reference Wasserstein, Schirm and Lazar2019). These tests can have inflexible assumptions about the nature of the data they can analyse, which limits their applicability when dealing with hierarchical structures, random effects, phylogenetic signals, or substantial data biases. From our point of view, assessing differences between groups from p-values alone as opposed to calculating relevant effect sizes retains little biological value when comparing patterns across studies, something that could become critical with the increasing rate of emerging infectious diseases worldwide (Baker et al. Reference Baker, Mahmud, Miller, Rajeev, Rasambainarivo, Rice, Takahashi, Tatem, Wagner, Wang, Wesolowski and Metcalf2022). That said, difference-finding tests remain useful in small-scale, controlled experiments or well-balanced study designs where assumptions are met, and the goal is to test specific hypotheses in controlled settings, e.g., lab-based experiments. A concise overview of the strengths, limitations, and typical use cases of each analytical approach is provided in Table 1 to help readers select appropriate methods.
Summary of common statistical approaches used in disease macroecology
Table 1. Long description
The table consists of four columns and four rows of data.
* Row 1: Difference-finding tests (e.g., t-tests, A N O V A s). Strengths include simple implementation and suitability for small experiments. Limitations include inflexible assumptions and poor handling of hierarchical data. Typical use cases are preliminary comparisons and controlled laboratory studies.
* Row 2: Frequentist models (e.g., G L M s, G L M M s). Strengths include transparent inference and broad software support. Limitations include limited flexibility for complex dependencies. Typical use cases are local- to regional-scale ecological datasets.
* Row 3: Bayesian models (e.g., hierarchical, phylogenetic). Strengths include incorporating prior knowledge and handling hierarchical data. Limitations include being computationally intensive and requiring prior specification. Typical use cases are regional- to continental-scale analyses.
* Row 4: Machine-learning models (e.g., random forests, boosted trees, neural networks). Strengths include handling large nonlinear datasets and strong predictive accuracy. Limitations include limited interpretability and risk of overfitting. Typical use cases are predictive mapping and global-scale risk assessment.
We strongly recommend that researchers present the underlying code that generated their results in such a way that is fully transparent, easily understood with detailed instructions included in the script, and easily reproduced with the data provided. Like the R scripts that were provided in this paper, readers should be able to download the scripts and the data from a paper and, within minutes to hours (pending proper package installation and the type of analysis), obtain the same major results as in the paper (within the same margin of error if working with Bayesian or machine learning methods). We also encourage authors to include examples of residual and predictive checks in their code, e.g., plotting residuals vs. fitted values, visualising posterior predictions, or comparing observed vs. predicted data, to verify model fit and performance.
Within the past few years, we have also seen an exponential growth of specialised machine learning models known as large language models (LLMs) such as OpenAI’s GPT-512 and Meta’s Llama13. These LLMs can be useful to help write scripts for statistical analyses in R or Python, as they are capable of synthesising innumerable quantities of scripts and queries from the internet (although, see Chen et al. Reference Chen, Tworek, Jun, Yuan, Henrique Ponde de Oliveira, Kaplan, Edwards, Burda, Nicholas, Brockman, Ray, Puri, Krueger, Petrov, Khlaaf, Sastry, Mishkin, Chan, Gray, Ryder, Pavlov, Power, Kaiser, Bavarian, Winter, Tillet, Such, Cummings, Plappert, Chantzis, Barnes, Herbert-Voss, Guss, Nichol, Paino, Tezak, Tang, Babuschkin, Balaji, Jain, Saunders, Hesse, Carr, Leike, Achiam, Misra, Morikawa, Radford, Knight, Brundage, Murati, Mayer, Welinder, McGrew, Amodei, McCandlish, Sutskever and Zaremba2021). These LLMs are becoming useful and powerful tools to help build or improve R and Python scripts using simple prompts for the purpose of statistical tests in practically any area of research. Here, we urge caution upon those who are just beginning to learn how to write their own scripts. Regardless of your needs, we strongly encourage that you have a solid foundation in R or Python coding before copy-pasting and running codes generated solely by LLMs. In our experience, this will undoubtedly save a lot of headaches and time as these prompt-generated codes are often imperfect and can hide subtle mistakes if you are not familiar with script writing. Moreover, because hallucination rates remain disproportionately high in most current LLMs, blindly trusting an LLM-generated script without domain knowledge can easily lead to biased results. In short, just because it is convenient does not mean it is reliable. Learning basic coding from a good guide in data science (e.g., Wickham et al. Reference Wickham, Çetinkaya-Rundel and Grolemund2023) will set you on the right path. The recommendations presented here are most relevant to ecological and disease-ecological studies, where hierarchical sampling and natural variability are common, rather than to tightly controlled experimental systems.
Future perspectives
Disease macroecology is an ever-expanding field, and with increasing amounts of ecological, environmental, and molecular data becoming available, these illustrative analytical frameworks will continue to evolve. The purpose of this perspective was to provide simple examples of how data characteristics, scale, and research objectives can guide appropriate statistical approaches without implying that a single ‘best model’ exists for any given context. Rather than advocating for any single class of models, our goal is to align analytical choices with data structure, inference goals, and the limitations inherent to ecological datasets. Future methodological developments should focus on flexibility, combining interpretability from classical models with the predictive capacity of machine learning, and on transparent model validation so that results remain reproducible across platforms and data sources.
We urge disease ecologists to move away from difference-finding tests and stop relying solely on p-values. Too often, when preparing comparative or meta-analyses, we find ourselves having to reject potentially useful studies or datapoints from our dataset because of poorly reported results. We suggest that disease ecologists report the predictive power of each model predictor, i.e., effect sizes and confidence or credible intervals (for machine learning, the relative variable influence). In addition, authors should include sufficient information on model structure, diagnostics, and data-processing steps so that analyses can be independently verified and reproduced. With the current rate of emerging infectious diseases worldwide, we urge disease ecologists to adopt a standardised statistical protocol when publishing their data and their scripts, and to keep innovating in the methods and tools they use in an open and transparent way. Continued integration of flexible analytical frameworks, combining interpretability from classical models with the predictive capacity of modern computational methods, will further strengthen the field. We strongly believe that only then will researchers begin to fully grasp the drivers and patterns of parasite occurrence to build more accurate guidelines and better forecast future emergence of disease.
Rather than reiterating general statistical principles, our goal is to contextualise them within the specific challenges of disease macroecology, where scale, bias, and data heterogeneity interact in ways that complicate standard analytical workflows. By explicitly linking these data characteristics to their statistical consequences, we provide a practical framework to support more transparent, reproducible, and context-dependent analytical decisions.
Supplementary material
The supplementary material for this article can be found at http://doi.org/10.1017/S0022149X26101874.
Availability of data and material
Not applicable.
Code availability
Code is available in the online supplementary material.
Acknowledgements
We thank Patrick Stephens for his insight and for providing feedback on an early draft of the manuscript.
Author contribution
J-FD conceived the idea, and both authors designed the paper; both authors collected and analysed the data and wrote the manuscript. Both authors contributed critically to the drafts and gave final approval for publication.
Financial support
J-FD was supported by a Natural Sciences and Engineering Research Council of Canada Postdoctoral Fellowship (PDF-578318-2023).
Competing interests
Not applicable.
Ethics approval
Not applicable.
Consent to participate
Not applicable.
Consent for publication
Not applicable.
Resources
1. https://www.guru99.com/r-random-forest-tutorial.html
2. https://uc-r.github.io/gbm_regression
3. https://cran.r-project.org/web/packages/caret/vignettes/caret.html
4. https://discourse.mc-stan.org/c/interfaces/brms/36
5. https://www.rensvandeschoot.com/tutorials/lme4/
6. https://benwhalley.github.io/just-enough-r/correlations.html
7. https://mgimond.github.io/Spatial/spatial-autocorrelation-in-r.html
8. https://cran.r-project.org/web/packages/brms/vignettes/brms_phylogenetics.html
9. https://www.highstat.com/index.php/books2?view=article&id=17&catid=18
10. https://stats.oarc.ucla.edu/r/seminars/rsem/
11. https://rpubs.com/jebyrnes/brms_bayes_sem
12. https://openai.com/index/introducing-gpt-5/
13. https://llama.meta.com/