[R] residuals with missing values

ivo welch ivo.welch at yale.edu
Sun Mar 28 18:25:26 CEST 2004


hi:  sorry to bother you all again.  I am running a simple lm(y~x+z) 
regression, in which some of the observations are missing.  
Unfortunately, the residuals vector from the lm object omits all the 
missing values, which means that I cannot simply do residual diagnostics 
(e.g., plot(y,x)).  Would it not make more sense to have the residuals 
propagate the missing values, so that the residuals are guaranteed to 
have the same length as the variables?   Alternatively, maybe the 
residuals() function could do this instead.  But the documentation is 
not clear:

     Methods can make use of 'naresid' methods to compensate for the
     omission of missing values.  The default method does.

How?  I have figured out how to write my own function to do what I need 
(using the names of the residuals object), so this is more a "how to 
properly do this?" question, and/or "suggestion for improved 
documentation" than it is a desparate need of mine.

sincerely,  /iaw




More information about the R-help mailing list