[R] model.tables

John Maindonald john.maindonald at anu.edu.au
Tue Nov 30 23:52:13 CET 1999


At 08:02 30/11/99 +0000, Prof Brian D Ripley wrote:
>On Tue, 30 Nov 1999, spoon <spoon at hilbert.maths.utas.edu.au> wrote:
>
>> Hi,
>> 	Is this a bug or do I just not understand model.tables?
>> 
>> The problem is this: in the following, shouldn't the difference in
>> means computed by model.tables be equal to the difference in the
>> corresponding coefficients from coef(fit)?  That is, comparing diets
>> d and e shouldn't
>> 
>> 34.71 - 41.53 = -6.82			# diff from model.tables
>> 
>> be equal to
>> 
>> -5.22500000  - 3.30000000 = -8.525	# diff from coef(fit)
>> 
>> Or am I just completely misinterpreting something basic?
>
>Basically, yes. This is an incompletely replicated design, and d and e
>occur on different litters.
>
>The results are identical to the S-PLUS original. I think you are
>probably looking for what dummy.coef gives you.
>
>-- 
>Brian D. Ripley,                  ripley at stats.ox.ac.uk
>Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>University of Oxford,             Tel:  +44 1865 272861 (self)
>1 South Parks Road,                     +44 1865 272860 (secr)
>Oxford OX1 3TG, UK                Fax:  +44 1865 272595

So what is it that model.tables() gives?  S-PLUS says they are
estimates.  Of what?   These are not the marginal means of the
fitted values, ignoring other factors.  Do they mean anything
at all?  The issue of unbalance does not arise here.

Here is about the simplest example I could dream up.

> bdes_data.frame(blk=rep(1:3,rep(2,3)),
+   trt=c(1,2,2,3,3,1), y=c(.4,.6,1,1.4,2,1.2))
> bdes$blk_factor(bdes$blk,labels=LETTERS[1:3])
> bdes$trt_factor(bdes$trt,labels=letters[1:3])
> bdes.aov_aov(y~blk+trt,data=bdes,projections=T)
> 
> coef(bdes.aov)
(Intercept)        blkB        blkC        trtb        trtc 
    0.36667     0.33333     0.86667     0.26667     0.73333 
> model.tables(bdes.aov)
Tables of effects

 blk 
   A    B    C 
-0.6  0.1  0.5 

 trt 
    a     b     c 
-0.25 -0.05  0.30 
> hat_fitted(bdes.aov)
> tapply(hat,bdes$trt,mean)
  a   b   c 
0.8 0.8 1.7 
> 


John Maindonald               email : john.maindonald at anu.edu.au        
Statistical Consulting Unit,  phone : (6249)3998        
c/o CMA, SMS,                 fax   : (6249)5549  
John Dedman Mathematical Sciences Building
Australian National University
Canberra ACT 0200
Australia

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list