Hello all, Can any of you R gurus help me out? I?m not all that great at stats to begin with, and I?m also learning the R ropes (former SAS user). Here?s what I need help with? I have a nested sample design and ran a nested anova, but I don?t know how to interpret the results habitat (four different types) is nested in site (three types), and site is nested in gear (two types) My code: pat2<-aov(catchrate~habitat/site/gear, data=pat) This created the following outcome: Df Sum Sq Mean Sq F value Pr(>F) habitat 3 2.932 0.9774 0.9543 0.4155656 habitat:site 8 18.716 2.3395 2.2842 0.0235207 habitat:site:Gear 12 39.244 3.2704 3.1930 0.0003546 Residuals 186 190.505 1.0242 What exactly does this outcome mean? It looks like there are differences between gears and sites, but not among habitats. Which gear is better, which site is better, which gear works better in each site, etc.? I?ve looked for some post hoc code to do this, but I can?t find anything and I am at wits end. Thanks, Rick M. -- View this message in context: http://r.789695.n4.nabble.com/nested-anova-tp3006469p3006469.html Sent from the R help mailing list archive at Nabble.com.
Hi Rick, Whenever I hear my instant association with post hoc and ANOVA would be ?TukeyHSD However, if you are not comfortable interpreting the model you ran, this suggests that you may benefit more from learning more statistical theory or finding someone to consult with who can help. You might also try graphing your data. Something like this would be one (of very many and not necessarily the best for your data) option: library(lattice) xyplot(catchrate ~ habitat | site, data = pat) xyplot(catchrate ~ site | Gear, data = pat) xyplot(catchrate ~ habitat | Gear, data = pat) I tend to prefer using regression and then either accepting the default contrasts or (if I have some theory/hypothesis) specifying my own contrast matrices and using those. However, it is not really feasible for members of this list to help you interpret your results or suggest appropriate statistical techniques without knowing your actual data. If you have specific questions related to R (e.g., "How can I calculate <some test or statistic>? Here is a representative, but small sample dataset."), you will get a lot more advice and help. Best regards, Josh On Thu, Oct 21, 2010 at 4:13 PM, mirick <mirick2 at yahoo.com> wrote:> > Hello all, > Can any of you R gurus help me out? ?I?m not all that great at stats to > begin with, and I?m also learning the R ropes (former SAS user). > Here?s what I need help with? ?I have a nested sample design and ran a > nested anova, but I don?t know how to interpret the results > habitat (four different types) is nested in site (three types), and site is > nested in gear (two types) > ?My ?code: ? ?pat2<-aov(catchrate~habitat/site/gear, data=pat) > This created the following outcome: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Df ? ? ? ? ? ? ? Sum Sq ? ? ? ? ? Mean Sq > F value ? ? ? ? ? ? ? ? ? ? ?Pr(>F) > habitat ? ? ? ? ? ? ? ? ? 3 ? ? ? ? ? ? ? ?2.932 ? ? ? ? ? ? ?0.9774 > 0.9543 ? ? ? ? ? ? ? 0.4155656 > habitat:site ? ? ? ? ? 8 ? ? ? ? ? ? ? ?18.716 ? ? ? ? ? ?2.3395 > 2.2842 ? ? ? ? ? ? ? ?0.0235207 > habitat:site:Gear ?12 ? ? ? ? ? ? 39.244 ? ? ? ? ? ?3.2704 > 3.1930 ? ? ? ? ? ? ? ?0.0003546 > Residuals ? ? ? ? ? ? ?186 190.505 ?1.0242 > > ?What exactly does this outcome mean? ? It looks like there are differences > between gears and sites, but not among habitats. ?Which gear is better, > which site is better, which gear works better in each site, etc.? > I?ve looked for some post hoc code to do this, but I can?t find anything and > I am at wits end. > Thanks, > Rick M. > > -- > View this message in context: http://r.789695.n4.nabble.com/nested-anova-tp3006469p3006469.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org 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. >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
Hi: On Thu, Oct 21, 2010 at 4:13 PM, mirick <mirick2@yahoo.com> wrote:> > Hello all, > Can any of you R gurus help me out? I’m not all that great at stats to > begin with, and I’m also learning the R ropes (former SAS user). >Sounds like you need a support group :)> Here’s what I need help with… I have a nested sample design and ran a > nested anova, but I don’t know how to interpret the results > habitat (four different types) is nested in site (three types), and site is > nested in gear (two types) > My code: pat2<-aov(catchrate~habitat/site/gear, data=pat) > This created the following outcome: > Df Sum Sq Mean Sq > F value Pr(>F) > habitat 3 2.932 0.9774 > 0.9543 0.4155656 > habitat:site 8 18.716 2.3395 > 2.2842 0.0235207 > habitat:site:Gear 12 39.244 3.2704 > 3.1930 0.0003546 > Residuals 186 190.505 1.0242 > > What exactly does this outcome mean? It looks like there are differences > between gears and sites, but not among habitats. Which gear is better, > which site is better, which gear works better in each site, etc.? > I’ve looked for some post hoc code to do this, but I can’t find anything > and > I am at wits end. > Thanks, > Rick M. > >Firstly, in a nested design, one often treats nested factors as random. You appear to want to treat them as fixed, which means that you are only interested in comparisons among the 24 habitats in your study, which are nested within the six sites which in turn are nested within the two types of gear. Is that correct? Secondly, the degrees of freedom allocation should clue you in that something is amiss, which would be your model specification. In R, nesting works top-down, so your model should be aov(catchrate ~ gear/site/habitat, data = pat) BTW, 186 df for residual? Do you have nine observations in each habitat? Are the data balanced within habitat (i.e., no missing data)? Your ANOVA should look like Gears 1 Gears/Sites 4 Gears/Sites/Habitat 18 if your description is correct. According to your ANOVA, you have 210 observations. If you had nine observations per habitat, there would be 216 observations total, so is it reasonable to conclude you either have missing responses or unbalanced data within habitat? If so, how severe is the imbalance? Thirdly, as far as multiple comparisons go, you need to be very careful to use the correct variance estimate at each level. However, it seems to me that comparisons would only make sense within level (assuming they make sense at all); e.g., comparing the four habitats in a particular site, and repeating the comparison for each site. I'd consider investing some time deriving the means and variances of each set of level means in the hierarchy. That should help sort out some of your questions. For example, there is only one comparison of gears, and the two gear means are obtained by averaging the 105 or so observations they each contain. This averages out site and habitat effects, so asking which gear works better in each site is an impossible question to answer since each site is associated with exactly one gear (by the definition of nested factors). You can compare the three sites within a particular gear, but you can't compare sites across both gears, because each site is associated with only one gear. Similarly, each habitat is associated with exactly one site, and hence one gear. This is what I mean when suggesting that you sit down and work out the algebra, to understand which effects can be compared and which can't, along with an understanding of how the variances of the means at each level of the hierarchy are derived and how they differ. HTH, Dennis> -- > View this message in context: > http://r.789695.n4.nabble.com/nested-anova-tp3006469p3006469.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org 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. >[[alternative HTML version deleted]]