Publications by Rcpp Gallery
Speed Chain Ladder Analysis with Rcpp
The Chain Ladder method is an actuarial technique used for projecting incurred insurance claims to their ultimate loss values. The data exists as claims triangles where the claims for each accounting year increments down the rows and the claims for each development period increments along the columns. This claims triangle can be represented in a...
1507 sym R (3731 sym/5 pcs) 2 img
Transforming a Matrix in Parallel using RcppParallel
The RcppParallel package includes high level functions for doing parallel programming with Rcpp. For example, the parallelFor function can be used to convert the work of a standard serial “for” loop into a parallel one. This article describes using RcppParallel to transform an R matrix in parallel. Serial Version First a serial version of the...
2700 sym R (1980 sym/4 pcs) 2 img
Summing a Vector in Parallel with RcppParallel
The RcppParallel package includes high level functions for doing parallel programming with Rcpp. For example, the parallelReduce function can be used aggreggate values from a set of inputs in parallel. This article describes using RcppParallel to sum an R vector. Serial Version First a serial version of computing the sum of a vector. For this we ...
3258 sym R (1648 sym/4 pcs) 2 img
Parallel Distance Matrix Calculation with RcppParallel
The RcppParallel package includes high level functions for doing parallel programming with Rcpp. For example, the parallelFor function can be used to convert the work of a standard serial “for” loop into a parallel one. This article describes using RcppParallel to compute pairwise distances for each row in an input data matrix and return an...
4354 sym R (5155 sym/6 pcs) 2 img
Computing an Inner Product with RcppParallel
The RcppParallel package includes high level functions for doing parallel programming with Rcpp. For example, the parallelReduce function can be used aggreggate values from a set of inputs in parallel. This article describes using RcppParallel to parallelize the inner-product example previously posted to the Rcpp Gallery. Serial Version First ...
2257 sym R (2012 sym/4 pcs) 2 img
Using RcppArmadillo with bigmemory
The bigmemory package allows users to create matrices that are external to R, stored either in RAM or on disk, allowing them to be bigger than the system RAM, and allowing them to be shared across R sessions. While these objects are defined by the big.matrix class in R, they are really just wrappers that point to external memory. The actual objec...
1613 sym R (5375 sym/2 pcs) 2 img
Implementing an EM Algorithm for Probit Regressions
Users new to the Rcpp family of functionality are often impressed with the performance gains that can be realized, but struggle to see how to approach their own computational problems. Many of the most impressive performance gains are demonstrated with seemingly advanced statistical methods, advanced C++–related constructs, or both. Even when u...
7772 sym R (7595 sym/13 pcs) 2 img
Sampling Importance Resampling (SIR) and social revolution.
Motivation The purpose of this gallery post is several fold: to demonstrate the use of the new and improved C++-level implementation of R’s sample() function (see here) to demonstrate the Gallery’s new support for images in contributed posts to demonstrate the usefulness of SIR for updating posterior beliefs given a sample from an arbitrary ...
6328 sym R (2086 sym/7 pcs) 4 img 1 tbl
Create an R-tree data structure using Rcpp and Boost::Geometry
Introduction The purpose of this post is to show how to use Boost::Geometry library which was introduced recently in Rcpp. Especially, we focus on R-tree data structure for searching objects in space because only one spatial index is implemented – R-tree Currently in this library. Boost.Geometry which is part of the Boost C++ Libraries gives u...
3228 sym R (2997 sym/3 pcs) 4 img
Parsing Dates and Times
Motivation R has excellent for dates and times via the built-in Date and POSIXt classes. Their usage, however, is not always as straightforward as one would want. Certain conversions are more cumbersome than we would like: while as.Date("2015-03-22"), would it not be nice if as.Date("20150322") (a format often used in logfiles) also worked, or ...
3513 sym R (4135 sym/6 pcs) 2 img