Re: [R] How to avoid the NaN errors in dnbinom?

2007-10-24 Thread francogrex
Thanks Jim, I corrected the error by avoiding negative K values: k1=abs(mu1/((var1/mu1)-1)) k2=abs(mu2/((var2/mu2)-1)) I am not sure about the general code to determine the parameters though, sometimes it gives the expected values (determined in advance by rnbinom) and sometimes it's way off.

Re: [R] How to avoid the NaN errors in dnbinom?

2007-10-23 Thread jim holtman
Your problems is that your code is generating NaN and 'err' is set to NaN and therefore the 'while (err > eps)' fails since NaN is not a logical variable. You should learn to use debug or the browser. I put the following statement in your code: new.parms=c(k1,mu1,k2,mu2,prob) err

[R] How to avoid the NaN errors in dnbinom?

2007-10-23 Thread francogrex
Hi, The code below is giving me this error message: Error in while (err > eps) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In dnbinom(x, size, prob, log) : NaNs produced 2: In dnbinom(x, size, prob, log) : NaNs produced I know from the help files that for dnbinom "