How do I draw multinomial distributed samples with RcppArmadillo?

守給你的承諾、 提交于 2019-12-05 16:01:54
Dirk Eddelbuettel

Your friendly neighbourhood co-author of RcppArmadillo here: I can assure you that it does not provide rmultinom, but Rcpp does. In fact, it simply passes through to R itself as a quick grep would have told you:

  inline void rmultinom(int n, double* prob, int k, int* rn) 
         { return ::rmultinom(n, prob, k, rn); }

So I would suggest your first write a five-line C program against the R API to make sure you know how to have rmultinom do what you want it to do, and then use Rcpp and RcppArmadillo to do the same thing on the data in your vector.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!