[R] NA handling with lm

From: Andreas Cordes <andreas.cordes_at_stud.uni-goettingen.de>
Date: Fri 29 Jul 2005 - 02:44:37 EST


Hi,
I have a problem that is hopefully easily solvable, but I dont find the clue in the documentation. I am examining a linear model. One of the variables has NA values. Even though na.action=na.omit, i get NA as results for this variable. Can I use lm in such a case to get estimates? Or do I have to do some form of imputation before doing so? Here is the call and the results, hope you can help. Best regards,
Andreas



lm(formula = ESSIK ~ ALTER + as.factor(S2) + as.factor(S15A) +
    as.factor(S8) + as.factor(LAND) + as.factor(S18B) + as.factor(BERUF) +
    as.factor(KIRCHE) + as.factor(H_EINKOM) + as.factor(PARTNERS),
    na.action = na.omit)

Residuals:
     Min       1Q   Median       3Q      Max

-17.0675 -2.0151 0.4267 2.7644 9.7333

Coefficients: (2 not defined because of singularities)

                      Estimate Std. Error t value Pr(>|t|)   
(Intercept)          23.755915   1.844110  12.882  < 2e-16 ***
[...]
as.factor(BERUF)7    -1.236836   0.701323  -1.764 0.077942 . 
as.factor(KIRCHE)1   -0.811751   0.237699  -3.415 0.000649 ***
as.factor(H_EINKOM)2        NA         NA      NA       NA   
as.factor(H_EINKOM)3        NA         NA      NA       NA   
as.factor(PARTNERS)1 2.057070 0.342546 6.005 2.23e-09 ***

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 Received on Fri Jul 29 02:52:32 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:07 EST