Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

3*3*2 ANOVA,trend analysis

148 views
Skip to first unread message

Marcos Campos

unread,
May 5, 1997, 3:00:00 AM5/5/97
to

I have a question about trend analysis on a 3*3*3 ANOVA.
Two factors have three levels and one has two. I wanted to break the two
degrees of freedom of the first two factors down into the linear
and quadratic components. I tried doing a polynomial contrast in
the GLM procedure of SPSS 7.5. This gave me a k-matrix which I could
not make much sense of and did not give an ANOVA table with the
linear and quadratic components broken down in one degree of freedom
each with accompanying F value. Does anyone have some suggestions?

Thanks in advance,

--Marcos


David Nichols

unread,
May 9, 1997, 3:00:00 AM5/9/97
to

In article <5kl1h9$h...@news.bu.edu>,

Since F-tests for contrasts on within subjects factors are automatically
displayed in GLM, I'm assuming that the factor of interest is a between
subjects factor. Specifying contrasts on such a factor produces the same
thing as specifying an LMATRIX with the chosen coefficients for the main
effect parameters of interest, with coefficients for other noncontaining
effects set to 0, and coefficients for containing effects "adjusted" to
produce an estimable function of the model parameters. The results are
formatted in the same way as those from a single LMATRIX subcommand with
semicolons separating (in this case, two) contrast specifications. This
produces an omnibus F-test for the set of contrasts, rather than a set
of single degree of freedom tests. The contrast results give only
confidence intervals, not significance tests. If the interval contains
0, there is no significant result at the chosen alpha level; it if does
not contain 0, there is a significant result.

There are two issues here to go into further. One is the question of
what is actually being estimated. The other is how to get test statistics
for the contrasts that you want (the confidence intervals do provide the
basic results, but I realize that some people are wedded to their p-values).

We'll deal with the second issue first, since it's the simpler one. There
is no way to force GLM to give you single df test statistics for the
contrast results using CONTRAST; you have to use LMATRIX instead. The way
to do this using LMATRIX is to use a separate LMATRIX subcommand for each
contrast. When you do this, instead of getting a set of confidence intervals
and one omnibus test, you get a single interval, then a single df test,
then another interval and test, etc.

So, if you just had a model with one three level factor, or if the model
didn't contain any interactions containing the main effect of the factor
(call it factor A), you could specify

/LMATRIX 'Linear Trend' A -1 0 1
/LMATRIX 'Quadratic Trend' A 1 -2 1

and you would get the two single df tests you wanted.

The complication here is that the model you mention is a 3x3x2 model,
and since you didn't explicitly say anything to the contrary, and the
default is to fit a full factorial model, I'm assuming that you're
probably fitting that full factorial version. If that's the case, or
if you have any interactions in the model involving the A effect, the
LMATRIX vectors created by the above specifications will not be
estimable functions of the data in that model.

When an effect such as A is contained in another effect, such as A*B
(and perhaps A*B*C as well), there is no such thing as a single effect
for A. A is contained in or confounded by the higher order terms. The
A effect is not estimable in such a model. Effects involving A and the
parameters for the containing terms are estimable. The most common way
of estimating something people call an A effect is to average over the
levels of the other factor(s) in an unweighted fashion. This is the
logic behind the use of estimated population marginal means (EMMEANS)
or so-called least squares means (LSMEANS).

The way that CONTRAST estimates deal with this problem is to produce
results that are (as far as I've been able to tell) nesting the effect
of interest within the last level(s) of the other factor(s) involved.
In other words, you get a set of contrasts on simple main effects, not
for averaged main effects. In terms of the statistical theory, neither
or these is right or wrong; they're just different things. In terms of
common practice, using the averaging option is the commonly done thing
(MANOVA does it this way, as do most programs), so I've asked that
this be changed, and it will be done for a future release. A user has
also recently pointed out to me that rather than setting unspecified
coefficients for containing effects to 0, as GLM does, a competitor
product distributes them in such a way as to give these averaged kind
of results. I'm planning to request that this be considered for GLM as
well; as I said, even though theoretically there is no priority for
such a practice, it is what is most commonly done.

Okay, back to the task at hand: how do you go about getting the
contrasts you want (assuming they're averaging over the levels of the
other factors), along with single df F-tests? I'll give you two options,
one for getting it done quickly, the other for learning more about what
you're doing here. The quick option (assuming you don't have problems
with empty cells or anything like that; it would get a bit more
complicated if that were the case) would be to specify the model in
the MANOVA procedure and look at the "main effect" contrast output,
which will have t-tests with it.

