Consider the following example:

x <- c(2,4,3,6)
y <- c(4,9,5,10)
z <- factor(c(1,1,2,2))
summary(lm("y ~ x + z"))

The above works fine.

Suppose I change z so that
x <- c(2,4,3,6)
y <- c(4,9,5,10)
z <- factor(c(1,1,2,NA))
summary(lm("y ~ x + z"))

the last row/observation is not considered in the regression. I would like this 
to be treated as z with two levels "1" and "2" which are both in the regression 
model (rather than dropping one of them which would be the case in the first 
example). The last row would have 0 for z1 and z2.  How can that be achieved?  
THANKS.

______________________________________________
R-help@r-project.org 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.

Reply via email to