[R] manova discriminant functions: Addendum

Adam D. I. Kramer adik at ilovebacon.org
Tue Feb 6 00:12:32 CET 2007

As an addendum to my earlier post, I am having another difficulty with
getting manova() to behave as I would like: when I specify contrasts for my
independent variable(s), I am unsure of how to test them. This is a
contrived example of both of my questions:

Assume three alertness measurements, "alert1" "alert2" "alert3", a
within-subjects variable measuring their alertness at three timepoints,
minutes after taking the drug (alert1), one hour (alert2), and two hours
(alert3). The between-subjects variable is dosage, with dose==0 when
subjects have had no drug, dose==1 when they have had a single dose, dose==2
when they have had a double dose.

My intuition says to do the following:

alert <- cbind(alert1,alert2,alert3) %*% contr.poly(3)
contrasts(dose) <- matrix(c(2,-1,-1,0,1,-1),3,2)
m <- manova(alert ~ dose)

...what I want is two main effects (dose and alert) and one interaction
(dose by alert), but also "main effect" and "interaction" for the two
individual contrasts for dose. For the main effect for alert, and all of the
dose*alert interactions, I need the discriminant function loadings of my two
alertness contrasts in order to interpret the manner in which alertness is
varying (e.g., is it varying in a linear or quadratic way).

m2 <- manova (alert ~ dose)
...gives me a test for the dose * alertness interaction. Good! But I can't
seem to find the contrasts I asked for for dose. In univariate ANOVA, I
usually just call summary.lm() which gives me t-test coefficients for each
level of the dose contrast...but calling summary.lm on a manova object
returns t-tests on three unnamed coefficients, with 27 error degrees of
freedom (when it should be 26, as I am intending to compute both dosage
contrasts simultaneously). Also, I cannot tell whether it is the linear or
quadratic contrast that is contributing to the differentiation of dosage
levels--this is why I need the discriminant function loadings.

m2 <- lm( apply(cbind(alert1,alert2,alert3),1,mean) ~ dose)
...gives me a test for the two contrasts, which can be pooled to get a main
effect. Excellent!

...finally, for the main effect of alertness, I'm more or less at a loss.
The question is whether the three alertness conditions differ from each
other, or whether some linear combination of the linear and quadratic
contrast columns is significantly different from zero...and then the
relative weightings of the linear and quadratic contrasts.

Any suggestions?


On Mon, 5 Feb 2007, Adam D. I. Kramer wrote:

> Hello,
> 	I've been playing with the manova() function to do some pretty
> straightforward multivariate analyses, and I can't for the life of me figure
> out how to get at the discriminant functions used. When predicting several
> variables simultaneously, it's important to be able to gauge how much each
> variable is contributing to the analysis...a simple p-value isn't really
> enough. I find examination of the discriminant function loadings to be a
> good indicator of this.
> Thanks,
> Adam Kramer

More information about the R-help mailing list