View source: R/para_aggregation_CI.R
| para_aggregation_CI | R Documentation |
This function calculates point estimates and bootstrap confidence intervals (CIs) for six commonly used measures of parasite aggregation among hosts. Following the recommendations of Morrill et al. (2023) and Reiczigel et al. (2019), CIs are estimated via non-parametric bootstrap using the bias-corrected and accelerated (BCa) method, except for the parameter k of the negative binomial distribution, for which maximum likelihood estimation with likelihood profile confidence intervals is used. Parasite aggregation refers to the nearly universal phenomenon where most hosts harbor few or no parasites, while a minority of hosts harbor heavy infections. This pattern has important consequences for host health, parasite transmission, and population dynamics. The six aggregation measures included in this function capture different aspects of this phenomenon and can be grouped into three distinct categories based on their properties and interpretations.
para_aggregation_CI(dataset, sp_cols, group_vars = NULL, perm = 2000,
decimal_places = 2, ci_method= "bca", combine_ci = FALSE,
conf_level = 0.95, save_csv = FALSE, verbose = FALSE)
dataset |
Data frame with parasitological data. |
sp_cols |
Vector with the names of the columns containing abundance of parasites (taxa) to calculate the parasitological descriptors. |
group_vars |
Vector with the names of categorical variables used to define groups (e.g., "Sex", "Site"). Default is |
perm |
Number of permutations to perform for CIs estimation. Default is |
decimal_places |
Number of decimal places to include in the calculation. Default is |
ci_method |
Method for bootstrap CIs. Options are |
combine_ci |
Logical. If |
conf_level |
Confidence level for the interval estimation (e.g., |
save_csv |
Logical. If |
verbose |
Logical. If |
Parasite aggregation is quantified through six indices that capture different attributes of how parasites are distributed among hosts. Following Morrill et al. (2023), these measures can be grouped into three categories based on their mathematical properties and biological interpretations:
Abundance-driven measures (sensitive to mean abundance):
VMR (Variance-to-Mean Ratio): Calculated as the variance divided by the mean abundance. Values > 1 indicate aggregation, values = 1 indicate a random (Poisson) distribution, and values < 1 indicate a more even distribution. This measure is strongly correlated with mean abundance, making it unsuitable for comparing aggregation across samples with different mean abundances.
Mean crowding: Represents the average number of conspecific parasites sharing a host from the perspective of an individual parasite. Higher values indicate greater crowding experienced by parasites within hosts. This measure is strongly positively correlated with mean abundance, making it unsuitable for comparing aggregation across samples with different mean abundances.
Distribution-driven measures (independent of mean abundance):
k of the negative binomial distribution: An inverse measure of aggregation where smaller values indicate higher aggregation. When k tends towards infinity, the distribution approaches a Poisson (random) pattern. This measure has a clear biological interpretation in terms of mean crowding: 1/k represents the proportion of the mean abundance by which mean crowding exceeds the mean abundance. Importantly, k is not necessarily correlated with mean abundance, contrary to some expectations in the literature.
Patchiness: Calculated as mean crowding divided by the mean abundance. This measure describes how many times more "crowded" an average parasite is compared to a hypothetical random distribution. Like k, patchiness is not correlated with mean abundance and does not require that the parasite distribution fits a negative binomial.
Inequality-driven measures (based on Lorenz curves):
Poulin's D: Ranges from 0 (perfectly even distribution) to 1 (maximum possible aggregation, all parasites in one host). This measure is based on the Lorenz curve and is particularly suitable for comparing aggregation across samples or different host-parasite associations. It shows a strong negative correlation with prevalence.
Hoover's index: Also ranges from 0 to 1 and represents the proportion of parasites that would need to be redistributed to achieve a perfectly even distribution among hosts. For example, a value of 0.7 indicates that 70% of the parasites would need to be moved to achieve evenness. This measure has a clear biological interpretation but can be constrained at low prevalence values (often equaling 1 - prevalence when all infected hosts have infrapopulations at least as large as the mean abundance).
Confidence intervals are estimated using a non-parametric bootstrap approach. Specifically, BCa bootstrap intervals are computed by resampling the observed abundance values with replacement a specified number of times (perm). This method adjusts for both bias and skewness in the bootstrap distribution and is recommended for aggregation measures by Morrill et al. (2023) and Reiczigel et al. (2019). For the parameter k of the negative binomial distribution, confidence intervals are estimated using maximum likelihood estimation with likelihood profile confidence intervals, following the specific recommendation of Morrill et al. (2023). For all other indices (VMR, mean crowding, patchiness, Poulin's D, and Hoover's index), BCa bootstrap intervals are used. Statistical considerations: Parasite abundance data are typically overdispersed and zero-inflated, making parametric assumptions inappropriate in many cases. The use of bootstrap methods allows robust estimation of confidence intervals without assuming normality. When sample size is small (fewer than 3 hosts), CIs may not be estimable and results should be interpreted with caution. The interpretation of results remains the responsibility of the user.
A data frame containing aggregation estimates and CIs for each parasite taxon, either globally or by group. The following variables are returned:
nH: Number of hosts analyzed
nH_inf: Number of infected hosts
VMR: Variance-to-Mean Ratio
mean_crowding: Mean crowding index
patchiness: Patchiness index
poulin_D: Poulin's D index
hoover: Hoover's index
k: Parameter of the negative binomial distribution
Lower_<ci_method>: Lower bound of the CI estimated using the method specified in ci_method ("bca" or "perc").
Upper_<ci_method>: Upper bound of the CI estimated using the method specified in ci_method ("bca" or "perc").
CI_<ci_method>: If combine_ci = TRUE, confidence interval stored as a single column (Lower_<ci_method> - Upper_<ci_method>).
Observation: Categorical description of the data context:
"Not analyzed": No valid observations are available for the given combination (all values are missing or the combination is absent in the dataset); therefore, no estimates can be computed.
"One host analyzed": Only a single host analyzed is available for the given combination; thus, no population-level inference is possible and statistical summary measures are not estimated.
"No hosts infested": Hosts are present for the given combination, but none are infested (abundance = 0 for all observations); consequently, no statistical summary measures of abundance or intensity can be estimated.
"One host infested": Only a single infested host is recorded for the given combination; therefore, no sample-based estimation of intensity or related summary measures is possible.
"Multiple hosts infested": More than one infested host is recorded for the given combination, allowing the estimation of summary measures.
Juan Manuel Cabrera, Exequiel Furlan and Elisa Helman
Bush, A.O., Lafferty, K.D., Lotz, J.M., Shostak, A.W. (1997). Parasitology meets ecology on its own terms: Margolis revisited. Journal of Parasitology, 83(4), 575–583.
Reiczigel, J., Marozzi, M., Fabian, I., Rózsa, L. (2019). Biostatistics for parasitologists – a primer to quantitative parasitology. Trends in Parasitology, 35(4), 277–281.
Morrill, A., Poulin, R., Forbes, M., 2023. Interrelationships and properties of parasite aggregation measures: a user’s guide. Int. Journal of Parasitology 53, 763–776.
# Calculate aggregation indices with BCa confidence intervals
agg_CI <- para_aggregation_CI(para_data$dataset,
sp_cols = c("Sp1","Sp2"),
group_vars = c("Site","Sp_host"),
perm = 2000,
decimal_places = 2,
ci_method = "bca",
combine_ci = FALSE,
conf_level = 0.95,
save_csv = FALSE,
verbose = TRUE)
agg_CI
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.