[R] plotting residuals

Martin Maechler maechler at stat.math.ethz.ch
Sat Nov 4 11:10:40 CET 2006


>>>>> "Jeff" == Jeff Miller <jeffmiller at adsam.com>
>>>>>     on Fri, 3 Nov 2006 19:16:20 -0500 writes:

    Jeff> Does anyone know how to obtain a plot of residuals by
    Jeff> predicted values for a main-effects aov?

You didn't give a reproducible example, but plot()
[via plot.lm()] will do this {and more by default} :

E.g
  > example(aov, echo = FALSE )
  > summary(npkM <- update(npk.aov, . ~ N+P+K))
	      Df Sum Sq Mean Sq F value  Pr(>F)  
  N            1 189.28  189.28  6.4880 0.01919 *
  P            1   8.40    8.40  0.2880 0.59743  
  K            1  95.20   95.20  3.2632 0.08592 .
  Residuals   20 583.48   29.17                  
  ---
  Signif. codes:  0 $,1rx(B***$,1ry(B 0.001 $,1rx(B**$,1ry(B 0.01 $,1rx(B*$,1ry(B 0.05 $,1rx(B.$,1ry(B 0.1 $,1rx(B $,1ry(B 1 

  > plot(npkM)  ## the first plot is "yours"

  > plot(npkM, which=1) # does only "your" plot


The plot is called Tukey-Anscombe plot, and there's also a
bell-and-whistle version of it, TA.plot() in package 'sfsmisc'
(with a longer history than R's plot.lm() !)

    Jeff> I want to check that the residuals are distributed
    Jeff> equally across treatment means.
 
    Jeff> Thanks,

    Jeff> Jeff
 
    Jeff> 	[[alternative HTML version deleted]]
		^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
		wouldn't have appeared had you followed the
		posting guide

    Jeff> ______________________________________________
    Jeff> R-help at stat.math.ethz.ch mailing list
    Jeff> https://stat.ethz.ch/mailman/listinfo/r-help

    Jeff> PLEASE do read the posting guide
	  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Jeff> http://www.R-project.org/posting-guide.html and
	  
    Jeff> provide commented, minimal, self-contained,
    Jeff> reproducible code.



More information about the R-help mailing list