[R] NA-handling in glm.fit?

Gavin Simpson gavin.simpson at ucl.ac.uk
Fri Oct 13 14:20:32 CEST 2006


On Fri, 2006-10-13 at 12:51 +0200, Fredrik Thuring wrote:
> 
> Dear Sir or Madam,
> 
> I'm wondering if there is any routine or argument in the function 'glm.fit'
> that makes it handle NA's. The function 'glm' can handle NA's but I can't
> make make it work (or find anything written on this in the help files) with
> 'glm.fit'.
> Is it even possible in'glm.fit'? How?
> 
> Thanks before hand,
> Fredrik Thuring, Business Researcher

glm() deals with NAs etc via the na.action argument, which is missing
from glm.fit. glm is a wrapper around glm.fit, so look at the code of
glm and see how it handles NAs when generating the x and y arguments
that go into glm.fit.

You should also look at ?glm which points to ?na.omit and look at
options("na.action") to set what your setting is currently. You'll
probably want to run na.omit or na.exlude on a combination of the
response and predictor matrix (the arguments you are passing as x and y
to glm.fit) to remove incomplete cases.

HTH

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson                 [t] +44 (0)20 7679 0522
 ECRC & ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/cv/
 London, UK. WC1E 6BT.         [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list