From sw283 at maths.bath.ac.uk  Wed Jul 25 21:10:18 2007
From: sw283 at maths.bath.ac.uk (Simon Wood)
Date: Wed, 25 Jul 2007 20:10:18 +0100 (BST)
Subject: [Rd] glm(...,quasi(link="logit")) problem?
In-Reply-To: <mailman.9.1185357603.25185.r-devel@r-project.org>
References: <mailman.9.1185357603.25185.r-devel@r-project.org>
Message-ID: <Pine.LNX.4.64.0707251937370.9819@archer.maths.bath.ac.uk>

There may be a good reason for this, but under R 2.5.1 (Windows XP, Suse 
Linux)

> glm(c(0,.5)~1,quasi(link=logit))
Error: NA/NaN/Inf in foreign function call (arg 4)

whereas the same code works under R 2.1.1.

The problem (in 2.5.1) is a -Inf in the pseudodata `z' in glm.fit, as a 
result of a `-Inf' in eta, which is in turn generated by `mustart <- y' and 
`logit(mustart)'. In 2.1.1 the line `mustart <- y + 0.1 * (y == 0)' is 
what avoids the problem.

A possible fix might be to set elements of `good' to FALSE for non-finite 
`eta', for the first fit iteration only, of course. Is it worth fixing? I 
found this after  someone reported a problem with mgcv::gamm (which 
calls MASS:glmmPQL which calls glm), which is why I'm not just supplying 
my own mustart and getting on with it...

best,
Simon


>- Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY
>-             +44 (0)1225 386603         www.maths.bath.ac.uk/~sw283/



[Rd] glm(...,quasi(link="logit")) problem?
Simon Wood