If we manage to get to a model that includes at least one categorical variable (with more than two levels), we want to know which coeffi cients ( intercept, linear terms, etc.) or their groups are diff erent. Th e result of the overall test for a factor with more than one degree of freedom (more than two levels) says: “Yes, there is at least one diff erence among the levels.” But we do not know if there is only one signifi cant diff erence, if each coeffi cient is diff erent from every other coeffi cient, or if the truth is somewhere in-between. To arrive to a conclusion, we need to look “inside” the model somewhat more closely. For this purpose, we recommend to use one of the following methods:
• Apriori contrasts
• Posterior simplifi cation
Both these approaches are based on the method of contrasts. Th e only diff erence is that for apriori contrasts, we decide in advance (when preparing an experiment or a study),
which levels will be compared. Such a decision can be based on the results of a previous experiment or on a theory to be tested. Th is method is oft en used in laboratory studies and almost exclusively in clinical trials, for example. When we use the posterior simplifi cation procedure, we do not know apriori what we want to compare with what. Our decisions are based on “interesting facts” that only come to light during the analysis (just like in the pre- vious sections where we added or removed model terms, based on more or less formalised selection procedures). Th is is, unfortunately, the most common but also the most criti- cised method used, especially in observational studies. Why is it criticised? Because we construct and propose to test comparisons based only on the facts that we read from the data, being led by the conclusions of previous tests, graphical displays and so on. Th is way, we actually conduct many more comparisons (which are oft en very much inter-depend- ent) in our head and exclude those that do not seem to be very interesting or “promising”
in some (oft en very vague) sense. Th eir number is large and the dependence structure is very hard to determine and hence to take into account during the proper calibration of the testing procedures. Th e formally conducted tests represent a very select group (aft er a lot of “mental screening”). For example, we do not count comparisons that we think are non- signifi cant. We calculate tests only for the comparisons that look interesting to us, based on what we know from the same data. Interpretation of the p-values for the tests actually conducted cannot be correct under these circumstances. Th e Type I error, i.e. false pos- itive (falsely signifi cant) rate can be substantially infl ated, compared to the nominal error rate (for example, 5% level which we deliberately set for the test procedures). It is thus doubtful what the results of such tests are good for. Apriori contrasts (infl uenced only by our theories or experiences with past data and not by particular results of current observa- tions) do not suff er from such a problem.
Let’s look at the contrasts. You may ask: “What is a linear contrast?” Generally speaking, it is a linear combination of parameters (with known weights). For example, in the following quadratic model
ε γ β
α + + +
= x x2
y
a linear contrast can be the value of K defi ned as:
γ β
α 2 3
1 w w
w
K= + + ,
for some given values of w1, w2 and w3. A particular contrast is specifi ed by choosing coef- fi cients (w). Between the theoretical contrast and its estimate there is a similar relationship as there is between the unknown value of a parameter and its estimate. An estimate of such a (theoretical) contrast is a random variable that is obtained when we replace the unknown parameters by their estimates (a, b, c), so that we get:
c w b w a w
Kˆ = 1 + 2 + 3 .
What is it good for? For one thing, when we want to estimate an expected value of the re- sponse variable at x0, we fi nd from (5-7) that this is, in fact, a particular case of a contrast with w1 = 1, w2 = x and w3 = x2.
5.4.4 COMPARISON OF LEVELS USING CONTRASTS
(5-6)
(5-8) (5-7)
Contrasts are probably more oft en used in models that have a categorical variable in their systematic part. Let us consider an ANOVA model with a single factor A:
ij j
ij A
y = +ε .
Aj represents the eff ect of the jth level of this factor – it is the so-called textbook parametri- zation, which we have already encountered in Chapter 5.3. As we will see, the model and constants will be a little more diffi cult to write for other parametrizations, but it is not hard to get used to them. a contrast for (5-9) in the textbook parametrization will generally be
∑=
=
J
j j
jA
w K
1
.
One of the ways to achieve that is to assign the coeffi cients wj within the frame of a single contrast to individual levels in accordance with the following rule: we will assign opposite signs to the levels we want to compare, the same signs to the levels that we want to combine into the same group, and zero to the levels we want to omit. If we want to compare only the averages of the levels of two groups, then all levels that are assigned the positive sign should be simply given coeffi cient 1/k, where k is the number of levels to which we assign positive signs. An analogous stipulation applies to the levels with negative signs. We thus get, as spe- cial cases, the mean values for all levels of factor A (in the textbook parametrization for the jth level by selecting wj = 1, and wk = 0 for k ≠ j). We can put together several contrasts but we have to think a little bit. For example, for a model with DIET, we may want to compare 2.1 times the average mass of the lipid-enriched diets with the average of the protein-enriched diets (because, for example, a published study claims that the relative conversions of nutri- ents into mass from both diet types should correspond to the above ratio). In the textbook parametrization, this corresponds to the contrast: w1 = 0, w2 = w3 = 2.1/2, w4 = w5 = –1/2.
In models with categorical variables and other than textbook parametrization, the ANOVA model is (intentionally) over parametrised and written as: yi,j = μ + Aj + εi,j . Th e contrasts coeffi cient for the intercept (w0) is then typically set to zero. In that case, it seems that we need J coeffi cients for the contrasts specifi cation. So, for example, with DIETj denoting the eff ect of jth diet level, we have:
∑=
=
J
j
j
jDIET
w K
1
,
but for fundamental statistical reasons related to identifi ability (estimability) of the various model coeffi cients and their linear combinations, we have to impose some other restrictions.
In the case of a single factor model, it is just one restriction. In the so-called treatment para- metrization, we impose DIET1 = 0. Generally, in the treatment parametrization, we set the eff ect of the reference level to zero (and R takes as the reference level the one with the lowest code ordering). In the treatment parametrization DIETj for j > 1 will then correspond to the diff erence between expected values of jth level and the reference level.
Another parametrization (called sum parametrization in R) imposes another restriction on the w’s, namely:
(5-10)
(5-11) (5-9)
∑=
=
J
j
wj 1
0.
Th is will lead to a diff erent interpretation of the over parametrised model coeffi cients and a diff erent way of writing the desired contrasts (for the same contrasts, we will have diff erent w’s than in the treatment or textbook parametrizations).