IDEAS home Printed from https://ideas.repec.org/a/plo/pone00/0197954.html
   My bibliography  Save this article

No-U-turn sampling for fast Bayesian inference in ADMB and TMB: Introducing the adnuts and tmbstan R packages

Author

Listed:
  • Cole C Monnahan
  • Kasper Kristensen

Abstract

Statistical inference is a widely-used, powerful tool for learning about natural processes in diverse fields. The statistical software platforms AD Model Builder (ADMB) and Template Model Builder (TMB) are particularly popular in the ecological literature, where they are typically used to perform frequentist inference of complex models. However, both lack capabilities for flexible and efficient Markov chain Monte Carlo (MCMC) integration. Recently, the no-U-turn sampler (NUTS) MCMC algorithm has gained popularity for Bayesian inference through the software Stan because it is efficient for high dimensional, complex hierarchical models. Here, we introduce the R packages adnuts and tmbstan, which provide NUTS sampling in parallel and interactive diagnostics with ShinyStan. The ADMB source code was modified to provide NUTS, while TMB models are linked directly into Stan. We describe the packages, provide case studies demonstrating their use, and contrast performance against Stan. For TMB models, we show how to test the accuracy of the Laplace approximation using NUTS. For complex models, the performance of ADMB and TMB was typically within +/- 50% the speed of Stan. In one TMB case study we found inaccuracies in the Laplace approximation, potentially leading to biased inference. adnuts provides a new method for estimating hierarchical ADMB models which previously were infeasible. TMB users can fit the same model in both frequentist and Bayesian paradigms, including using NUTS to test the validity of the Laplace approximation of the marginal likelihood for arbitrary subsets of parameters. These software developments extend the available statistical methods of the ADMB and TMB user base with no additional effort by the user.

