[R] Specifying an appropriate error term in a hierarchical regression

Chris Bergstresser chris at subtlety.com
Tue Apr 18 19:34:21 CEST 2006

On 17 Apr 2006 23:55:14 +0200, Peter Dalgaard <p.dalgaard at biostat.ku.dk> wrote:
> Confusing nesting and nesting...
> The / operator is designed to handle cases like this
> a b
> 1 1
> 1 2
> 2 1
> 2 2
> in which the numbering of b only makes sense within a - no connection
> between b=1 when a=1 and when a=2 (think group1, member1). In this
> case, the interaction a:b makes sense, but a main effect of b does
> not.

   This makes sense.  It sounds like there's no need for the "/"
operator, assuming the factors are numbered appropriately.  Is this

> It is not clear to me what B(A) is supposed to mean in Kirk's
> terminology. Sounds like it could be the total sum of squares for the
> b stratum, which is the effect of b ignoring a (?).

    SSB(A), as Kirk defines it, is "the pooled simple main effects of
treatment B at each level of treatment A".  Or [AB] - [A], if you

   I suppose my primary problem is specifying a different denominator
for each level of the F test in the ANOVA.  I can specify an overall
error term (using "Error" in the model specification) but for the
example in the book the F-test for factor A is MSA/MSB(A), while the
F-test for factor B(A) is MSB(A)/MSerror.
   It doesn't seem like it's possible to do this using a single "aov"
command; I have to run it once with each appropriate error term or do
the F-test by hand.  That can't be right, can it?

-- Chris

More information about the R-help mailing list