[R-SIG-Mac] Re: [R] strange behaviour of negative binomial
Rob J Goedman
goedman at mac.com
Thu Jan 6 16:54:45 CET 2005
Wow, there is indeed a huge difference in elapsed time for nbinom.
Almost linear with the length of x.
The non-GUI version stays around a second or so, for length(x) == 871,
the GUI
version takes ~25 seconds, for length(x)==8701, the GUI version takes
~250 secs.
It seems only to occur with nbinom. Norm, binom, exp, gamma etc. all
are within 1
or 2 seconds.
The curves I'm getting are identical though. In all runs the 2 curves
did overlap.
Rob
On Jan 5, 2005, at 2:53 PM, dax42 wrote:
> Hi,
>
> I am sorry for the incorrect terms. Of course I mean the cumulative
> distribution functions.
> As I just got two answers telling me my problem does not exist, I
> tried again on a different setup - and indeed it works.
>
> So, my first run was done on a Mac OS X 10.3.7 running R 2.0.0, GUI
> version.
> Now I tried it on the same system, only I used the R 2.0.0 on my X11,
> not the GUI version.
>
> First setup produces the error (and is VERY slow, talking about
> several minutes here...)
> Second works fine.
>
> Does anybody have a similar setup and could try this out as well?
> Thanks!
> Dax
>
> Am 05.01.2005 um 23:32 schrieb Peter Dalgaard:
>
>> dax42 <Dax42 at web.de> writes:
>>
>>> Dear list,
>>>
>>> I ran into a strange behaviour of the pnbinom function - or maybe I
>>> just made a stupid mistake.
>>> First thing is that pnbinom seems to be very slow. The other - more
>>> interesting one - is that I get two different curves when I plot the
>>> estimated density and the density given by pnbinom. Shouldn't it be
>>> the same?
>>> This is only the case, I think, if I use the parameter size = 1. I
>>> just tried it for size = 2 and the result seemed correct..
>>>
>>> Anyways, this is what I tried:
>>>
>>> #parameters
>>> proba<-0.001039302;
>>> s<-1;
>>>
>>> #random numbers with this distribution
>>> dom<-rnbinom(10000,s,proba);
>>>
>>> #first plot
>>> plot(ecdf(dom),do.points=FALSE);
>>>
>>> #second plot
>>> x<-seq(0,8700,0.5);
>>> lines(x,pnbinom(x,s,proba),col="red");
>>
>> Errrr... What's the problem here? The two curves look quite similar to
>> me. (And both are of course cumulative distribution functions and not
>> densities, but it doesn't sound like that is the problem.)
>>
>> --
>> O__ ---- Peter Dalgaard Blegdamsvej 3
>> c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
>> (*) \(*) -- University of Copenhagen Denmark Ph: (+45)
>> 35327918
>> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45)
>> 35327907
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
More information about the R-SIG-Mac
mailing list