So... I'm looking at an example in a book that goes something like this:
library(daewr)
mod1 <- aov(height ~ time, data=bread)
summary(mod1)
...
par(mfrow=c(2,2))
plot(mod1, which=5)
plot(mod1, which=1)
plot(mod1, which=2)
plot(residuals(mod1) ~ loaf, main="Residuals vs Exp. Units", font.main=1, data=bread)
abline(h = 0, lty = 2)
That all works... but the text is a little vague about the purpose of the parameter 'which='. I dug around in the help (in Rstudio) on plot() and par(), looked around online... found some references to a different 'which()'... but nothing really referring me to the purpose/syntax for the parameter 'which=' inside plot().
A bit later (next page, figures) I found a mention of using names(mod1)
to view the list of quantities calculated by aov
... which I presume is what which= is refering to, i.e. which item in the list to plot where in the 2x2 matrix of plots. Yay. Now where the heck is that buried in the docs?!?
class(mod1)
and then search for the appropriate method in eithermethods(thatclass)
or showMethods(class="thatclass"). Then read the help page for the function. Or perhaps just do this:help(plot, pack=daewr)
– Claranceclass(mod1)
returns "aov" "lm".methods(lm)
andmethods(aov)
didn't pan out.showMethods()
for either didn't work, just complained that they weren't S4 generic functions.methods(lm)
yielded something, but not quite.methods(plot)
yielded another list... includingplot.lm
.help(plot.lm)
yielded the answer I was looking for. Kind of a round-about way of finding what seems like it should have been a lot easier... but it worked. Thanks! – Earnestmethods(plot)
and see nothing for 'plot.aov' and do see a 'plot.lm' (perhaps with an asterisk after it if it is not "exported"), then you know that themod1
-object will be given to a function actually namedplot.lm
. So type?plot.lm
at the console and your question will be answered. – Claranceplot.default
and could not find the listing of thewhich
parameter on the help page. At the top of theplot.lm
help page is a listing of the six plots returned byplot.lm
and thenwhich
is described as a vector containing one or more of the numbers corresponding to those descriptions. Further details are in the Details section. It's unclear what more is needed. – Clarance