[R] ANCOVA with defined error terms

Richard M. Heiberger rmh at temple.edu
Mon Aug 24 03:54:39 CEST 2009


Ok, now we can talk.

1. covariates: coon

Your model specification put coon sequentially last, effectively testing
the hypothesis that the slope associated with coon, after
adjusting for all the factors, is zero.

My model place coon sequentially first, effectively testing the
hypotheses that the factors are significant after adjusting to a common
level of coon.

Which of those is appropriate for your study is something for
you, as subject-matter investigator, to determine.  It is not a
computational question.

That is the only difference between your specification and mine.
As you can see, the degrees of freedom and Within stratum
residuals sums of squares are the same for both specifications.

The block:plot Residual in your specification is the same as the
block:veget:fruit SumSq in mine.


2.  Error() model is singular

The error model block/plot expands to block + block:plot
This model specifies 2 + 33 degrees of freedom.

There are only 9 df in the block:plot stratum.

Probably block does not belong in the treatment model at all,
it should appear in only the Error model.


3. The next obvious model to attempt is

nextmodel <- aov(mice ~ coon + veget*fruit*time + Error(block/plot),
                  data = track)
summary(nextmodel)

This also shows a singular Error().  We look at the data and see that
plot is identical to the three-way veget:fruit:block interaction.


4. Therefore rename the plots to be 1,2,3,4 within each block.
The new factor name begins with an uppercase P.

track$Plot <- with(track, interaction(veget, fruit))
## then use the model
modelPlot <- aov(mice ~ coon + veget*fruit*time + Error(block/Plot),
                  data = track)
summary(modelPlot)


5. modelPlot is something that you can study.  Now you can interpret it,
by looking for example at plots and tables of means, and decide what to
do next.


6.  --vanilla
Please see ?Startup
for a discussion of the meaning of the startup arguments.
I gave the Windows call using that argument.  The starting call on Mac
needs to follow Mac rules.


7. Error() notation.  Numerators and Denominators for F tests are
specified indirectly by the relation of the linear subspaces in the
treatment model and the Error model.

Rich




More information about the R-help mailing list