https://doi.org/10.1140/epjc/s10052-025-14495-1
Regular Article - Computing, Software and Data Science
stanhf: HistFactory models in the probabilistic programming language Stan
X-HEP Laboratory, Department of Physics, School of Mathematics and Physics, Xi’an Jiaotong-Liverpool University, 215123, Suzhou, China
a
This email address is being protected from spambots. You need JavaScript enabled to view it.
Received:
3
April
2025
Accepted:
3
July
2025
Published online:
30
August
2025
Abstract
In collider physics, experiments are often based on counting the numbers of events in bins of a histogram. We present a new way to build and analyze statistical models that describe these experiments, based on the probabilistic programming language Stan and the HistFactory specification. A command-line tool transpiles HistFactory models into Stan code and data files. Because Stan is an imperative language, it enables richer and more detailed modeling, as modeling choices defined in the HistFactory declarative specification can be tweaked and adapted in the Stan language. Stan was constructed with automatic differentiation, allowing modern computational algorithms for sampling and optimization.
© The Author(s) 2025
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

