Skip to content

Problem With Model.Tables Function

1 message · John Maindonald

#
Here is my assessment:
The following seems pertinent to making sense of 
the result from model.tables(,type="means").
As I see it, users should be warned off using
model.tables() with data from designs in which
treatments are not balanced over blocking factors.

df <- data.frame(bl=factor(c(1:4,1,2,4,1,2,3)),
 tr <- factor(rep(1:3,c(4,3,3))),
 y=c(10,12,9,11,13,15,16,18,22,17))

options(digits=4)
# First fit the block effect, unadjusted for treatments
blocks.aov <- aov(y~bl, data=df)
# Take residuals from these block effects
res <- residuals(blocks.aov)
# Fit treatment effects to these residuals
res.aov <- aov(res~df$tr)
b <- summary.lm(res.aov)$coef

# EITHER (1)
# Add overall mean to the fitted treatment effects
# NB: The residuals above summed to 1.  So the average of
# the fitted treatment effects is zero.
df$tr2 df$tr3 
 10.68  14.47  18.97
Tables of means
Grand mean
    
14.3 

 bl 
        1     2  3    4
    13.67 16.33 13 13.5
rep  3.00  3.00  2  2.0

 tr 
        1     2     3
    10.68 14.47 18.97
rep  4.00  3.00  3.00

# OR (2)
df$tr2  df$tr3 
-3.6250  0.1667  4.6667
----------------------------------------------------------

The objection to the treatment effects from model.tables()
is that they are based on deviations from block means that 
have not been adjusted to allow for the different relative 
numbers of the different treatments in those blocks.
The effect can be severe when different blocks have greatly
different relative numbers of different treatments.
Thus model.tables() should not be used even for balanced 
incomplete block designs.

# Choices that are defendable include:
tr1   tr2       
10.16 13.67 19.07
tr1   tr2       
10.50 14.01 19.41

        
Brian Ripley, responding to Gary Whysong, wrote:

            
. .
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._