An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130105/7c279296/attachment-0001.pl>
nested, unbalanced anova
5 messages · Pfeiffer, Steven, Spencer Graves, Peter Dalgaard +1 more
On Jan 6, 2013, at 04:00 , Pfeiffer, Steven wrote:
Hello, For an experiment, I selected plots of land within a forest either with honeysuckle or without honeysuckle. Thus, my main factor is fixed, with 2 levels: "honeysuckle present"(n=11) and "honeysuckle absent"(n=8). Within each plot of land, I have a "trenched" subplot and an "untrenched" subplot. Within each subplot of every plot, I measured soil moisture. Now I need to do a nested Anova to compare the soil moisture values between treatments. I don't really want to discard some data to make the sample sizes balanced. Does anyone know how to do a nested, unbalanced Anova in R?
As far as I can tell, this is still an orthogonal design, so just proceed as usual. You're not in real trouble unless you have plots with one of the subplots missing. The whole thing will boil down to an analysis of the within-plot differences. Just avoid things like Type-III sums of squares (base R won't do them, but popular add-ons will) because they get it wrong when cell counts are unequal.
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
On 1/6/2013 12:45 AM, peter dalgaard wrote:
On Jan 6, 2013, at 04:00 , Pfeiffer, Steven wrote:
Hello, For an experiment, I selected plots of land within a forest either with honeysuckle or without honeysuckle. Thus, my main factor is fixed, with 2 levels: "honeysuckle present"(n=11) and "honeysuckle absent"(n=8). Within each plot of land, I have a "trenched" subplot and an "untrenched" subplot. Within each subplot of every plot, I measured soil moisture. Now I need to do a nested Anova to compare the soil moisture values between treatments. I don't really want to discard some data to make the sample sizes balanced. Does anyone know how to do a nested, unbalanced Anova in R?
As far as I can tell, this is still an orthogonal design, so just proceed as usual. You're not in real trouble unless you have plots with one of the subplots missing. The whole thing will boil down to an analysis of the within-plot differences. Just avoid things like Type-III sums of squares (base R won't do them, but popular add-ons will) because they get it wrong when cell counts are unequal.
Plot is a random effect. Honysuckle, trenched, and moisture are
fixed. You may also wish to consider using either the nlme or lme4
packages, though they may not be needed "unless you have plots with one
of the subplots missing", as Prof. Dalgaard indicated. Pinhiero and
Bates (2000) Mixed-Effects Modeling in S and S-Plus (Springer) is the
best book I know on the subject. The nlme package contains script files
with names like ch01.R containing R code to work all the examples in the
book; system.file('scripts', package='nlme') will give you the full
path to where it is installed. These are necessary, because the R
implementation contains a very few subtle changes from what is in the
book. There is also an r-sig-mixed-models at r-project.org email list that
may interest you. I have not used this in years, and I would expect
that people on this email list could help you with more current
information on what's available.
Hope this helps.
Spencer Graves
On Jan 6, 2013, at 09:45 , peter dalgaard wrote:
Just avoid things like Type-III sums of squares (base R won't do them, but popular add-ons will) because they get it wrong when cell counts are unequal.
That might be a bit unfair. Type-III methodology has its proponents, I'm just not one of them. Within their own logic, I'm sure Type-III SS are computed correctly. It's just that this is one of the cases where you can be misled into thinking that the design is orthogonal so Type-III and Type-II is the same. It isn't.
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Dear Peter, Thank you for the clarification, since one (I hope) popular add-on that computes type-II and -III tests for repeated-measures designs is the Anova() function in the car package. The type-II tests are, in my opinion, preferable, because they are maximally powerful, e.g., for main effects when the interactions to which the main effects are marginal are zero in the population (the situation in which a main effect test is typically of interest), but I'd argue (not here, because it would take more space than is reasonable in an email), that the type-III tests test reasonably interpretable hypotheses. Steven: A forthcoming paper in the R Journal, available as a preprint at <http://journal.r-project.org/accepted/2012-02/Fox+Friendly+Weisberg.pdf>, explains how to use the Anova() and linearHypothesis() functions in the car package for univariate and multivariate tests in repeated-measures designs. The paper doesn't, however, try to clarify the distinctions among "type-I," "II," and "III" tests. Best, John ----------------------------------------------- John Fox Senator McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of peter dalgaard Sent: Sunday, January 06, 2013 1:56 PM To: peter dalgaard Cc: r-help at r-project.org Subject: Re: [R] nested, unbalanced anova On Jan 6, 2013, at 09:45 , peter dalgaard wrote:
Just avoid things like Type-III sums of squares (base R won't do them,
but popular add-ons will) because they get it wrong when cell counts are unequal. That might be a bit unfair. Type-III methodology has its proponents, I'm just not one of them. Within their own logic, I'm sure Type-III SS are computed correctly. It's just that this is one of the cases where you can be misled into thinking that the design is orthogonal so Type-III and Type-II is the same. It isn't. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.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.