From pdalgd at gmail.com  Thu Mar 10 13:26:09 2016
From: pdalgd at gmail.com (peter dalgaard)
Date: Thu, 10 Mar 2016 13:26:09 +0100
Subject: [Rd] rmultinom.c error probability not sum to 1
In-Reply-To: <6C970093269C804E91E22510E87295281C3A448C@MAIL-MB01.lumcnet.prod.intern>
References: <6C970093269C804E91E22510E87295281C3A448C@MAIL-MB01.lumcnet.prod.intern>
Message-ID: <AD6651EC-AA5B-4EFA-8EA1-54170F809F1A@gmail.com>


On 10 Mar 2016, at 12:47 , M.van_Iterson at lumc.nl wrote:

> 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"),
> (double) p_tot);
> 
> I understand my probabilities do not sum to one close enough. I tried the following,
> p[2] = 1. - p[0] - p[1],  where 'p', are the probabilities but this is not sufficient to pass the error message!
> 


p[0] ????


> Thanks in advance!
> 
> Regards,
> Maarten
> 
> (I don't think this is an issue with versions but I used R version 3.2.3 and can provide more details on my linux build if necessary.)
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



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