IDEAS home Printed from https://ideas.repec.org/a/eee/csdana/v71y2014icp1054-1063.html
   My bibliography  Save this article

RcppArmadillo: Accelerating R with high-performance C++ linear algebra

Author

Listed:
  • Eddelbuettel, Dirk
  • Sanderson, Conrad

Abstract

The R statistical environment and language has demonstrated particular strengths for interactive development of statistical algorithms, as well as data modelling and visualisation. Its current implementation has an interpreter at its core which may result in a performance penalty in comparison to directly executing user algorithms in the native machine code of the host CPU. In contrast, the C++ language has no built-in visualisation capabilities, handling of linear algebra or even basic statistical algorithms; however, user programs are converted to high-performance machine code, ahead of execution. A new method avoids possible speed penalties in R by using the Rcpp extension package in conjunction with the Armadillo C++ matrix library. In addition to the inherent performance advantages of compiled code, Armadillo provides an easy-to-use template-based meta-programming framework, allowing the automatic pooling of several linear algebra operations into one, which in turn can lead to further speedups. With the aid of Rcpp and Armadillo, conversion of linear algebra centred algorithms from R to C++ becomes straightforward. The algorithms retain the overall structure as well as readability, all while maintaining a bidirectional link with the host R environment. Empirical timing comparisons of R and C++ implementations of a Kalman filtering algorithm indicate a speedup of several orders of magnitude.

