[R] Error using glm with poisson family and identity link

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 25 16:41:54 CET 2004


On Thu, 25 Nov 2004, Federico Gherardini wrote:

> Hi all
> I'm trying to use the function glm from the MASS package to do the following

It's in the stats package.

> fit.
>
> fit <- glm(FP ~ rand, data = tab, family = poisson(link = "identity"), subset 
> = rand >= 1)
> (FP is >= 0)
>
> but I get the following error
>
> Error: no valid set of coefficients has been found:please supply starting 
> values
> In addition: Warning message:
> NaNs produced in: log(x)

And did you follow the advice in the error message?

> in contrast if I fit a model without intercept
>
> fit <- glm(FP ~ rand - 1, data = tab, family = poisson(link = "identity"), 
> subset = rand >= 1)
>
> everything goes fine.
> Now my guess is that the points "naturally" have a negative intercept so the 
> error is produced because I'm using the poisson distribution for the y and 
> negative values are of course not admitted. Am I right?

We don't have your data, but it is plausible.

> Also if this is the cause, shouldn't the function always try to do the best 
> fit given the parameters? I mean shouldn't it fit a model with intercept 0 
> anyway and report it as a bad fit?

Well, I believe functions should do what they say on the box (and the help 
page), and not what some user hopes they might do by mind-reading.

You do have a suitable set of starting values from the second fit, so why 
not just follow the rather explicit advice?

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