[R] quantiles for geometric distribution

Gabor Grothendieck ggrothendieck at myway.com
Wed Jan 5 04:18:20 CET 2005


dax42 <Dax42 <at> web.de> writes:

: 
: Dear list,
: 
: I have got an array with observational values t and I would like to fit 
: a geometric distribution to it.
: As I understand the geometric distribution, there is only one 
: parameter, the probability p. I estimated it by 1/mean(t).

p=1/EX if the geometric distribution starts at 1 but in R the
geometric distribution starts at 0. That is, in R the geometric 
distribution is the number of failures before a success, not the 
number of trials including the success.  

If X is a geometric random variable then EX = 0p + (EX+1)(1-p)
and solving for EX gives 1/p-1.

: 
: Now I plotted the estimated density function by
: plot(ecdf(t),do.points=FALSE,col.h="blue");
: 
: and I would like to add the geometric distribution. This should be 
: possibly with the function pgeom().
: 
: Unfortunately I do not understand what is meant by the argument q, 
: "vector of quantiles representing the number of failures in a sequence 
: of Bernoulli trials before success occurs" according to R help.
: 
: I am familiar with quantiles, but why do I need them here?
: Does anybody know what this means? What am I supposed to do?

The quantiles are just the values of the geometric random
variable.  That is if you have a data vector x in which the
ith element of x is the ith observation (where each
observation is the number of failures before a success, viz.
a non-negative integer) then dgeom(x, .2) would give a vector 
of density values assuming the probability of a success is .2 .




More information about the R-help mailing list