[R] se.contrast confusion

Adam D. I. Kramer adik at ilovebacon.org
Wed Feb 14 10:27:46 CET 2007


On Wed, 14 Feb 2007, Prof Brian Ripley wrote:

>> I've got what I'd expect to be a pretty simple issue: I fit an aov object
>> using multiple error strata, and would like some significance tests for the
>> contrasts I specified.
>
> It _is_ covered on the relevant help page.  See the 'split' argument in
> ?summary.aov, and the examples there.

While I am a bit embarassed that I did not fully explore this possibility,
it still does not quite do what I hoped, but perhaps is close enough. The
remaining trouble:

summary(fit,split=list(manip=list(L=1,Q=2),entry=list(L=1,Q=2)))

...describes tests of two contrasts of the manip variable, but they are not
the contrasts I specified. For instance, if I set

contrasts(lab6.3$manip) <- contr.poly(3)
or
... <- contr.helmert(3)

...the contrasts tested in the summary are the same...even if I refit the
model using the same syntax (fit <- aov(...)). If, however, I specify
contrasts=list(manip=contr.poly(3), entry=contr.poly(3)) as an argument to
aov, then the output using split is correct.

I was under the impression that "contrasts(dataframe$factor) <- matrix"
format was an acceptable way to define the contrasts which are used for that
factor, by default...is this mistaken? It is attractive to be able to set
contrasts for factors which are used across multiple analyses, with the
"contrasts" argument to aov overriding them. The contrasts() function's help
implies that this is how contrasts function.

>> The se.contrasts() function looks quite appealing, though it appears to
>
> Do you mean se.contrast?  Or where did you find this function?

Yes, that is what I meant. Too much typing of contrasts(manip) confuses the
fingers. I am not complaining about functions which do not exist...apologies
for the lack of specificity.

>> require me to respecify the contrasts...in both a contrast.obj and a
>> coef. It is not at all clear from the instrutions what contrast.obj is,
>> especially given that I have already specified the contrasts and they are
>> already represented in coef(fit). I may be missing something here.
>
> You seem to be missing the ideas of 'optional' and 'default argument', as 
> well as (I suspect) the correct name of the function.

I think I understood these concepts, and was suffering a deeper
misunderstanding regarding the purpose of "split." It appears nearly exactly
what I want, and I thank you for pointing it out to me.

> You do need to specify _which_ contrasts you want, and these can be
> different from those in the fit (and often will not be all of those in the
> fit).  Looking at the examples would have made clear that 'coef' is
> optional.

I saw that coef is optional when specifying a matrix as the contrast.obj,
though I did not understand the use of contrast.obj, especially for cases
with more than one variable. I'm still not quite clear, but the examples
make a lot more sense in this context.

In any case, it appears that se.contrast() is not what I want, and that more
careful examination of the "split" argument to summary.aov is what I was
missing.

Thanks again,
--
Adam D. I. Kramer
Ph.D. Student, Social and Personality Psychology
University of Oregon
adik at uoregon.edu



More information about the R-help mailing list