IDEAS home Printed from https://ideas.repec.org/a/jss/jstsof/v070i05.html
   My bibliography  Save this article

TMB: Automatic Differentiation and Laplace Approximation

Author

Listed:
  • Kristensen, Kasper
  • Nielsen, Anders
  • Berg, Casper W.
  • Skaug, Hans
  • Bell, Bradley M.

Abstract

TMB is an open source R package that enables quick implementation of complex nonlinear random effects (latent variable) models in a manner similar to the established AD Model Builder package (ADMB, http://admb-project.org/; Fournier et al. 2011). In addition, it offers easy access to parallel computations. The user defines the joint likelihood for the data and the random effects as a C++ template function, while all the other operations are done in R; e.g., reading in the data. The package evaluates and maximizes the Laplace approximation of the marginal likelihood where the random effects are automatically integrated out. This approximation, and its derivatives, are obtained using automatic differentiation (up to order three) of the joint likelihood. The computations are designed to be fast for problems with many random effects (≈ 106 ) and parameters (≈ 103 ). Computation times using ADMB and TMB are compared on a suite of examples ranging from simple models to large spatial models where the random effects are a Gaussian random field. Speedups ranging from 1.5 to about 100 are obtained with increasing gains for large problems. The package and examples are available at http://tmb-project.org/.

Suggested Citation

  • 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).
  • Handle: RePEc:jss:jstsof:v:070:i05
    DOI: http://hdl.handle.net/10.18637/jss.v070.i05
    as

    Download full text from publisher

    File URL: https://www.jstatsoft.org/index.php/jss/article/view/v070i05/v70i05.pdf
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v070i05/TMB_1.7.0.tar.gz
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v070i05/v70i05-replication.zip
    Download Restriction: no

    File URL: https://libkey.io/http://hdl.handle.net/10.18637/jss.v070.i05?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. Wang, Guiming, 2007. "On the latent state estimation of nonlinear population dynamics using Bayesian and non-Bayesian state-space models," Ecological Modelling, Elsevier, vol. 200(3), pages 521-528.
    2. Håvard Rue & Sara Martino & Nicolas Chopin, 2009. "Approximate Bayesian inference for latent Gaussian models by using integrated nested Laplace approximations," Journal of the Royal Statistical Society Series B, Royal Statistical Society, vol. 71(2), pages 319-392, April.
    3. J. Andrew Royle, 2004. "N-Mixture Models for Estimating Population Size from Spatially Replicated Counts," Biometrics, The International Biometric Society, vol. 60(1), pages 108-115, March.
    4. 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)

    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. 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.
    2. Solbu, Erik Blystad & Engen, Steinar & Diserud, Ola Håvard, 2015. "Guidelines when estimating temporal changes in density dependent populations," Ecological Modelling, Elsevier, vol. 313(C), pages 355-376.
    3. Kleppe, Tore Selland & Skaug, Hans Julius, 2012. "Fitting general stochastic volatility models using Laplace accelerated sequential importance sampling," Computational Statistics & Data Analysis, Elsevier, vol. 56(11), pages 3105-3119.
    4. Laurini Márcio Poletti, 2013. "A Hybrid Data Cloning Maximum Likelihood Estimator for Stochastic Volatility Models," Journal of Time Series Econometrics, De Gruyter, vol. 5(2), pages 193-229, May.
    5. Hefley, Trevor J. & Tyre, Andrew J. & Blankenship, Erin E., 2013. "Fitting population growth models in the presence of measurement and detection error," Ecological Modelling, Elsevier, vol. 263(C), pages 244-250.
    6. 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.
    7. 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.
    8. Pedersen, M.W. & Berg, C.W. & Thygesen, U.H. & Nielsen, A. & Madsen, H., 2011. "Estimation methods for nonlinear state-space models in ecology," Ecological Modelling, Elsevier, vol. 222(8), pages 1394-1400.
    9. Nikoline N. Knudsen & Jörg Schullehner & Birgitte Hansen & Lisbeth F. Jørgensen & Søren M. Kristiansen & Denitza D. Voutchkova & Thomas A. Gerds & Per K. Andersen & Kristine Bihrmann & Morten Grønbæk , 2017. "Lithium in Drinking Water and Incidence of Suicide: A Nationwide Individual-Level Cohort Study with 22 Years of Follow-Up," IJERPH, MDPI, vol. 14(6), pages 1-13, June.
    10. Leonardo Padilla & Bernado Lagos‐Álvarez & Jorge Mateu & Emilio Porcu, 2020. "Space‐time autoregressive estimation and prediction with missing data based on Kalman filtering," Environmetrics, John Wiley & Sons, Ltd., vol. 31(7), November.
    11. Scott, Ryan P. & Scott, Tyler A., 2019. "Investing in collaboration for safety: Assessing grants to states for oil and gas distribution pipeline safety program enhancement," Energy Policy, Elsevier, vol. 124(C), pages 332-345.
    12. Cho, Daegon & Hwang, Youngdeok & Park, Jongwon, 2018. "More buzz, more vibes: Impact of social media on concert distribution," Journal of Economic Behavior & Organization, Elsevier, vol. 156(C), pages 103-113.
    13. Brown, Paul T. & Joshi, Chaitanya & Joe, Stephen & Rue, Håvard, 2021. "A novel method of marginalisation using low discrepancy sequences for integrated nested Laplace approximations," Computational Statistics & Data Analysis, Elsevier, vol. 157(C).
    14. Michaela Prokešová & Eva Jensen, 2013. "Asymptotic Palm likelihood theory for stationary point processes," Annals of the Institute of Statistical Mathematics, Springer;The Institute of Statistical Mathematics, vol. 65(2), pages 387-412, April.
    15. Shreosi Sanyal & Thierry Rochereau & Cara Nichole Maesano & Laure Com-Ruelle & Isabella Annesi-Maesano, 2018. "Long-Term Effect of Outdoor Air Pollution on Mortality and Morbidity: A 12-Year Follow-Up Study for Metropolitan France," IJERPH, MDPI, vol. 15(11), pages 1-8, November.
    16. Mayer Alvo & Jingrui Mu, 2023. "COVID-19 Data Analysis Using Bayesian Models and Nonparametric Geostatistical Models," Mathematics, MDPI, vol. 11(6), pages 1-13, March.
    17. Simone Vincenzi & Marc Mangel & Alain J Crivelli & Stephan Munch & Hans J Skaug, 2014. "Determining Individual Variation in Growth and Its Implication for Life-History and Population Processes Using the Empirical Bayes Method," PLOS Computational Biology, Public Library of Science, vol. 10(9), pages 1-16, September.
    18. David Jiménez-Hernández & Víctor González-Calatayud & Ana Torres-Soto & Asunción Martínez Mayoral & Javier Morales, 2020. "Digital Competence of Future Secondary School Teachers: Differences According to Gender, Age, and Branch of Knowledge," Sustainability, MDPI, vol. 12(22), pages 1-16, November.
    19. Vanessa Santos-Sánchez & Juan Antonio Córdoba-Doña & Javier García-Pérez & Antonio Escolar-Pujolar & Lucia Pozzi & Rebeca Ramis, 2020. "Cancer Mortality and Deprivation in the Proximity of Polluting Industrial Facilities in an Industrial Region of Spain," IJERPH, MDPI, vol. 17(6), pages 1-15, March.
    20. 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.

    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:jss:jstsof:v:070:i05. 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: Christopher F. Baum (email available below). General contact details of provider: http://www.jstatsoft.org/ .

    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.