Skip to content
Prev 10438 / 10988 Next

[Rcpp-devel] Input on code design implementing a MCMC algorithm in R and improving performance with RcppArmadillo

A while ago, I did exactly what you are trying to do. I converted my MCMC
code in Matlab to R although it does not involve Kalman filter forward
filtering and backward smoothing algorithm. I converted one program that
takes the most of the time to RCpp with the help of others and used
other modules as in R. My experience was not as positive as others may have
had as it takes about 7 days to run 10,000 iterations with R for the same
data, which normally takes about 7 hours in Matlab. It was a fun project
but it might be a better idea to build a new program from scratch in R and
RCpp rather than converting an existing Matlab program to R.  I did use
list variable type for data, parameters, and storage for MCMC run. If you
are familiar with Matlab, the conversion to R and RCpp would not take much
time and obviously you have a fantastic community that lends their hands
should you have any questions (Thank you Dirk!). Obviously there is a code
optimization issue, which I am not so familiar with R and RCpp, that led to
increasing computing time in my case. My goal was to build new programs in
R for the future but I was discouraged by the speed. You can also try
Microsoft R which happens to utilize more CPU cores than plain R. Best
wishes for your attempt.

On Fri, Apr 10, 2020 at 10:25 AM Jeff Newmiller <jdnewmil at dcn.davis.ca.us>
wrote:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20200410/a5a84c6e/attachment-0001.html>