Movatterモバイル変換


[0]ホーム

URL:


R packagepvEBayes

CRAN statusR-CMD-checkCodecov test coverageCodeFactorLicense: GPL v3

pvEBayes is an R package that implements a suite ofnonparametric empirical Bayes methods for pharmacovigilance, includingGamma-Poisson Shrinker (GPS), K-gamma, general-gamma, Koenker-Mizera(KM), and Efron models. It provides tools for fitting these models tothe spontaneous reporting system (SRS) frequency tables, extractingsummaries, performing hyperparameter tuning, and generating graphicalsummaries (eye plots and heatmaps) for signal detection andestimation.

Spontaneous Reporting System (SRS) Table: An drugsafety SRS dataset catalogs AE reports onI AE rows acrossJ drug columns. Let\({N_{ij}}\) denote the number of reportedcases for thei-th AE and thej-th drug, where\({i = 1,..., I}\) and\({j = 1,..., J}\).

Empirical Bayes modeling for disproportionalityanalysis: We assume that for each AE-drug pair,\(N_{ij} \sim \text{Poisson}(\lambda_{ij}E_{ij})\), where\({E_{ij}}\) isthe expected baseline value, measuring the expected count of the AE-drugpair when there is no association betweeni-th AE andj-th drug. The parameter\({\lambda_{ij} \geq 0}\) represents therelative reporting ratio, the signal strength, for the\({(i, j)}\)-th pair, measuring the ratio ofthe actual expected count arising due to dependence on the null baselineexpected count. Current disproportionality analysis mainly focuses onsignal detection which seeks to determine whether theobservation\(N_{ij}\) is substantiallygreater than the corresponding null baseline\(E_{ij}\). Under the Poisson model, that isto say, its signal strength\(\lambda_{ij}\) is significantly greaterthan 1.

In addition tosignal detection, Tan et al. (Stat. inMed., 2025) broaden the role of disproportionality tosignalestimation. The use of the flexible non-parametric empirical Bayesmodels enables more nuanced empirical Bayes posterior inference(parameter estimation and uncertainty quantification) on signal strengthparameter\(\{ \lambda_{ij} \}\). Thisallows researchers to distinguish AE-drug pairs that would appearsimilar under a binary signal detection framework. For example, theAE-drug pairs with signal strengths of 1.5 and 4.0 could both besignificantly greater than 1 and detected as a signal. Such differencesin signal strength may have distinct implications in medical andclinical contexts.

The methods included inpvEBayes differ by theirassumptions on the prior distribution. Implemented methods include theGamma-Poisson Shrinker (GPS), Koenker-Mizera (KM) method, Efron’snonparametric empirical Bayes approach, the K-gamma model, and thegeneral-gamma model. The selection of the prior distribution is criticalin Bayesian analysis. The GPS model uses a gamma mixture prior byassuming the signal/non-signal structure in SRS data. However, inreal-world setting, signal strengths\({(\lambda_{ij})}\) are often heterogeneousand thus follows a multi-modal distribution, making it difficult toassume a parametric prior. Non-parametric empirical Bayes models (KM,Efron, K-gamma and general-gamma) address this challenge by utilizing aflexible prior with a general mixture form and estimating the priordistribution in a data-driven way.

Implementations: The KM method has an existingimplementation in theREBayes package, but it relies onMosek, a commercial convex optimization solver, which may limitaccessibility due to licensing issues. ThepvEBayes packageprovides an alternative fully open-source implementation of the KMmethod usingCVXR. Efron’s method also has a generalnonparametric empirical Bayes implementation in thedeconvolveR package; however, that implementation does notsupport an exposure or offset parameter in the Poisson model, whichcorresponds to the expected null value\({E_{ij}}\). InpvEBayes, theimplementation of Efron’s method is adapted and modified fromdeconvolveR to support\({E_{ij}}\) in the Poisson model.

In addition, this package implements the novel bi-level ExpectationConditional Maximization (ECM) algorithm proposed by Tan et al. (2025)for efficient parameter estimation in gamma mixture prior based modelsmentioned above.

Installation

The stable version ofpvEBayes can be installed fromCRAN:

install.packages("pvEBayes")

The development version is available from GitHub:

# if (!requireNamespace("devtools")) install.packages("devtools")devtools::install_github("YihaoTancn/pvEBayes")

Quick Example

Here is a minimal example analyzing the built-in FDA statin44 datasetwith general-gamma model:

library(pvEBayes)# Load the statin44 contingency table of 44 AEs for 6 statinsdata("statin2025_44")# Fit a general-gamma model with a specified alphafit <- pvEBayes(  contin_table      = statin2025_44,  model             = "general-gamma",  alpha             = 0.3,  n_posterior_draws = 1000)# Print out a concise description of the fitted modelfit# Obtain a logical matrix for the detected signalsummary(fit, return = "detected signal")# Visualize posterior distributions for top AE-drug pairsplot(fit, type = "eyeplot")

For a more detailed illustration, please see ‘Vignette’.

License

pvEBayes is released under the GPL-3 license. See‘LICENSE.md’ for details.

Code of Conduct

Please note that thepvEBayes project is released with aContributorCode of Conduct. By contributing to this project, you agree to abideby its terms.

References

Tan Y, Markatou M and Chakraborty S. Flexible Empirical BayesianApproaches to Pharmacovigilance for Simultaneous Signal Detection andSignal Strength Estimation in Spontaneous Reporting Systems Data.Statistics in Medicine. 2025; 44: 18-19,https://doi.org/10.1002/sim.70195.

Tan Y, Markatou M and Chakraborty S. pvEBayes: An R Package forEmpirical Bayes Methods in Pharmacovigilance.arXiv:2512.01057(stat.AP). https://doi.org/10.48550/arXiv.2512.01057

Koenker R, Mizera I. Convex Optimization, Shape Constraints, CompoundDecisions, and Empirical Bayes Rules.Journal of the AmericanStatistical Association 2014; 109(506): 674–685,https://doi.org/10.1080/01621459.2013.869224

Efron B. Empirical Bayes Deconvolution Estimates.Biometrika2016; 103(1); 1-20, https://doi.org/10.1093/biomet/asv068

DuMouchel W. Bayesian data mining in large frequency tables, with anapplication to the FDA spontaneous reporting system.The AmericanStatistician. 1999; 1;53(3):177-90.


[8]ページ先頭

©2009-2025 Movatter.jp