Comments on: Generate Random Inverse Gaussian in R http://www.lindonslog.com/programming/generate-random-inverse-gaussian-r/ Sun, 27 Nov 2016 15:23:00 +0000 hourly 1 https://wordpress.org/?v=4.6.1 By: admin http://www.lindonslog.com/programming/generate-random-inverse-gaussian-r/#comment-608 Mon, 22 Sep 2014 16:20:04 +0000 http://www.lindonslog.com/?p=1090#comment-608 Andrej, the return type Col double (wordpress is formatting the brackets) is defined within Armadillo. I could have used something else but this random number generator is part of a larger project where I use the armadillo library extensively, so I chose it for continuity. If you look at the Writing R Extensions manual you can call the rnorm C function directly if you like, but before you must write GetRNGstate(); and after PutRNGstate();. I assumed that the Rcpp R::rnorm was just doing this all for you.

]]>
By: anspiess http://www.lindonslog.com/programming/generate-random-inverse-gaussian-r/#comment-600 Sun, 21 Sep 2014 08:39:42 +0000 http://www.lindonslog.com/?p=1090#comment-600 Nice example for an acceptance-rejection sampler in Rcpp! Two thoughts:
a) I think you are not using any ARMA function? b) Calling R::rnorm in each iteration should be quite slow, ’cause Rcpp calls an R function which again calls C function ‘C_rnorm’. Could that one be called directly?

Cheers,
Andrej

]]>