infectionIndex

Tools for analysis of disease infection intensity and temporal progress in plant pathology.

Overview

infectionIndex provides tools for analyzing disease infection intensity and temporal progress in plant pathology experiments.

The package supports disease intensity indices, longitudinal analysis, generalized estimating equations (GEE), disease progress metrics, outlier detection and sensitivity analysis, estimated marginal means, temporal trends, and graphical visualization.

The main analysis workflow is provided by run_di_pipeline(), which integrates data preparation, disease intensity calculation, longitudinal modeling, disease progress analysis, outlier assessment, and graphical outputs in a single workflow.

Main features

Installation

The development version of infectionIndex can be installed from the source package after downloading the package archive.

For local installation in R:

install.packages(
  "infectionIndex_0.0.0.9000.tar.gz",
  repos = NULL,
  type = "source"
)

The package requires R (>= 4.1) and imports readxl, dplyr, tidyr, tidyselect, ggplot2, geepack, emmeans, and readr.

Quick start

A complete example of the analysis workflow is provided with the package in the package’s inst/extdata directory as example_long_data.xlsx.

The main workflow can be run with:

library(infectionIndex)

example_file <- system.file(
  "extdata",
  "example_long_data.xlsx",
  package = "infectionIndex"
)

result <- run_di_pipeline(
  excel_file = example_file,
  index = "czermainski",
  corstr = "ar1",
  progress_metric = "audpc",
  save_outputs = FALSE,
  outlier_action = "flag"
)

The resulting object contains the analysis based on the complete dataset, the sensitivity analysis when applicable, and information about detected and removed experimental units.

For example:

result$out$interaction_test
result$out$auc$summary
result$out$predictions
result$outliers$detected

The complete application and interpretation of the workflow are described in the package vignette.

Input data

The main workflow accepts experimental data stored in XLSX files.

The package can identify data organized in long format and can also convert suitable wide-format data to long format.

For longitudinal disease assessments, the data should contain the experimental unit, treatment or treatment factors, assessment time, disease class, and frequency of observations in each disease class.

A typical long-format structure is:

block trat time class freq
1 Água 1 F0 18
1 Água 1 F1 2
1 Água 2 F0 15
… … … … …

The factors argument can be used to identify one or more treatment factors. For a single treatment factor, the default is factors = "trat". For factorial experiments, multiple columns can be specified, for example:

factors = c("cultivar", "produto")

The complete data requirements and conversion rules are described in the package documentation and vignette.

Disease intensity indices

infectionIndex provides two disease intensity indices.

Czermainski index

The Czermainski infection intensity index is the main index used by the integrated workflow. It is calculated from the frequencies observed in ordered disease classes, from the absence of disease to the highest disease intensity class.

It can also be calculated directly:

freq <- c(19, 9, 4, 5, 6, 7)

amaral_czermainski_I(freq)

The function can optionally return the angular quantity (omega) together with the infection intensity index:

amaral_czermainski_I(
  freq,
  return_omega = TRUE
)

McKinney index

The package also provides the McKinney disease index as an alternative or comparative measure:

mckinney_I(freq)

User-defined disease scores can also be supplied:

mckinney_I(
  c(10, 5, 3, 2, 1),
  scores = c(0, 0.75, 1, 2, 3)
)

Within run_di_pipeline(), the Czermainski index is the default:

index = "czermainski"

The McKinney index can be selected when an alternative disease intensity measure is desired:

index = "mckinney"

Complete analysis pipeline

The main function of the package is run_di_pipeline().

It integrates the main steps of disease intensity and temporal progress analysis into a single workflow:

  1. Import and preparation of experimental data.
  2. Conversion to long format when required.
  3. Calculation of disease intensity.
  4. Longitudinal GEE analysis.
  5. Comparison of temporal interactions.
  6. Generation of model-based predictions.
  7. Calculation of disease progress metrics.
  8. Detection of potential outliers.
  9. Optional sensitivity analysis after outlier removal.
  10. Generation of graphical outputs.
  11. Estimated marginal means and temporal trend analysis when applicable.

A typical analysis can be run with:

example_file <- system.file(
  "extdata",
  "example_long_data.xlsx",
  package = "infectionIndex"
)

result <- run_di_pipeline(
  excel_file = example_file,
  index = "czermainski",
  corstr = "ar1",
  progress_metric = "audpc",
  save_outputs = FALSE,
  outlier_action = "flag"
)

The function returns a structured object containing the complete-data analysis, the sensitivity analysis when applicable, and information on detected and removed experimental units.

Factorial experiments

The pipeline can be used with more than one treatment factor.

For example:

result <- run_di_pipeline(
  excel_file = "data/factorial_experiment.xlsx",
  factors = c("cultivar", "produto"),
  index = "czermainski",
  corstr = "ar1",
  progress_metric = "audpc"
)

The factors argument identifies the columns representing the treatment structure.

For a unifactorial experiment:

factors = "trat"

For a factorial experiment:

factors = c("cultivar", "produto")

