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. Fernández de Marcos Giménez de los Galanes, Alberto, 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.
    2. 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.
    3. 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.
    4. Bill Venables, 2017. "JOHN M. CHAMBERS . Extending R . Boca Raton : CRC Press," Biometrics, The International Biometric Society, vol. 73(2), pages 709-710, June.
    5. 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.
    6. 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.
    7. Virginia X. He & Matt P. Wand, 2024. "Bayesian generalized additive model selection including a fast variational option," AStA Advances in Statistical Analysis, Springer;German Statistical Society, vol. 108(3), pages 639-668, September.
    8. 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.
    9. 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.
    10. Martinetti, Davide & Geniaux, Ghislain, 2017. "Approximate likelihood estimation of spatial probit models," Regional Science and Urban Economics, Elsevier, vol. 64(C), pages 30-45.
    11. 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.
    12. Martina Sundqvist & Julien Chiquet & Guillem Rigaill, 2023. "Adjusting the adjusted Rand Index," Computational Statistics, Springer, vol. 38(1), pages 327-347, March.
    13. Son Le, 2018. "Algorithmic Trading with Fitted Q Iteration and Heston Model," Papers 1805.07478, arXiv.org.
    14. Rathelot, Roland, 2014. "Ethnic differentials on the labor market in the presence of asymmetric spatial sorting: Set identification and estimation," Regional Science and Urban Economics, Elsevier, vol. 48(C), pages 154-167.
    15. Roger S. Bivand, 2021. "Progress in the R ecosystem for representing and handling spatial data," Journal of Geographical Systems, Springer, vol. 23(4), pages 515-546, October.
    16. Mirshani, Ardalan & Reimherr, Matthew, 2021. "Adaptive function-on-scalar regression with a smoothing elastic net," Journal of Multivariate Analysis, Elsevier, vol. 185(C).
    17. Helmut Lutkepohl & Fei Shang & Luis Uzeda & Tomasz Wo'zniak, 2024. "Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference," Papers 2404.11057, arXiv.org.
    18. Fernández-de-Marcos, Alberto & García-Portugués, Eduardo, 2023. "Data-driven stabilizations of goodness-of-fit tests," Computational Statistics & Data Analysis, Elsevier, vol. 179(C).
    19. Julien Boelaert, 2013. "A Neural Network Demand System," Documents de travail du Centre d'Economie de la Sorbonne 13081, Université Panthéon-Sorbonne (Paris 1), Centre d'Economie de la Sorbonne.
    20. Muhammad Jaffri Mohd Nasir & Ramzan Nazim Khan & Gopalan Nair & Darfiana Nur, 2024. "Active-set based block coordinate descent algorithm in group LASSO for self-exciting threshold autoregressive model," Statistical Papers, Springer, vol. 65(5), pages 2973-3006, July.

    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.