From: Michael D. Rennie <mrennie_at_utm.utoronto.ca>

Date: Thu 05 Apr 2007 - 18:58:35 GMT

Date: Thu 05 Apr 2007 - 18:58:35 GMT

Hi, there

Sorry- I excluded some example code in the haste of my original e-mail. Please find it included below. Note, however, that the elements in the list in the summary output appear to be the anova tables themselves- what I need to do is get inside the anova tables (execute the code below to see what I mean...)

Thanks again,

Mike

#example code to illustrate my inability to get at a mean square in
anova output from

# models of the form summary(aov(y ~ x1 + Error(x1/x2)))

y<-rnorm(30,10) x1<-rep(1:2, each=15) x2<-rep(1:3, each=1, times=10)

dat<-data.frame(y, x1, x2)

dat

ex.aov<-aov(y ~ x1 + Error(x1/x2))

ex.sum<-summary(ex.aov)

ex.sum

#gets you the first list in the element, which is anova output for x1 caluclated with nested factor x2 in x1

ex.sum[1]

ex.sum[1]$Error #this is equivalent to...

ex.sum[[1]]

# since ex.sum is a list composed of anova tables, apparently the
element in the list

#is the anova table itself. The question is, how do you get at the
elements in each table

#(i.e., Mean Square?)

Prof Brian Ripley wrote:

> The output is of class "summary.anovalist" so (hint, hint) it is a list.

*>
**> Try [[ ]] to get list elements.
**>
**> Without a reproducible example (see the footer and the posting guide)
**> it is not possible to show you working code.
**>
**>
**> On Thu, 5 Apr 2007, Michael D. Rennie wrote:
**>
**>>
**>> Hi, there
**>>
**>> I'm trying to get the value of the Mean Square from the ANOVA model
**>> summary that comes from specifying the error term, and am wondering
**>> if one can actually do this ( I know it's possible when using
**>> anova(lm) objects and the like, but I'm having a tough time with it
**>> under this framework). There does appear to be some indexing in the
**>> output of this type, but perhaps not enough to obtain single values?
**>> Here's what I've been able to do so far with some example code:
**>>
**>>> density.aov<-aov(density ~ substrate + Error(substrate/tile))
**>>>
**>>> anov1<-(summary(density.aov))
**>>> print(anov1)
**>>
**>> Error: substrate
**>> Df Sum Sq Mean Sq
**>> substrate 2 1282.4 641.2
**>>
**>> Error: substrate:tile
**>> Df Sum Sq Mean Sq F value Pr(>F)
**>> Residuals 27 225.700 8.359 Error: Within
**>> Df Sum Sq Mean Sq F value Pr(>F)
**>> Residuals 60 640.00 10.67
**>>> anov1[1]
**>> $`Error: substrate`
**>> Df Sum Sq Mean Sq
**>> substrate 2 1282.4 641.2
**>>
**>>> anov1[2]
**>> $`Error: substrate:tile`
**>> Df Sum Sq Mean Sq F value Pr(>F)
**>> Residuals 27 225.700 8.359 And, I can get
**>>
**>>> anov1[1]$Error
**>> Df Sum Sq Mean Sq
**>> substrate 2 1282.4 641.2
**>>
**>> a<-anov1[1]$Error
**>>
**>> and then tried to get at elements in that, trying things like
**>>
**>> a$Mean
**>>
**>> or
**>>
**>> a[,2]
**>>
**>> but all return
**>>
**>> Error: incorrect number of dimensions
**>>
**>> probably because
**>>
**>>> length(a)
**>> [1] 1
**>>
**>> Does anyone have any reccomendations on how to go any further here?
**>>
**>> Cheers,
**>>
**>> Mike
**>>
**>>
**>
*

-- Michael D. Rennie Ph.D. Candidate University of Toronto at Mississauga 3359 Missisagua Rd. N. Mississauga, ON L5L 1C6 Ph: 905-828-5452 Fax: 905-828-3792 www.utm.utoronto.ca/~w3rennieReceived on Fri Apr 06 05:16:25 2007______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 05 Apr 2007 - 22:30:55 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*