Contrast Coding in Multiple Regression Analysis: Strengths, Weaknesses, and Utility of Popular Coding Structures

The use of multiple regression analysis (MRA) has been on the rise over the last few decades in part due to the realization that analysis of variance (ANOVA) statistics can be advantageously completed using MRA. Given the limitations of ANOVA strategies it is argued that MRA is the better analysis; however, in order to use ANOVA in MRA coding structures must be employed by the researcher which can be confusing to understand. The present paper attempts to simplify this discussion by providing a description of the most popular coding structures, with emphasis on their strengths, limitations, and uses. A visual analysis of each of these strategies is also included along with all necessary steps to create the contrasts. Finally, a decision tree is presented that can be used by researchers to determine which coding structure to utilize in their current research project. According to Hinkle and Oliver (1986), multiple regression analysis (MRA) has begun to become one of the most widely used statistical analyses in educational research, and it can be assumed that this popularity and frequent usage is still rising. One of the reasons for its large usage is that analysis of variance (ANOVA) techniques can be calculated by the use of MRA, a principle described by Cohen (1968). The benefits of using MRA instead of ANOVA include MRA's ability to allow the researcher to (1) use both continuous and categorical or nominal independent variables, (2) examine trends in data (i.e., look for patterns beyond linear data representation) (Kerlinger & Pedhazur, 1973), (3) have more flexibility and conceptual clarity (Kaufman & Sweet, 1974), (4) understand where statistically significant mean differences are occurring, beyond a simple omnibus test (Chatham, 1999), (5) have the potential to increase the statistical power against Type II error, and (6) have more thoughtful hypotheses about the data (Thompson, 2006). The use of such techniques can be confusing for the researcher however, due in part to their complexity and the many different options.

According to Hinkle and Oliver (1986), multiple regression analysis (MRA) has begun to become one of the most widely used statistical analyses in educational research, and it can be assumed that this popularity and frequent usage is still rising.One of the reasons for its large usage is that analysis of variance (ANOVA) techniques can be calculated by the use of MRA, a principle described by Cohen (1968).The benefits of using MRA instead of ANOVA include MRA's ability to allow the researcher to (1) use both continuous and categorical or nominal independent variables, (2) examine trends in data (i.e., look for patterns beyond linear data representation) (Kerlinger & Pedhazur, 1973), (3) have more flexibility and conceptual clarity (Kaufman & Sweet, 1974), (4) understand where statistically significant mean differences are occurring, beyond a simple omnibus test (Chatham, 1999), ( 5) have the potential to increase the statistical power against Type II error, and (6) have more thoughtful hypotheses about the data (Thompson, 2006).The use of such techniques can be confusing for the researcher however, due in part to their complexity and the many different options.
The present paper attempts to simplify this process by including a summary of some of the most used coding structures, with a description of their strengths, weaknesses, and utilization.This discussion includes an illustration of each coding method on an example database with all the necessary steps to code the contrasts, results, and interpretations.Finally, the paper concludes with a decision tree to assist the research in choosing the most appropriate code structure to use with their particular data and research interests.

Planned vs. Unplanned Contrasts
Before specific types of coding structures can be discussed, understanding of the broader concepts and code groupings must be achieved.At the highest level a researcher mush choose from two broad coding categories: planned and unplanned contrasts.Unplanned contrasts are sometimes looked down on in the literature, but as described by Thompson (2006) these types of contrasts do have their benefits because "planned contrasts should not be used in new areas of inquiry where theory has not been elaborated" (p.371).Thus unplanned contrasts are of use when the researcher must actually "fish" for understanding of the data.
When, though, the research does have theory or literature planned contrasts (also known as a priori or focused contrasts) can be especially useful and give the researcher three inherent advantages over unplanned contrasts.First, planned contrasts provide increased statistical power against Type II error because the researcher is not forced to test unnecessary or unwanted group differences.Second, planned contrasts cause researchers to be more specific and thoughtful about the hypotheses that they create (Chatham, 1999).Third, interpretation is simplified because there is no need to interpret results that may either be unimportant or uninteresting.

