[R] NA handling with lm

Andreas Cordes andreas.cordes at stud.uni-goettingen.de
Thu Jul 28 18:44:37 CEST 2005


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




More information about the R-help mailing list