Re: [Rd] rmultinom.c error probability not sum to 1

2016-03-10 Thread M.van_Iterson
Thanks for your replies. Indeed, I had to add the dimension of the probability vector like this rmultinom(1, prob, 3, rN); Regards, Maarten From: peter dalgaard [pda...@gmail.com] Sent: Thursday, March 10, 2016 9:45 PM To: Iterson, M. van (MOLEPI) Cc: r

Re: [Rd] rmultinom.c error probability not sum to 1

2016-03-10 Thread M.van_Iterson
Hi all, I should have given a better explanation of my problem. Here it is. I extracted from my code the bit that gives the error. Place this in a file called test.c #include #include #include #include #include int main(){ double prob[3] = {0.0, 0.0, 0.0}; double prob_tot = 0.; p

[Rd] rmultinom.c error probability not sum to 1

2016-03-10 Thread M.van_Iterson
Dear all, I have a questions regarding using the c function rmultinom.c. I got the following error message "rbinom: probability sum should be 1, but is 0.999264" Which is thrown by: if(fabs((double)(p_tot - 1.)) > 1e-7) MATHLIB_ERROR(_("rbinom: probability sum should be 1, but is %g"), (doub