The longitudinal model incorporates the specified treatment structure, including its temporal interactions.

Detailed examples of unifactorial and factorial analyses are provided in the package vignette.

GEE analysis

Longitudinal disease intensity can be analyzed using generalized estimating equations (GEE).

The package supports the following working correlation structures:

The integrated pipeline uses:

corstr = "ar1"

in the example above.

GEE models can also be fitted directly using gee_di() when the data are already available in long format:

gee_result <- gee_di(
  data_longo = data_long,
  corstr = "ar1",
  do_anova = TRUE,
  factors = "trat"
)

For factorial experiments:

gee_result <- gee_di(
  data_longo = data_long,
  corstr = "ar1",
  do_anova = TRUE,
  factors = c("cultivar", "produto")
)

The function returns the fitted models, the comparison of temporal interactions when requested, and a prediction grid.

AUDPC and AUDPS

The package can summarize temporal disease progress using the area under the disease progress curve (AUDPC) or the area under the disease progress stairs (AUDPS).

The metric is selected with the progress_metric argument:

progress_metric = "audpc"

or:

progress_metric = "audps"

AUDPC is calculated from disease intensity measurements over time, whereas AUDPS provides a complementary summary based on the disease progress trajectory.

The resulting progress metrics are calculated for the experimental units and summarized according to the treatment structure.

The complete workflow also provides graphical and statistical outputs associated with disease progress.

Outlier detection and sensitivity analysis

The pipeline can identify experimental units with potentially unusual disease progress values.

Outlier handling is controlled by outlier_action.

By default:

outlier_action = "flag"

Potential outliers are identified and reported without removing them from the primary analysis.

A sensitivity analysis can be requested with:

outlier_action = "remove_all"

In this mode, the analysis is refitted after removing the identified experimental units.

The results based on the complete dataset and, when applicable, the sensitivity analysis are stored separately in the returned object:

result$out
result$out_clean
result$outliers

This allows the effect of outlier removal to be evaluated without replacing the primary analysis.

When applicable, the pipeline calculates estimated marginal means and temporal trends using emmeans.

The results are available in:

result$out_clean$emmeans

The returned results can include:

For example:

result$out_clean$emmeans$emm_time_df
result$out_clean$emmeans$trends_df

These results can be used to describe differences among treatment groups over time and changes in disease intensity through the assessment period.

Visualization

The package provides graphical outputs for disease progress and model-based results.

The integrated pipeline can generate:

The package also provides the public function plot_curves_by_trat() for a simple treatment-by-time plot:

plot_curves_by_trat(data)

where data contains the columns:

trat
time
y

The plotting functions return ggplot2 objects, allowing further customization using the ggplot2 framework.

Example of application to experimental data

The package includes an experimental dataset in example_long_data.xlsx in inst/extdata.

The dataset is provided to demonstrate a complete analysis workflow, including disease intensity calculation, longitudinal GEE analysis, disease progress, outlier assessment, estimated marginal means, temporal trends, and graphical outputs.

The complete workflow can be executed with:

library(infectionIndex)

example_file <- system.file(
  "extdata",
  "example_long_data.xlsx",
  package = "infectionIndex"
)

result <- run_di_pipeline(
  excel_file = example_file,
  index = "czermainski",
  corstr = "ar1",
  progress_metric = "audpc",
  save_outputs = FALSE,
  outlier_action = "flag"
)

The resulting object contains the principal outputs of the analysis.

For example:

result$out$interaction_test
result$out$auc$summary
result$out$predictions
result$outliers$detected

The example dataset is intended to demonstrate package functionality and reproducibility. It is not intended to define a universal experimental design or statistical analysis for all plant disease experiments.

A detailed interpretation of the example and the statistical workflow is provided in the package vignette.

Main functions

Function Purpose
run_di_pipeline() Main workflow for disease intensity and temporal progress analysis.
amaral_czermainski_I() Calculates the Czermainski disease infection intensity index.
mckinney_I() Calculates the McKinney disease index as an alternative or comparative measure.
gee_di() Fits GEE models for longitudinal disease intensity data.
plot_curves_by_trat() Generates treatment-by-time disease progress curves.

Additional internal functions support data preparation, disease progress calculations, outlier assessment, predictions, and graphical outputs.

Citation

If you use infectionIndex in a scientific publication, please cite the software as:

Bragança, C. A. D.; Nogueira, M. A. infectionIndex: Disease Infection Intensity and Progress Analysis Tools.

The recommended citation will be updated with the package version, repository, and DOI when these identifiers become available.

References

Czermainski, A. B. C. (1999). Generalização de um índice de intensidade de infecção em experimentos de avaliação de doenças em plantas. Pesquisa Agropecuária Brasileira, 34(9), 1545–1555. https://doi.org/10.1590/S0100-204X1999000900004

McKinney, H. H. (1923). Influence of soil temperature and moisture on infection of wheat seedlings by Helminthosporium sativum. Journal of Agricultural Research, 26, 195–217.

mirror server hosted at Truenetwork, Russian Federation.