[R] Poisson Distribution fitting

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 25 12:03:57 CEST 2005


On Thu, 25 Aug 2005, Prof Brian Ripley wrote:

> On Thu, 25 Aug 2005, Mark Miller wrote:
>
>> I am trying to fit a number of distributions to a set of data, I have used 
>> the
>> fitdristr() funtion for most of the distributions, but Poisson is not one 
>> of
>> the possible distributions. I found somewhee talking about using the gamlss
>> package, but have been unable to find it again, any help would be greatly
>> appreciated.
>
> If you mean fitdistr in package MASS, it can be used.  But the mle for a 
> Poisson is just the sample mean.
>
>> x <- rpois(250, 2.6)
>> mean(x)
> [1] 2.62
>> fitdistr(x, dpois, list(lambda=2))
>    lambda
>  2.6203125
> (0.1023841)
>
> You can even find the s.e. via mu/sqrt(n), here
>> mean(x)/sqrt(250)
> [1] 0.1657033

Sorry, sqrt(mu/n).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list