CooccurrenceAffinity: An R package for computing a novel metric of affinity in co-occurrence data that corrects for pervasive errors in traditional indices

1. Analysis of co-occurrence data with traditional indices has led to many problems such as sensitivity of the indices to prevalence and the same value representing either a strong positive or strong negative association across different datasets. In our recent study (Mainali et al 2022), we revealed the source of the problems that make the traditional indices fundamentally flawed and unreliable-namely that the indices in common use have no target of estimation quantifying degree of association in the non-null case-and we further developed a novel parameter of association, alpha, with complete formulation of the null distribution for estimating the mechanism of affinity. We also developed the maximum likelihood estimate (MLE) of alpha in our previous study. 2. Here, we introduce the CooccurrenceAffinity R package that computes the MLE for alpha. We provide functions to perform the analysis based on a 2×2 contingency table of occurrence/co-occurrence counts as well as a m×n presence-absence matrix (e.g., species by site matrix). The flexibility of the function allows a user to compute the alpha MLE for entity pairs on matrix columns based on presence-absence states recorded in the matrix rows, or for entity pairs on matrix rows based on presence-absence recorded in columns. We also provide functions for plotting the computed indices. 3. As novel components of this software paper not reported in the original study, we present theoretical discussion of a median interval and of four types of confidence intervals. We further develop functions (a) to compute those intervals, (b) to evaluate their true coverage probability of enclosing the population parameter, and (c) to generate figures. 4. CooccurrenceAffinity is a practical and efficient R package with user-friendly functions for end-to-end analysis and plotting of co-occurrence data in various formats, making it possible to compute the recently developed metric of alpha MLE as well as its median and confidence intervals introduced in this paper. The package supplements its main output of the novel metric of association with the three most common traditional indices of association in co-occurrence data: Jaccard, Sørensen-Dice, and Simpson.

Authors

Institutions

Publication Details

Journal
PLoS ONE
Published
2025-01-16
DOI
https://doi.org/10.1371/journal.pone.0316650
Citations
6
Primary Topic
Statistical Methods and Inference
Type
article
Field-Weighted Citation Impact
15.78

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

CooccurrenceAffinity: An R package for computing a novel metric of affinity in co-occurrence data that corrects for pervasive errors in traditional indices

Kumar P. Mainali, Eric Slud
6 citations
PLoS ONE
Statistical Methods and Inference
15.78
article

CooccurrenceAffinity: An R package for computing a novel metric of affinity in co-occurrence data that corrects for pervasive errors in traditional indices

Kumar P. Mainali, Eric Slud
article en
6 citations

Abstract

1. Analysis of co-occurrence data with traditional indices has led to many problems such as sensitivity of the indices to prevalence and the same value representing either a strong positive or strong negative association across different datasets. In our recent study (Mainali et al 2022), we revealed the source of the problems that make the traditional indices fundamentally flawed and unreliable-namely that the indices in common use have no target of estimation quantifying degree of association in the non-null case-and we further developed a novel parameter of association, alpha, with complete formulation of the null distribution for estimating the mechanism of affinity. We also developed the maximum likelihood estimate (MLE) of alpha in our previous study. 2. Here, we introduce the CooccurrenceAffinity R package that computes the MLE for alpha. We provide functions to perform the analysis based on a 2×2 contingency table of occurrence/co-occurrence counts as well as a m×n presence-absence matrix (e.g., species by site matrix). The flexibility of the function allows a user to compute the alpha MLE for entity pairs on matrix columns based on presence-absence states recorded in the matrix rows, or for entity pairs on matrix rows based on presence-absence recorded in columns. We also provide functions for plotting the computed indices. 3. As novel components of this software paper not reported in the original study, we present theoretical discussion of a median interval and of four types of confidence intervals. We further develop functions (a) to compute those intervals, (b) to evaluate their true coverage probability of enclosing the population parameter, and (c) to generate figures. 4. CooccurrenceAffinity is a practical and efficient R package with user-friendly functions for end-to-end analysis and plotting of co-occurrence data in various formats, making it possible to compute the recently developed metric of alpha MLE as well as its median and confidence intervals introduced in this paper. The package supplements its main output of the novel metric of association with the three most common traditional indices of association in co-occurrence data: Jaccard, Sørensen-Dice, and Simpson.

PLoS ONEVol. 20(1)
United States Census Bureau (US), Statistical Research (United States) (US), University of Maryland, College Park (US)
National Science Foundation, National Socio-Environmental Synthesis Center
Openalex Percentile: Top 1%
Statistical Methods and Inference
15.78
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.