Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: Re: st: SP/RM[1,2] EMS

Subject   Re: Re: st: SP/RM[1,2] EMS
Date   Fri, 22 Aug 2003 17:48:22 -0500

David Airey <> asks:

> I guess I would have expected the command syntax to then be:
> . anova score noise/subject|noise period/period*subject|noise
> noise*period/perio
>  > d*subject|noise dial/dial*subject|noise noise*dial/dial*subject|noise
> period*d
>  > ial noise*period*dial, repeated(period dial)
> repeated term
> r(141);
> which fails,
> rather than:
> . anova score noise / subject|noise period noise*period /
> period*subject|noise
>    dial noise*dial / dial*subject|noise period*dial noise*period*dial ,
>    repeated(period dial)
> I thought when a term did not specify the denominator, the residual was
> used. In the latter command, the terms period and dial are listed
> without a denominator so I thought they were using the residual. But
> when I look at the output, it's clear they are using a different (and
> correct) denominator. What am I not understanding in telling or not
> telling Stata what I want?

And then David says:

> OK.
> Now I think I understand the syntax, and why Ken's command does what it 
> correctly does. All terms prior to the slash without specified 
> denominators are tested with the term after the slash. This is a little 
> cryptic and depends on correctly grouping terms tested with the same 
> denominator when issuing an ANOVA command. But it makes sense once you 
> see it. I think the slash is like a shorthand for the lines used to 
> separate the ANOVA tables
> ANOVA y a b c/d tests each of a, b, and c, over d.
> ANOVA y a/ b c/d tests a over error, and b and c over d
> ANOVA y a/d b/d c/d is disallowed syntax
> Right?

"[R] anova" page 43 (Version 8 manual) discusses the "/"

I admit that there may be better ways to word that discussion.
If anyone has some candidate better wording, send it my way.  I
had hoped that the various nested and mixed models that followed
in "[R] anova" would have been enough to clarify.

For your 3 examples above:

> ANOVA y a b c/d tests each of a, b, and c, over d.


> ANOVA y a/ b c/d tests a over error, and b and c over d

No.  a is tested by b.  b is not tested.  c is tested by d.

> ANOVA y a/d b/d c/d is disallowed syntax

It is disallowed because the term "d" appears multiple times in
the model, not because of the slashes.

First and foremost the -anova- command is supposed to indicate
which terms are in the model.  Secondarily, the "/" notation is
helpful in getting many (often all) of the tests of interest when
the model is written in standard order.

You can get any other tests you want using -test-.  When you test
terms you can use the "/" to indicate the error term.  See the
examples on pages 60-62 of "[R] anova".

For an example of this in a complicated ANOVA see

which is one example in a large FAQ filled with examples.  In
this case, the "/" in -anova- obtained all but 3 of the tests of
interest.  The -test- command using "/" was used to get those 3.

The -anova- command that was typed for that example was:

  anova res A / G|A B B*A / B*G|A / S|B*G|A C C*A / C*G|A C*B C*B*A /
  C*B*G|A / C*S|B*G|A D D*A / D*G|A D*B D*B*A / D*B*G|A / D*S|B*G|A D*C
  D*C*A / D*C*G|A D*C*B D*C*B*A / D*C*B*G|A / , repeated(C D)

Imagine if instead of using the current "/" notation you had to
specify the error term for each instance.  It would be even more
complicated, and I contend even harder to understand.

One approach, if you dislike the "/" notation in -anova- is to
not use the "/", and instead do all tests of interest using the
-test- command after -anova-.  That way, one by one you can
specify the term to be tested and the error term for that test.

Once you get used to the "/" notation, I am betting you will want
to use it again.

Ken Higbee
StataCorp     1-800-STATAPC

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index