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