Orthogonal Contrasts
Beyond these large categories of coding structures, the concepts of orthogonal vs. non-orthogonal contrasts and trend vs. non-trend contrasts must be examined.First, orthogonal contrasts are described as "uncorrelated variables created to test perfectly uncorrelated hypotheses" (Thompson, 2006, p. 363).This means that as one contrast is tested it does not provide any information about the results of subsequent contrasts (Hinkle, Wiersma, & Jurs, 1998).
von Eye and Schuster (1998) provided a 3-step process for creating orthogonal contrast.To increase the understanding of this process an example data sample will be utilized (see Table 1) examining risk factors in adolescents.First, the researcher must understand that the number of contrasts created will be the number of groups/categories minus 1, thus in our fictitious example if we wanted to code the variable family type we would have 4 groups: intact biological family, adopted parents, step-family, and single parent, which would allow 3 contrasts (4 − 1 = 3).The initial step in creating orthogonal contrasts is to choose your first hypothesized group difference you wish to test.Thompson ( 2006) defined simple contrasts as those which test for differences between only two groups, and complex contrasts as those which test for multiple group mean differences.The researcher can choose to begin by selecting a complex or simple contrast.For our example we will begin with a simple contrast in which we hypothesize that youth from intact families will differ from those in adopted parent families in regard to riskiness, thus from this our first contrast will be: c 1 = (−1, 1, 0, 0).Next, we create the rest of the desired contrasts, and because we are creating orthogonal contrasts, we need two more complex contrasts.For the first complex contrast we will examine the difference in mean riskiness for youths in step-parent families vs. those from intact and adopted parent families: c 2 = (−1, −1, 2, 0), and for the final complex contrast we test whether intact adopted and step-parent families differ from single parent families: c 3 = (−1, −1, −1, 3).Finally, we create the coding design matrix.This is done by creating a column for each contrast and placing the corresponding contrast vector in for all members of that category, as illustrated in Table 2. Following are the steps to create and run these contrasts: Create three variables (A1, A2, A3), set their values to 0.
Run linear regression with risky as dependent variable and A1, A2, and A3 as independent variables.
Note.The 4 levels of the balanced (n in each cell is 3) one-way design are family type: 1 = intact family, 2 = adopted parents, 3 = step-family, and 4 = single parent.
The results show statistically significant effects for two of the three contrast variables, A1 : F (1, 11) = 48.05,p = .004;A3 : F (1, 11) = 49.41,p = .004.These results supported the hypothesis that different family compositions affected youth levels of riskiness.More specifically A1 suggests that youth from intact families were statistically significantly less likely to be risky (M = 5, SD = 3) than those youth from adopted parent families (M = 15.33,SD = 1.53).A2 suggests that youth from intact and adopted parent families were not statistically significantly different (M = 8, SD = 3) than those youth from step-parent families (M = 11, SD = 1; F [1, 11] = .42,p = .564).Finally, A3 suggests that youth from intact, adopted and step-parent families were statistically significantly less likely to be risky (M = 10.44,SD = 4.82) than those youth from single parent families (M = 19, SD = 1).
Once the researcher has completed setting up their orthogonal contrasts they can do one of two simple tests to ensure their contrasts are in fact uncorrelated.First, by calculating the inner product of each pair of vectors; if this number equals 0 then the contrasts are orthogonal (von Eye & Schuster, 1998).For our example we see that for (A1)(A3) vector cross products equals (−1 thus our A1 and A3 contrasts are orthogonal and we can do the same to test the orthogonality of our other contrasts.Second, a Pearson r can be run on the three contrast variables (A1, A2, and A3) to ensure that our three contrasts are in fact uncorrelated with each other.

Trend Contrasts
The second type of further contrast distinction is trend vs. non-trend.The example orthogonal contrasts described previously are non-trend contrasts because they examine mean differences.Other examples of non-trend contrasts will be examined shortly.Trend contrasts, also known as polynomial contrasts, are defined by Thompson (2006) as those which "do not each test whether two means are equal but instead test whether the means across the levels form a certain pattern (e.g., a line, a parabola)" (p.375).Such trend analyses can be very useful by the researcher who wants to examine data to look for effects of treatment or any other type of data that may perform in a manner that is not simply on a linear line.Such trend contrasts are possible only if (1) they way is quantitative (e.g., minutes of time, milligrams of drug) and ( 2) the levels are equally spaced (e.g., 10, 20, 30, 40 minutes).
Say for instance we wanted to test the effect of grades on adolescent riskiness.We may find a strait linear line that states that the higher the grades the lower the risk, but we may also find other effects.Perhaps getting an 80% grade average equals zero risk while both higher and lower grades increase risk, creating a curve with one bend.To test the shape of the effects the researcher must fist determine the grouping of the variables.In our example data we see that our grade data range from 55 to 94 so we can create five groups of ranging grades placing the adolescents in groups of A(5), B(4), C(3), D(2), or F (1). See Table 3 for the matrix used to test trend contrasts for a 5-level way variable.Following are the steps needed to create and test these contrasts: Create four variables (linear, quadratic, cubic, and quartic) Run linear regression with risky as dependent variable and linear, quadratic, cubic, and quartic as independent variables.
The results show statistically significant effects for the quadratic pattern, F (1, 11) = 39.19,p < .001.This suggests that the effect of grades on youth riskiness is not a linear one, but one such that both youth with low and higher grades are more likely to be risky than youth with average grades.

Non-trend Contrasts
The first example on creating orthogonal contrasts was an example of nontrend contrasts.Two other types of contrast coding are dummy coding and effects coding.

Dummy coding
Dummy coding, described by Cohen and Cohen in 1983, is the simplest coding structure that allows the researcher to examine group mean differences.Dummy coding only uses 1s and 0s, and is completed by creating up to k − 1 contrasts; thus in a two group example dummy codes would be created by giving one group a 1 and the others a 0 (Fox, 1997).More complex dummy codes can be created though for variables with multiple categories.Completion is just as easy though, first group one is given a 1 in the first contrast with all other groups receiving a 0, in the second contrast group two receives a 1 with all other groups receiving a 0, and so forth (Wendorf, 2004).Examples of two-level and five-level dummy codes are provided using the example data in Tables 4 and 5 respectively to test for gender and substance use differences in regard to level of riskiness expressed by the youth.Following are the steps needed to create and test these contrasts.A1: 1 1 1 1 1 1 0 0 0 0 0 0 Note.The 2 levels of the balanced (n in each cell = 6) one-way design are gender: 0 = female, 1 = male.Note.The 5 levels of the one-way design are substance use: 1= no use, 2 = 1 or 2 times a month, 3 = once a week, 4 = 2 to 3 times a week, and 5 = everyday.(M = 9, SD = 1.41).A3 suggests that youth who used substances once a week are not statistically significantly different (M = 13.67,SD = 1.53) than their peers (M = 12.22,SD = 6.55;F [1, 11] = 4.67, p = .072).Finally, A4 suggests that youth who used substances 2 to 3 times a week were statistically significantly less likely to be risky (M = 12.3, SD = 6.06) than their peers (M = 14, SD = 4.24).However, interesting to note is that while each of these findings provides interest, they can be conflicting as are hypotheses A1 and A4, showing a limitation for using dummy codes on variables with high levels.
Run linear regression with risky as dependent variable and A1 as the independent variable.
Run linear regression with risky as dependent variable and A1, A2, A3, and A4 as the independent variables.
The results show statistically significant effects for three of the four contrast variables, A1 : F (1, 11) = 44.47,p < .001;A2 : F (1, 11) = 16.37,p = .007;A4 : F (1, 11) = 6.74, p = .038.These results supported the hypothesis that different levels of substance use affected youth levels of riskiness.More specifically, A1 suggests that youth who do not use substances were statistically significantly less likely to be risky (M = 3.5, SD = 2.12) than those that do use substances (M = 14.4,SD = 4.09).A2 suggests that youth who used substances once or twice a week were statistically significantly more likely to be risky (M = 13.3,SD = 5.96) than their peers Dummy codes have some distinct advantages that cause them to still have wide usage today despite more advanced coding structures being available.One such benefit is that dummy code structure works especially well with nominal and more specifically dichotomous data (McClendon, 1994).Fox (1997) noted that dummy codes allow the researcher "to avoid a biased assessment of the impact of an independent variable, as a consequence of omitting another independent variable that is related to it" (p.136) when he spoke on the reluctance of using such two category variables.A second benefit to such a coding structure is the ease of interpretation.Because for groups coded as 0, the intercept of the regression equation is the mean of these groups, thus if we know the mean of the 0 coded groups we already understand half of the regression equation (McClendon, 1994).
Such simple interpretation leads us also to one of the limitations of dummy coding, that being limited ability to make interpretations (Keppel, 1989).Keppel (1989) stated that one of the main situations in which dummy coding is used is to test the effects of one group against all other groups, for instance a control group against multiple treatment groups.Although this information can provide the researcher with beneficial information, it is much more advantageous to begin with contrast coding, which allows for more detailed hypothesis testing.Lastly, dummy coding has the disadvantage that such a design "will result in one or more erroneous tests of significance for multi-factor designs" (O' Grady & Medoff, 1988, p. 258).

Contrast coding
Contrast coding was created as an extension of dummy coding to examine mean differences between groups (Overall & Spiegel, 1969).This type of cod-ing scheme allows the researcher to examine more than simple omnibus tests, or differences between one group mean and all other group means (Kaufman & Sweet, 1974).Such contrasts can be very useful to the researcher, as was seen in our example, because they allow the researcher to test specific hypotheses of interest between group means, a task that if completed with regular ANOVA strategies would require post-hoc tests.It has been stated by some that contrast coding "provides us with the most useful information of all the coding methods" (Keppel, 1989, p. 113).The basic premise of this coding structure is that it requires the researcher to assign contrasts that sum to 0 across all subjects (Keppel, 1989).Thus in our example data in Table 2 we can see that for each contrast (i.e.(A1, A2, A3) the numbers add up to 0.
Although such coding is very helpful, it does have limitations.Kaufman and Sweet (1974) stated that if such contrasts are created in an orthogonal, balanced (same n for all groups) design, then interpretation of main effects and interactions is fairly straightforward and accurate; however, when designs become unbalanced or non-orthogonal, such interpretations can become confounded.Although such confounds can be avoided or controlled, this does necessitate the researcher to utilize caution before conducting such contrasts.

Effects coding
A final coding type that will be examined is effects coding, which is very similar to contrast coding, and in fact identical in the two category situation (Keppel, 1989).With this coding structure the same process is completed as that for dummy coding except the last group receives a −1 on all contrasts, thus only k − 1 contrasts are used in this coding type (Wendorf, 2004).An example of such a coding structure from our example data can be viewed in Table 6.Effects coding has uses that extend past dummy coding, and yet it is not as elaborate as contrast coding.Effects coding allows researchers to test mean differences between two groups by using simple contrasts, but does not allow the complex contrasts of contrast coding (Koslowsky, 1988).Using the example data we can test the difference between levels of thrill seeking behavior on youth riskiness.Following are the steps needed to create and test these contrasts.
Run linear regression with risky as dependent variable and A1, A2, and A3 as the independent variables.
The results show statistically significant effects for two of the three contrast variables, A1 : F (1, 11) = 88.20,p = .002;A3 : F (1, 11) = 9.07, p = .046.These results supported the hypothesis that different levels of thrill seeking affected youth levels of riskiness.More specifically, A1 suggests that youth who are very low thrill seekers were statistically significantly less likely to be risky (M = 5, SD = 3) than those that were high thrill seekers (M = 19, SD = 1).A2 showed that there was no statistically significant difference between low thrill seekers (M = 11, SD = 1) and high thrill seekers (M = 19, SD = 1; F [1, 11] = .60,p = .604),regarding youth riskiness.Finally, A3 suggests that youth who were medium high thrill seekers were statistically significantly less likely to be risky (M = 15.33,SD = 1.53) than those that were high thrill seekers (M = 19, SD = 1).As with dummy coding, one of the benefits of this coding structure is the ease of interpretation.With effects coding, the slope is simply the difference between the mean of the group coded as 1 and the grand mean of all the groups (McClendon, 1994).However, one limitation of this coding structure is it only tests the difference between simple contrasts and does not allow the researcher to test hypotheses for both simple and complex contrasts.

Conclusion
As explained here, researchers have many options available to them to test both mean differences and mean trends in data through the use of MRA.The end conclusion is that the type of coding structure should be determined by researchers according to the type of hypotheses they wish to answer.One of the largest benefits of the coding structures discussed earlier is the thought that needs to be put into the analysis (Thompson, 2006).Such a decision tree is shown in Figure 1.First, researchers must determine whether previous literature or knowledge allows them to determine specific hypotheses, if not then non-planned contrasts need to be examined to find where effects lie.If, however, researchers do have a reason to suspect specific hypotheses they move onto the next decision, which is whether they want to compare group means against each other, or look at the trend of the means.If trend tests are desired, then polynomial or trend contrasts will be created to see how the means react across levels of the way.If tests of mean differences are desired, then researchers move onto another decision, which is what type of mean differences they wish to examine.If researchers wish to compare a single group against all groups, then simple dummy coding can be created easily.If researchers instead wish to test individual group means against each other, then effects coding is the desired choice.Or, if researchers determine that they wish to examine both of these types of mean differences, then the most complex coding type of contrast coding should be applied.The last decision that researchers should make is whether their desired contrasts should be uncorrelated with each other, which will allow more easily interpretable results.

Table 1 :
Fictitious data sample assessing adolescent riskiness

Table 2 :
Orthogonal contrast coding for a four-level way

Table 3 :
Trend/polynomial contrasts for a five-level way

Table 4 :
Dummy coding for a two-level way

Table 5 :
Dummy coding for a five-level way

Table 6 :
Effects coding for a four-level way