Skip to content
Prev 139594 / 398506 Next

Anova

On Sat, 2008-03-15 at 12:48 -0500, daniel jupiter wrote:
if obj is the result of anova, aov, oneway.test, then

str(obj) ## for anova
str(summary(obj)) ## for aov
str(obj) ## for oneway.test

to find the names of the elements of obj that contain the p-values of
the various tests/models. In the first two you are looking for the
component "Pr(>F)" and the latter is obvious ("p.value")

For summary(aov) objects, the result is a list so this gets the p-value
you need:

obj[[1]]$`Pr(>F)` or obj[[1]][,5]]

for anova then this:

obj$`Pr(>F)` or obj[,5]

note the quoting of the component name using backticks.

For oneway.test

obj$p.value
?TukeyHSD for the results of aov
See ?lme in package nlme
I'm not sure what the problem is here - you don't say. All of what I say
above is documented in the relevant help pages for the various functions
and using str() is a basic tenet of using R and looking at returned
objects.

Ok, you might have needed help with getting the p-values for some of
those tests/models, but 2) and 3) are answered on ?aov

For what you describe, stick with aov for balanced designs if you want
to do TukeyHSD as there is a method for aov objects (otherwise) you'll
need to refit the model.

For unbalanced designs, check out lme and for that you may need to
get/borrow the book by Pinhiero and Bates, reference details of which
are given in item [7] on:

http://www.r-project.org/doc/bib/R-books.html
HTH

G