Suggested Citation

  • Cole C Monnahan & Kasper Kristensen, 2018. "No-U-turn sampling for fast Bayesian inference in ADMB and TMB: Introducing the adnuts and tmbstan R packages," PLOS ONE, Public Library of Science, vol. 13(5), pages 1-10, May.
  • Handle: RePEc:plo:pone00:0197954
    DOI: 10.1371/journal.pone.0197954
    as

    Download full text from publisher

    File URL: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0197954
    Download Restriction: no

    File URL: https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0197954&type=printable
    Download Restriction: no

    File URL: https://libkey.io/10.1371/journal.pone.0197954?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. Carpenter, Bob & Gelman, Andrew & Hoffman, Matthew D. & Lee, Daniel & Goodrich, Ben & Betancourt, Michael & Brubaker, Marcus & Guo, Jiqiang & Li, Peter & Riddell, Allen, 2017. "Stan: A Probabilistic Programming Language," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 76(i01).
    2. Kristensen, Kasper & Nielsen, Anders & Berg, Casper W. & Skaug, Hans & Bell, Bradley M., 2016. "TMB: Automatic Differentiation and Laplace Approximation," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 70(i05).
    3. Skaug, Hans J. & Fournier, David A., 2006. "Automatic approximation of the marginal likelihood in non-Gaussian hierarchical models," Computational Statistics & Data Analysis, Elsevier, vol. 51(2), pages 699-709, November.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Kala Studens & Benjamin M. Bolker & Jean-Noël Candau, 2024. "Predicting the Temperature-Driven Development of Stage-Structured Insect Populations with a Bayesian Hierarchical Model," Journal of Agricultural, Biological and Environmental Statistics, Springer;The International Biometric Society;American Statistical Association, vol. 29(3), pages 536-552, September.
    2. Aaron Osgood‐Zimmerman & Jon Wakefield, 2023. "A Statistical Review of Template Model Builder: A Flexible Tool for Spatial Modelling," International Statistical Review, International Statistical Institute, vol. 91(2), pages 318-342, August.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Ben C. Stevenson & Rachel M. Fewster & Koustubh Sharma, 2022. "Spatial correlation structures for detections of individuals in spatial capture–recapture models," Biometrics, The International Biometric Society, vol. 78(3), pages 963-973, September.
    2. Aaron Osgood‐Zimmerman & Jon Wakefield, 2023. "A Statistical Review of Template Model Builder: A Flexible Tool for Spatial Modelling," International Statistical Review, International Statistical Institute, vol. 91(2), pages 318-342, August.
    3. Øystein Sørensen & Anders M. Fjell & Kristine B. Walhovd, 2023. "Longitudinal Modeling of Age-Dependent Latent Traits with Generalized Additive Latent and Mixed Models," Psychometrika, Springer;The Psychometric Society, vol. 88(2), pages 456-486, June.
    4. David L. Miller & Richard Glennie & Andrew E. Seaton, 2020. "Understanding the Stochastic Partial Differential Equation Approach to Smoothing," Journal of Agricultural, Biological and Environmental Statistics, Springer;The International Biometric Society;American Statistical Association, vol. 25(1), pages 1-16, March.
    5. Devin S. Johnson & Brian M. Brost & Mevin B. Hooten, 2022. "Greater Than the Sum of its Parts: Computationally Flexible Bayesian Hierarchical Modeling," Journal of Agricultural, Biological and Environmental Statistics, Springer;The International Biometric Society;American Statistical Association, vol. 27(2), pages 382-400, June.
    6. Roland Langrock & Timo Adam & Vianey Leos‐Barajas & Sina Mews & David L. Miller & Yannis P. Papastamatiou, 2018. "Spline‐based nonparametric inference in general state‐switching models," Statistica Neerlandica, Netherlands Society for Statistics and Operations Research, vol. 72(3), pages 179-200, August.
    7. Ingrid Sandvig Thorsen & Bård Støve & Hans J. Skaug, 2023. "A TMB Approach to Study Spatial Variation in Weather-Generated Claims in Insurance," SN Operations Research Forum, Springer, vol. 4(4), pages 1-27, December.
    8. William H. Aeberhard & Eva Cantoni & Chris Field & Hans R. Künsch & Joanna Mills Flemming & Ximing Xu, 2021. "Robust estimation for discrete‐time state space models," Scandinavian Journal of Statistics, Danish Society for Theoretical Statistics;Finnish Statistical Society;Norwegian Statistical Association;Swedish Statistical Association, vol. 48(4), pages 1127-1147, December.
    9. Zheng, Nan & Cadigan, Noel, 2021. "Frequentist delta-variance approximations with mixed-effects models and TMB," Computational Statistics & Data Analysis, Elsevier, vol. 160(C).
    10. Ruggero Bellio & Nicola Soriani, 2021. "Maximum likelihood estimation based on the Laplace approximation for p2 network regression models," Statistica Neerlandica, Netherlands Society for Statistics and Operations Research, vol. 75(1), pages 24-41, February.
    11. Francis,David C. & Kubinec ,Robert, 2022. "Beyond Political Connections : A Measurement Model Approach to Estimating Firm-levelPolitical Influence in 41 Economies," Policy Research Working Paper Series 10119, The World Bank.
    12. Katherine Wilson & Jon Wakefield, 2022. "A probabilistic model for analyzing summary birth history data," Demographic Research, Max Planck Institute for Demographic Research, Rostock, Germany, vol. 47(11), pages 291-344.
    13. Martinovici, A., 2019. "Revealing attention - how eye movements predict brand choice and moment of choice," Other publications TiSEM 7dca38a5-9f78-4aee-bd81-c, Tilburg University, School of Economics and Management.
    14. Yongping Bao & Ludwig Danwitz & Fabian Dvorak & Sebastian Fehrler & Lars Hornuf & Hsuan Yu Lin & Bettina von Helversen, 2022. "Similarity and Consistency in Algorithm-Guided Exploration," CESifo Working Paper Series 10188, CESifo.
    15. Heinrich, Torsten & Yang, Jangho & Dai, Shuanping, 2020. "Growth, development, and structural change at the firm-level: The example of the PR China," MPRA Paper 105011, University Library of Munich, Germany.
    16. van Kesteren Erik-Jan & Bergkamp Tom, 2023. "Bayesian analysis of Formula One race results: disentangling driver skill and constructor advantage," Journal of Quantitative Analysis in Sports, De Gruyter, vol. 19(4), pages 273-293, December.
    17. Xin Xu & Yang Lu & Yupeng Zhou & Zhiguo Fu & Yanjie Fu & Minghao Yin, 2021. "An Information-Explainable Random Walk Based Unsupervised Network Representation Learning Framework on Node Classification Tasks," Mathematics, MDPI, vol. 9(15), pages 1-14, July.
    18. Andre Python & Andreas Bender & Marta Blangiardo & Janine B. Illian & Ying Lin & Baoli Liu & Tim C.D. Lucas & Siwei Tan & Yingying Wen & Davit Svanidze & Jianwei Yin, 2022. "A downscaling approach to compare COVID‐19 count data from databases aggregated at different spatial scales," Journal of the Royal Statistical Society Series A, Royal Statistical Society, vol. 185(1), pages 202-218, January.
    19. Xiaoyue Xi & Simon E. F. Spencer & Matthew Hall & M. Kate Grabowski & Joseph Kagaayi & Oliver Ratmann & Rakai Health Sciences Program and PANGEA‐HIV, 2022. "Inferring the sources of HIV infection in Africa from deep‐sequence data with semi‐parametric Bayesian Poisson flow models," Journal of the Royal Statistical Society Series C, Royal Statistical Society, vol. 71(3), pages 517-540, June.
    20. Kuschnig, Nikolas, 2021. "Bayesian Spatial Econometrics and the Need for Software," Department of Economics Working Paper Series 318, WU Vienna University of Economics and Business.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:plo:pone00:0197954. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: plosone (email available below). General contact details of provider: https://journals.plos.org/plosone/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.