Re: [R] NA-handling in glm.fit?

From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>
Date: Fri 13 Oct 2006 - 12:20:32 GMT

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/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sat Oct 14 10:26:24 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 14 Oct 2006 - 00:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.