From ripley at stats.ox.ac.uk  Tue Mar 18 11:30:14 2008
From: ripley at stats.ox.ac.uk (ripley at stats.ox.ac.uk)
Date: Tue, 18 Mar 2008 11:30:14 +0100 (CET)
Subject: [Rd] glm poisson, method='ML' (PR#10985)
Message-ID: <20080318103014.7FB1E282EF48@mail.pubhealth.ku.dk>

Please read the documentation for glm:

   method: the method to be used in fitting the model. The default
           method '"glm.fit"' uses iteratively reweighted least squares
           (IWLS).  The only current alternative is '"model.frame"'
           which returns the model frame and does no fitting.

so the error message is correctly reporting user error.

For a Poisson (and for a binomial), the default fitting method computes 
the MLEs.


On Tue, 18 Mar 2008, claire.saraux at gmail.com wrote:

> Full_Name: saraux
> Version: 2.6.1
> OS: Windows vista
> Submission from: (NULL) (193.157.180.37)
>
>
> I would like to compute a glm with a distribution of poisson, using a maximum of
> likelihood method. But it seems not to work with a distribution of poisson. The
> same code with another distrubution (binomial for example) works.

But your code is not reproducible.  Similar code does not work for me

> library(MASS)
> example(birthwt)
...
> glm(low ~ ., binomial, bwt, method="ML")
Error in switch(method, model.frame = return(mf), glm.fit = 1, 
stop("invalid 'method': ",  :
   invalid 'method': ML

> Here is the command I typed:
> nullrandmodel1<-glm(Arrival~(x+y),family=poisson,method='ML',data=dates)
>
> and here is the error message returned:
> Error in switch(method, model.frame = return(mf), glm.fit = 1, stop("invalid
> 'method': ",  :
>  invalid 'method': ML
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
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



[Rd] glm poisson, method='ML' (PR#10985)
ripley at stats.ox.ac.uk