[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Repeated Measures Manova contrasts

From   David Airey <david.airey@Vanderbilt.Edu>
Subject   Re: st: Repeated Measures Manova contrasts
Date   Tue, 23 Oct 2007 13:53:55 -0500



manova is only well documented in the manual...with many
examples and a reference to a text, Rencher (2002). I think Phil
Ender will talk about repeated measures possibilities in Stata
soon at the West Coast SUG. You should get the manuals or borrow
to read the sections you need. Here's some code from a relevant
example. Would be good to have FAQ on repeated measures expanded
to include this aspect of MANOVA.

1 repeated measures variable and 3 grouping variables
allow period and dependent variable interaction by use of
ytransform() option of manovatest postestimation command

see example 10 in [MV], code lifted here

see example 11 in [MV] for multiple dependent variables

A good basic level text I like to MANOVA is Maxwell and Delaney.


use, clear


quietly manova y1 y2 y3 = p t p*t f p*f t*f p*t*f

Create matrix c with rows corresponding to the linear and
quadratic contrasts for the three dependent variables; 3 columns
for each y, first row linear contrast, second row quadratic
contrast. Use matrix c for test of period and dv interactions

matrix c = (-1, 0, 1 \ -1, 2, -1)

/* tests of interaction of period with RHS terms... */
manovatest p, ytransform(c)
manovatest t, ytransform(c)
manovatest p*t, ytransform(c)
manovatest f, ytransform(c)
manovatest p*f, ytransform(c)
manovatest t*f, ytransform(c)
manovatest p*t*f, ytransform(c)

/* testing main effects of period... */

manovatest, showorder // use to help make the m matrix below

[MV] explanation: ...create a row vector m based on above
that has:

1 for first column for constant
1/3 for 3 columns for p
1/2 for 2 columns for t
1/2 for 2 columns for f
1/6 for 6 columns for p*t
1/6 for 6 columns for p*f
1/4 for 4 columns for t*f
1/12 for 12 columns for p*t*f

matrix m = (1),           ///
			J(1,3,1/3),   ///
			J(1,2,1/2),   ///
			J(1,2,1/2),   ///
			J(1,6,1/6),   ///
			J(1,6,1/6),   ///
			J(1,4,1/4),   ///

manovatest, test(m) ytransform(c)

On Oct 23, 2007, at 11:51 AM, A Noyb wrote:

I ordinarily use SPSS, and am new to Stata; this is my
first  post to this list.  Could  anyone refer me to
resources for understanding the matrix command, more
particularly for _laying out the contrast coefficients
depending on the  number of levels of the IV and DV in

I hope my questions  are proper ones for this list and
are not too basic.  I am doing a Manova and am most
interested in the time by treatment interaction.  I am
baffled by the  contrasts described in the worked
example at

Any help in understanding how to write contrasts in
such a situation would be much appreciated.  The
Stata manual doesn't provide much guidance nor have
other web resources/our university library.

Thank you,


Below is a more detailed description of the questions
I have about the worked example, and also about my own
data, in case anyone is inclined/willing to give their
two cents.


input s a y1 y2 y3 y4
1 1 3 4 7  7
2 1 6 5 8  8
3 1 3 4 7  9
4 1 3 3 6  8
5 2 1 2 5 10
6 2 2 3 6 10
7 2 2 4 5  9
8 2 2 3 6 11

manova y1 y2 y3 y4 = a
mat ymat = (1,0,0,-1\0,1,0,-1\0,0,1,-1)
mat list ymat

I  don't understand how these coefficients measure the
interaction, it looks like they just compare each of
y1 to y3 in turn to y4.

My dataset has three repeat measurements of a number
of variables and several IVs of  differing levels.

DVTime1  DVTime2  DVTime3  IV1 IV2
   3        4        3        1    1
1        2        4        1    2
2        1        5        1    3
3        4        6        1    1
3        5        4        2    2
2        4        3        2    4
3        1        5        2    2
1        4        4        2    2
3        4        4        2    1

The main analysis I need to do looks at the
interaction of time  and IV1, which has 2 levels.  I
created a  matrix using the following

Mat ymat = (1,0,-1\0,1,-1)

However the output was quite different from the output
from  SPSS Manova for the very same data and analysis.
 Since I am more comfortable with SPSS, I  thought it
prudent to check my work before proceeding too far.

What should the matrix be to look at the time by
treatment interaction?

The reason I am not using SPSS to do these analyses is
that  Stata is better suited to my non-normal data.
(I ultimately plan to use the negative binomial option
on the Manova, once I get the bugs worked out.)

Thank you very much for any help you can give.

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
*   For searches and help try:
David C. Airey, Ph.D.
Pharmacology Research Assistant Professor
Center for Human Genetics Research Member

Department of Pharmacology
School of Medicine
Vanderbilt University
Rm 8158A Bldg MR3
465 21st Avenue South
Nashville, TN 37232-8548

TEL   (615) 936-1510
FAX   (615) 936-3747

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index