The more general and instructive option to get the results from GLM
using the LMATRIX subcommand is to figure out what the contrasts that
you want imply in terms of linear combinations of model parameters in
the model you've fitted. I'm not going to try to show how to do this
for a three way design, as the number of model parameters in the
overparameterized indicator matrix representation of the model for a
3x3x2 full factorial design is 4x4x3, or 48, which would be too wide
to try to do here. I'll do it for a 3x3 case though.

There are nine cells in a 3x3 design. Their representations in terms
of the overparameterized model are:

CELL INT A B A*B
1 2 3 1 2 3 1 1 1 2 2 2 3 3 3
1 2 3 1 2 3 1 2 3

(1,1) 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0
(1,2) 1 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0
(1,3) 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0
(2,1) 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0
(2,2) 1 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0
(2,3) 1 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0
(3,1) 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0
(3,2) 1 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0
(3,3) 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1

That is, the (1,1) cell is represented by summing the parameters for
the intercept, A1, B1 and AB11. The 16 columns of 0s and 1s constitute
the design or basis matrix for the model. Only linear combinations of
these sixteen columns are estimable functions of the data in this
model. As I noted earlier, there is no way to make comparisons among
the levels of A (or B) that do not involve the coefficients of the
A*B interaction term (if the main effects model were fitted, the last
nine columns would disappear, and it would be possible to get clean
comparisons among the levels of A or of B, since contrasts among the
levels of either one will result in the cancelling of the coefficients
for the other main effect).

For a linear trend over the levels of A, the three level case implies
simply a comparison of cells at the third level of A to those at the
first level, with the convention being to attach the negative signs
to the first level, so that a positive outcome implies a positive
slope for the trend line. Now the coefficients can be done so as to
maintain a particular scaling, or so as to maintain the use of
integers for all terms. This choice will change the magnitude of the
contrast coefficient, but not the significance test results. For
simplicity, we'll start with the version that maintains the integer
coefficients.

Our linear trend on A averaged over levels of B means attaching a -1
to each cell where A=1 and a 1 to each cell where A=3. That is, we're
going to subtract the sum of the first three cells from the sum of
the last three. The sum of the first three is:

(1,1) 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 +
(1,2) 1 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 +
(1,3) 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0
--------------------------------------------
3 3 0 0 1 1 1 1 1 1 0 0 0 0 0 0

The sum of the last three is:

(3,1) 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 +
(3,2) 1 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 +
(3,3) 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1
--------------------------------------------
3 0 0 3 1 1 1 0 0 0 0 0 0 1 1 1

The sum of the last three minus the sum of the first three is:

3 0 0 3 1 1 1 0 0 0 0 0 0 1 1 1 -
3 3 0 0 1 1 1 1 1 1 0 0 0 0 0 0
--------------------------------------------
0 -3 0 3 0 0 0 -1 -1 -1 0 0 0 1 1 1

This can be specified using LMATRIX as:

/LMATRIX 'Linear Trend on A' ALL 0 -3 0 3 0 0 0 -1 -1 -1 0 0 0 1 1 1

The same results can be obtained with:

/LMATRIX 'Linear Trend on A' A -3 0 3 A*B -1 -1 -1 0 0 0 1 1 1

In the second specification, the omitted intercept and B terms are
set to 0. If we wanted to maintain scaling so that the A coefficients
are -1 0 1 rather than -3 0 3, we would simply divide the whole set
by 3. In release 7.0, you'd have to specify the -1/3 and 1/3 as
decimal numbers. In order to ensure estimability, you'd need to
carry out the number of decimals to 8 places. In Release 7.5, the
parser has been made smarter, and you can actually specify -1/3 and
1/3. If you care only about the test statistic and not the raw value
of the contrast coefficient, or can remember to divide it by 3 after
looking at the output, you may want to stick with integers, at least
prior to Release 7.5.

The principles shown here can be applied to any between subjects
design. You have to specify the actual combination of the linear
model parameters you want to estimate. If there are interactions in
the model, there is no single way to define a main effect, and any
estimates of such effects involve coefficients of any effects in
which that one is contained.

--
-----------------------------------------------------------------------------
David Nichols Senior Support Statistician SPSS, Inc.
Phone: (312) 329-3684 Internet: nic...@spss.com Fax: (312) 329-3668
-----------------------------------------------------------------------------

0 new messages