Suggested Citation

  • Eddelbuettel, Dirk & Sanderson, Conrad, 2014. "RcppArmadillo: Accelerating R with high-performance C++ linear algebra," Computational Statistics & Data Analysis, Elsevier, vol. 71(C), pages 1054-1063.
  • Handle: RePEc:eee:csdana:v:71:y:2014:i:c:p:1054-1063
    DOI: 10.1016/j.csda.2013.02.005
    as

    Download full text from publisher

    File URL: http://www.sciencedirect.com/science/article/pii/S0167947313000492
    Download Restriction: Full text for ScienceDirect subscribers only.

    File URL: https://libkey.io/10.1016/j.csda.2013.02.005?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
    ---><---

    As the access to this document is restricted, you may want to search for a different version of it.

    References listed on IDEAS

    as
    1. Tusell, Fernando, 2011. "Kalman Filtering in R," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 39(i02).
    2. Li, Junye, 2013. "An unscented Kalman smoother for volatility extraction: Evidence from stock prices and options," Computational Statistics & Data Analysis, Elsevier, vol. 58(C), pages 15-26.
    3. Eddelbuettel, Dirk & Francois, Romain, 2011. "Rcpp: Seamless R and C++ Integration," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 40(i08).
    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. Wilson J. Wright & Peter N. Neitlich & Alyssa E. Shiel & Mevin B. Hooten, 2022. "Mechanistic spatial models for heavy metal pollution," Environmetrics, John Wiley & Sons, Ltd., vol. 33(8), December.
    2. Fernández de Marcos Giménez de los Galanes, Alberto & García Portugués, Eduardo, 2022. "Data-driven stabilizations of goodness-of-fit tests," DES - Working Papers. Statistics and Econometrics. WS 35324, Universidad Carlos III de Madrid. Departamento de Estadística.
    3. Sloot Henrik, 2022. "Implementing Markovian models for extendible Marshall–Olkin distributions," Dependence Modeling, De Gruyter, vol. 10(1), pages 308-343, January.
    4. Cindy Frascolla & Guillaume Lecuelle & Pascal Schlich & Hervé Cardot, 2022. "Two sample tests for Semi-Markov processes with parametric sojourn time distributions: an application in sensory analysis," Computational Statistics, Springer, vol. 37(5), pages 2553-2580, November.
    5. Samrachana Adhikari & Tracy Sweet & Brian Junker, 2021. "Analysis of longitudinal advice‐seeking networks following implementation of high stakes testing," Journal of the Royal Statistical Society Series A, Royal Statistical Society, vol. 184(4), pages 1475-1500, October.
    6. Bachoc, François & Genton, Mark G. & Nordhausen, Klaus & Ruiz-Gazen, Anne & Virta, Joni, 2019. "Spatial Blind Source Separation," TSE Working Papers 19-998, Toulouse School of Economics (TSE).
    7. Bill Venables, 2017. "JOHN M. CHAMBERS . Extending R . Boca Raton : CRC Press," Biometrics, The International Biometric Society, vol. 73(2), pages 709-710, June.
    8. Anoek Castelein & Dennis Fok & Richard Paap, 2020. "A multinomial and rank-ordered logit model with inter- and intra-individual heteroscedasticity," Tinbergen Institute Discussion Papers 20-069/III, Tinbergen Institute.
    9. Peter Christoffersen & Christian Dorion & Kris Jacobs & Lotfi Karoui, 2014. "Nonlinear Kalman Filtering in Affine Term Structure Models," Management Science, INFORMS, vol. 60(9), pages 2248-2268, September.
    10. Adrien Ickowicz & Jessica Ford & Keith Hayes, 2019. "A Mixture Model Approach for Compositional Data: Inferring Land-Use Influence on Point-Referenced Water Quality Measurements," Journal of Agricultural, Biological and Environmental Statistics, Springer;The International Biometric Society;American Statistical Association, vol. 24(4), pages 719-739, December.
    11. James Joseph Balamuta & Steven Andrew Culpepper, 2022. "Exploratory Restricted Latent Class Models with Monotonicity Requirements under PÒLYA–GAMMA Data Augmentation," Psychometrika, Springer;The Psychometric Society, vol. 87(3), pages 903-945, September.
    12. Athanasios C. Micheas & Jiaxun Chen, 2018. "sppmix: Poisson point process modeling using normal mixture models," Computational Statistics, Springer, vol. 33(4), pages 1767-1798, December.
    13. Chen, Si & Zhou, Zhen & Li, Shenghong, 2016. "An efficient estimate and forecast of the implied volatility surface: A nonlinear Kalman filter approach," Economic Modelling, Elsevier, vol. 58(C), pages 655-664.
    14. Martinetti, Davide & Geniaux, Ghislain, 2017. "Approximate likelihood estimation of spatial probit models," Regional Science and Urban Economics, Elsevier, vol. 64(C), pages 30-45.
    15. Jin, Shaobo & Moustaki, Irini & Yang-Wallentin, Fan, 2018. "Approximated penalized maximum likelihood for exploratory factor analysis: an orthogonal case," LSE Research Online Documents on Economics 88118, London School of Economics and Political Science, LSE Library.
    16. Martina Sundqvist & Julien Chiquet & Guillem Rigaill, 2023. "Adjusting the adjusted Rand Index," Computational Statistics, Springer, vol. 38(1), pages 327-347, March.
    17. Son Le, 2018. "Algorithmic Trading with Fitted Q Iteration and Heston Model," Papers 1805.07478, arXiv.org.
    18. Shaobo Jin & Irini Moustaki & Fan Yang-Wallentin, 2018. "Approximated Penalized Maximum Likelihood for Exploratory Factor Analysis: An Orthogonal Case," Psychometrika, Springer;The Psychometric Society, vol. 83(3), pages 628-649, September.
    19. Michael Braun & Paul Damien, 2016. "Scalable Rejection Sampling for Bayesian Hierarchical Models," Marketing Science, INFORMS, vol. 35(3), pages 427-444, May.
    20. Thomas Stringham, 2022. "Fast Bayesian Record Linkage With Record-Specific Disagreement Parameters," Journal of Business & Economic Statistics, Taylor & Francis Journals, vol. 40(4), pages 1509-1522, October.

    More about this item

    Keywords

    Software; R; C++; Linear algebra;
    All these keywords.

    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:eee:csdana:v:71:y:2014:i:c:p:1054-1063. 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: Catherine Liu (email available below). General contact details of provider: http://www.elsevier.com/locate/csda .

    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.