Skip to content
Prev 76401 / 398502 Next

question about custom contrasts in ANOVA

Since I have not seen a reply to this post, I will attempt a brief 
comment:  I won't comment on the specifics, but your general approach 
seems appropriate.  You already seem to know that a factor with k levels 
is converted into (k-1) separate numerical variables, and a separate 
regression coefficient is estimated for each one.

	  To see in more detail what you were estimating, I looked at the 
following:

	  model.matrix(y~xma)
	  fit2 <- aov(y~xma)
	  attributes(fit2)

	  From the latter, I identified "contrasts" as something that might be 
interesting to examine, as follows:

	  fit2$contrasts

	  For clarity, I think I might reduce the number of observations 
substantially, limiting myself to only 2 or 3 schools and paramterize 
the problem manually, but preserving imbalance.  Then I'd use "lm", 
specifying the terms in different orders.  With imbalance, the answer 
depends on the order unfortunately.  When in doubt, I often experiment 
with changing the order:  If the changes do not affect the conclusions, 
I pick the simplest case to present to my audience.  If the changes do 
affect the conclusions, I know I need to worry about which answer seems 
most correct, and I also know something about the limits of the 
conclusions.

	  I know this doesn't answer your question, but I hope it helped with a 
solution methodology.

	  Best Wishes,
	  Spencer Graves
Scot W McNary wrote: