I'm not sure what to do with model.matrix, but you might look at some of the code for ols in the rms package. The rms package (from frank harrell), has several options for keeping the NAs in the output from regression models so that residuals are correctly aligned.
hth david freedman -- View this message in context: http://r.789695.n4.nabble.com/help-wiht-model-matrix-how-to-keep-missing-values-tp2072248p2073573.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.