s-news
[Top] [All Lists]

na.action and AIC. exclude or omit?

To: s-news@lists.biostat.wustl.edu
Subject: na.action and AIC. exclude or omit?
From: Henrik Parn <parn@nt.ntnu.no>
Date: Wed, 26 Jan 2005 13:43:37 +0100
Reply-to: parn@nt.ntnu.no
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113
|Dear S plus users,

||I want to calculate AIC on a linear regression model. ||The data set has some NAs in the response variable 'yy' and some NAs in the predictor 'x'. Therefor, as I normally do when I have NAs, I used na.action=na.exclude in the formula:
> AIC(lm(yy ~ x, data=datasett, na.action=na.exclude))

However, the answer is:
[1] NA

Since the s-plus help says '|the na.omit and na.exclude functions return the same data frame' I didn't consider my choice of na.action as the cause of my problem. However at last (after desperately trying ALL other possible and impossible ways) I tried na.omit, and voilà:

|> AIC(lm(yy ~ x, data=datasett, na.action=na.omit))
[1] 21.68606

So I wonder, is my 'only' problem here that na.exclude and na.omit aren't really interchangeable, or could it be something else going on?

Thanks for your help!

Henrik
|
| |

--
************************
Henrik Pärn
Department of Biology
NTNU
7491 Trondheim
Norway

+47 735 96282 (office)
+47 909 89 255 (mobile)
+47 735 96100 (fax)
************************


<Prev in Thread] Current Thread [Next in Thread>