A Theoretical-Practical Approach to Parasitological Data Analysis
parasiteR is an R package designed to standardize and streamline the analysis of parasitological data. It provides tools for importing, exploring, summarizing, and visualizing parasite abundance data, as well as estimating key parasitological descriptors and their confidence intervals.
The package is particularly useful for researchers working with parasite–host datasets and quantitative parasitology, providing a workflow from raw CSV data to statistical summaries and graphical representations.
parasiteR provides functions for:
.csv files.You can install the development version of parasiteR from GitHub using remotes:
# Install remotes if necessary
install.packages("remotes")
# Install parasiteR
# remotes::install_github("Dvelop-R/parasiteR")
install.packages("parasiteR", repos = c('https://dvelop-r.r-universe.dev', 'https://cloud.r-project.org'))
library(parasiteR)
The package is designed to work with datasets in which each row represents an individual host.
Columns can include:
These variables describe the host or sampling context, for example:
Parasite abundance data should be represented by one or more columns, with each column corresponding to a parasite taxon.
For example:
| Site | Sex | Sp1 | Sp2 | Sp3 |
|---|---|---|---|---|
| A | F | 0 | 4 | 2 |
| A | M | 3 | 0 | 1 |
| B | F | 8 | 2 | 0 |
| B | M | NA | 5 | 3 |
Parasite abundance values should be non-negative integers.
It is important to distinguish between:
0: The parasite was not detected in the host.NA: Parasite detection or quantification was not possible or the observation is missing.This distinction is important for correctly estimating prevalence, abundance, and other parasitological descriptors.
The package includes an example dataset called para_data.
You can inspect it with:
data("para_data")
str(para_data)
The dataset can be used to test the main functions and reproduce examples from the package documentation.
A typical parasiteR workflow can be summarized as:
Raw parasitological data
|
v
para_read_data()
|
v
Data exploration
|
+--------------------+
| |
v v
Abundance / Prevalence Descriptive indices
| |
v v
Confidence intervals Aggregation measures
| |
+---------+----------+
|
v
para_plot_CI()
|
v
Tables and visualizations
The para_read_data() function imports CSV files and provides information about the resulting dataset.
data <- para_read_data(
file_name = "my_parasite_data.csv",
verbose = TRUE
)
data$dataset
data$factors_v
data$num_v
data$summ
The function returns a list containing:
dataset: The imported data frame.factors_v: Names of categorical/factor variables.num_v: Names of numerical variables.summ: A summary of the dataset.Both comma-separated and semicolon-separated CSV files are supported.
The package includes exploratory functions for examining parasite abundance and prevalence patterns.
para_explo_abund(
dataset = para_data$dataset,
sp_cols = c("Sp1", "Sp2")
)
para_explo_prev(
dataset = para_data$dataset,
sp_cols = c("Sp1", "Sp2")
)
These functions can be used as an initial step to explore the structure of parasitological data before calculating summary statistics and confidence intervals.
The para_descriptors() function calculates descriptive parasitological measures from parasite abundance data.
descriptors <- para_descriptors(
dataset = para_data$dataset,
sp_cols = c("Sp1", "Sp2"),
group_vars = c("Site")
)
descriptors
Depending on the analysis, the package supports descriptors related to parasite abundance, prevalence, intensity, and aggregation.
The para_abundance_CI() function estimates parasite abundance and associated confidence intervals.
abundance_CI <- para_abundance_CI(
dataset = para_data$dataset,
sp_cols = c("Sp1", "Sp2"),
group_vars = c("Site"),
c_median = FALSE,
perm = 2000,
ci_method = "bca",
conf_level = 0.95,
combine_ci = FALSE,
verbose = TRUE
)
abundance_CI
The function can be used to estimate mean or median abundance, depending on the selected options.
Confidence intervals can be estimated using bootstrap procedures, including:
para_prevalence_CI() estimates parasite prevalence and its confidence interval.
prevalence_CI <- para_prevalence_CI(
dataset = para_data$dataset,
sp_cols = c("Sp1"),
group_vars = c("Site"),
decimal_places = 2,
conf_level = 0.95,
ci_method = "wilson",
output_type = "proportion",
combine_ci = TRUE,
verbose = TRUE
)
prevalence_CI
Available confidence interval methods include:
"wilson" — Wilson score interval."exact" — Clopper–Pearson exact binomial interval."blaker" — Blaker exact interval.Prevalence can be returned as either a proportion or percentage:
output_type = "proportion"
or
output_type = "percentage"
The para_intensity_CI() function estimates parasite intensity among infected hosts.
Both mean and median intensity can be calculated.
median_intensity <- para_intensity_CI(
dataset = para_data$dataset,
c_median = TRUE,
sp_cols = c("Sp1"),
group_vars = c("Site"),
perm = 2000,
ci_method = "bca",
conf_level = 0.95,
combine_ci = TRUE,
verbose = TRUE
)
mean_intensity <- para_intensity_CI(
dataset = para_data$dataset,
c_median = FALSE,
sp_cols = c("Sp1"),
group_vars = c("Site"),
perm = 2000,
ci_method = "bca",
conf_level = 0.95,
combine_ci = TRUE,
verbose = TRUE
)
Bootstrap methods are used to estimate confidence intervals without requiring a specific parametric distribution.
This approach is particularly useful for parasitological data, which are often highly skewed, overdispersed, and aggregated among hosts.
para_aggregation_CI() calculates several measures used to describe parasite aggregation.
aggregation_CI <- para_aggregation_CI(
dataset = para_data$dataset,
sp_cols = c("Sp1", "Sp2"),
group_vars = c("Site"),
perm = 2000,
decimal_places = 2,
ci_method = "bca",
combine_ci = FALSE,
conf_level = 0.95,
verbose = TRUE
)
aggregation_CI
The function provides estimates for several aggregation measures, including:
D
k
Confidence intervals for most aggregation measures are estimated using bootstrap methods. The negative binomial k parameter uses likelihood-profile confidence intervals.
Available bootstrap confidence interval methods include:
"bca" — Bias-corrected and accelerated bootstrap."perc" — Percentile bootstrap.The para_plot_CI() function creates graphical representations of parasitological estimates and their confidence intervals.
It is designed to work directly with the outputs of:
para_abundance_CI()para_intensity_CI()para_prevalence_CI()para_aggregation_CI()For example:
para_plot_CI(
para_df = prevalence_CI,
group_vars = "Site",
sp_cols = "Sp1"
)
Multiple grouping variables can also be used:
para_plot_CI(
para_df = prevalence_CI,
group_vars = c("Site", "Sex"),
sp_cols = c("Sp1", "Sp2")
)
The function automatically detects the appropriate estimate and confidence interval structure from the original output.
Plots can be displayed as:
Figures can also be exported in:
For example:
para_plot_CI(
para_df = prevalence_CI,
group_vars = "Site",
save_fig = "pdf"
)
A basic analysis workflow can be performed as follows:
library(parasiteR)
# Load example data
data("para_data")
# Select parasite taxa
species <- c("Sp1", "Sp2")
# Calculate prevalence
prev <- para_prevalence_CI(
dataset = para_data$dataset,
sp_cols = species,
group_vars = "Site",
ci_method = "wilson",
conf_level = 0.95,
combine_ci = TRUE
)
# Inspect results
print(prev)
# Visualize prevalence and confidence intervals
para_plot_CI(
para_df = prev,
group_vars = "Site",
sp_cols = species
)
The package implements methods commonly used in quantitative parasitology.
The main methodological approaches include:
k parameter.Because parasitological data frequently exhibit zero inflation, overdispersion, skewness, and aggregation, non-parametric approaches are used where appropriate.
Users should consider sample size and the biological context of their data when interpreting estimates and confidence intervals. Very small sample sizes may result in unstable or uninformative estimates.
| Function | Purpose |
|---|---|
para_read_data() |
Import and summarize parasitological CSV data |
para_explo_abund() |
Explore parasite abundance |
para_explo_prev() |
Explore parasite prevalence |
para_descriptors() |
Calculate parasitological descriptors |
para_abundance_CI() |
Estimate parasite abundance and confidence intervals |
para_prevalence_CI() |
Estimate prevalence and confidence intervals |
para_intensity_CI() |
Estimate mean or median parasite intensity and confidence intervals |
para_aggregation_CI() |
Estimate parasite aggregation indices and confidence intervals |
para_plot_CI() |
Visualize estimates and confidence intervals |
parasiteR relies on several R packages, including:
dplyrtidyrggplot2rlangmagrittrreadrstatsbootbinomBlakerCIbbmleMASSJuan Manuel Cabrera Creator, maintainer, and author
Exequiel Oscar Furlan Author
Elisa Helman Author
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. https://doi.org/10.2307/3284227
Reiczigel, J., Marozzi, M., Fábián, I., & Rózsa, L. (2019). Biostatistics for parasitologists – a primer to quantitative parasitology. Trends in Parasitology, 35(4), 277–281. https://doi.org/10.1016/j.pt.2019.01.003
Morrill, A., Poulin, R., & Forbes, M. (2023). Interrelationships and properties of parasite aggregation measures: A user's guide. International Journal for Parasitology, 53, 763–776.
parasiteR is released under the GNU General Public License version 3 (GPL-3).
If you use parasiteR in your research, please cite the package and the relevant methodological references used for your analysis.