# Trend Analysis

During individual subject or group analysis, the researcher might be interested in finding out whether there is some relationship among the coefficients of some regressors (individual) or the levels of a factor (group). A typical relation is linear or quadratic. Sometimes (not always) 3dRegAna can be employed for such an analysis, but it might be done (or even more appropriate) through contrast testing within 3dDeconvolve or ANOVA without resorting to a separate analysis with 3dRegAna.

If the stimulus conditions or levels of a factor are **equally-spaced**, the following coefficients/weights can be used for setting up an appropriate contrast for linearity, quadraticity or cubicity so that orthogonality among the coefficients is met:

No. of Conditions/Levels 1 2 3 4 5 6

---------------------------------------------------

3 Linear -1 0 1

Quadratic 1 -2 1

---------------------------------------------------

Linear -3 -1 1 3

4 Quadratic 1 -1 -1 1

Cubic -1 3 -3 1

---------------------------------------------------

Linear -2 -1 0 1 2

5 Quadratic 2 -1 -2 -1 2

Cubic -1 2 0 -2 1

---------------------------------------------------

Linear -5 -3 -1 1 3 5

6 Quadratic 5 -1 -4 -4 -1 5

Cubic -5 7 4 -4 -7 5

If the stimulus conditions or levels of a factor are **unequally-spaced**, the contrast coefficients have to be specially constructed based on the spacing situation. In general you can obtain the weighting by evaluating the corresponding orthogonal polynomials. For example, with four values of -20, -5, 5, 20, the weights for linear, quadratic and cubic trends are:

> poly(c(-20, -5, 5, 20), 3)

**Caveats**:

(1) Even if a trend analysis claims a significant relation across a set of coefficients, it doesn't mean that the relation is exact. Instead it simply means that such a relation exists among those coefficients, and it does not exclude the possibility of any other relation components such as quadratic or exponential relation among those coefficients. For example, if a linear trend test shows up significant, it might be true that quadratic or cubic relation also exist.

(2) Usually linear trend analysis is preferable to pair-wise comparisons among coefficients. And this is probably the case most of the time. However, in the situation of 3 coefficients, linear trend analysis employs the following 3 weights: -1, 0, and 1, which is essentially a pair-wise comparison between the first and third coefficients. Such a test is definitely not as informative as two separate pair-wise tests: -1 1 0 and 0 -1 1. Hoever don't feel that the trend analysis is invalid simply because the middle coefficient does not directly participate in the analysis. It is perfectly appropriate because of the assumption of equally spaced conditions.

(3) As general linear tests in *3dDeconvolve* (option -glt), *3dANOVA2* (option -acontr), and *3dANOVA3* (options -acontr, -bcontr, -aBcontr, and -Abcontr) don't require weights being add up to 0, you don't have to use the numbers in the above table as long as the spacing is appropriately considered in your weight assignment. But in the case of *GroupAna*, the above table is more appropriate since only contrasts (instead of general linear tests) can be implemented.