[R] residuals() with missing data, alignment to original data set

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Tue Jan 14 18:41:03 CET 2003


na.action=na.exclude does this.

On Tue, 14 Jan 2003 klaus.thul at infineon.com wrote:

> Hello, 
> 
> I have a data frame and want to do the following.
> 
> Do a regression of one variable versus another:
> 
> 	fit <- lm(a ~ b)
> 
> Then I would like to plot the residuals of this fit versus a third variable:
> 
> 	bwplot(residuals(fit) ~ group)
> 
> This fails, if a or b contain NAs, because the data in the residuals() -
> vector are not aligned anymore to the data in the original data frame.
> 
> Is there a way to solve this issue?
> 
> Regards and thanks for your help
> Klaus
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list