[R] strange behaviour of negative binomial
dax42
Dax42 at web.de
Wed Jan 5 22:34:04 CET 2005
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");
More information about the R-help
mailing list