[R] Trouble phrasing an R command that will run the model i need (ANOVA, nes
John Vokey
vokey at uleth.ca
Sun Mar 26 05:46:32 CEST 2006
David,
Assuming I understand your design, the analysis should be
straightforward (except for the possible unbalanced aspects). The
summary() method for aov is usually quite good at detecting nesting,
and constructing the correct SS, as long as all of the factors in
your data frame are correctly as.factor(), so you shouldn't have to
bother with the ``%in%'' statements in the model formula.
Presumably, none of the factors are random sources, so the only
random variability is associated with crosses (i.e., observations).
Hence, the correct error term for all effects is the type I residual
(the within-cells variance). So, summary(aov
(yproductivity~foresttype*region*crosstype*experiment*linelabel))
should give you what you want (except it returns type I SS, so if
your design is horribly unbalanced, the results will be misleading).
On 25-Mar-06, at 4:00 AM, r-help-request at stat.math.ethz.ch wrote:
> Hi John,
>
> Thank-you very much for replying, - in answer to your questions:
>
> *"As I understand what you wrote, all factors but linelabel are
> crossed,
> with linelabel nested within all the other factors?"
>
> That's exactly it,
>
> *" What is in the highest order cells? Single observations, or
> multiple
> scores?"
>
> I would say "single observations" - but i have to confess I'm not
> entirely
> sure what you mean by "multiple scores".
>
> Any one data point refers to a single animal (an individual fly, to be
> exact) giving a single value for a response variable, and having a
> single
> state with respect to each factor. One of my datasets involves crosses
> rather than flies, but it's the same set-up for them: each
> individual cross
> only gives one value for a response variable, and has one state
> with respect
> to each factor.
>
> Just in the interests of clarifying things as much as possible: one
> of my
> datasets looks like this(apologies if the formatting gets weird):
>
> foresttype region crosstype experiment linelabel yproductivity
> l g wx 1 al1
> 63
> l g wx 1 al2
> 26
> ... and so on.
>
> Each horizontal line refers to a single observation. The first
> horizontal
> line, for example, refers to a single cross that was found to have a
> yproductivity value of "63", and that cross happened to be in the "l"
> foresttype, the "g" region, it was crosstype "wx", in experiment
> "1", and of
> linelabel "al1". And any one cross only appears once in the
> dataset, so each
> horizontal line refers to a distinct cross, about which a single
> observation
> has been made.
>
> Is that the kind of information you were looking for?
>
> - David
--
Please avoid sending me Word or PowerPoint attachments.
See <http://www.gnu.org/philosophy/no-word-attachments.html>
-Dr. John R. Vokey
More information about the R-help
mailing list