• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Analysis Factor

The Analysis Factor

Statistical Consulting, Resources, and Statistics Workshops for Researchers

  • Home
  • About
    • Our Programs
    • Our Team
    • Our Core Values
    • Our Privacy Policy
    • Employment
    • Guest Instructors
  • Membership
    • Statistically Speaking Membership Program
    • Login
  • Workshops
    • Online Workshops
    • Login
  • Consulting
    • Statistical Consulting Services
    • Login
  • Free Webinars
  • Contact
  • Login

Interpreting Interactions Between Two Effect-Coded Categorical Predictors

by Karen Grace-Martin 13 Comments

I recently received this great question:

Question:

Hi Karen,  ive purchased a lot of your material and read a lot of your pdf documents w.r.t. regression and interaction terms.  Its, now, my general understanding that interaction for two or more categorical variables is best done with effects coding, and interactions  cont v. categorical variables is usually handled via dummy coding.  Further, i may mess this up a little but hopefully you’ll get my point and more importantly my question, i understand that

1)  given a fitted line Y = b0 + b1 x1 + b2 x2 + b3 x1*x2, the interpretation for b3 is the diff of the effect of x1 on Y, when x2 changes one unit, if x1 and x2 are cont.  ( also interpretation can be reversed in terms of x1 and x2).

2) given a fitted line Y = b0 + b1 x1 + b2 x2 + b3 x1*x2, the interpretation for b3 is it affects Y by changing the slope (whereas b2 affects the intercept), if x1 is cont. and x2 is cat 0,1,  namely dummy coded.  Thus, b1 is not a main effect for x1.

But what was not clear to me is what happens when x1 and x2 are effect coded cat variables, let’s say (-1,1) and the fitted line is Y = b0 + b1 x1 + b2 x2 + b3 x1*x2, the interpretation for b3  is  ????  this was only hinted at in the outlines .. I’d like to know how to interpret the b3 in this case, and I’d like to know why in this case of interaction, b1 is still considered a main effect for say x1?    Thanks for any clarifications!

Any help would be greatly appreciated,

J

Answer:

Hi J,

Great question.  First, yes, everything you state in points 1 and 2 are correct. I would add, though, that the effect-coded coefficients are not all that easy to interpret by themselves.  They do give you p-values for true main effects, and that’s useful, but you usually need to interpret using multiple comparison tests of the means.

To answer your questions:

It all comes down to what is a 0 point in dummy and effect coding.

In dummy coding, we’ve set the value of 0 to one of the categories, so:

1. the coefficients reflect actual cell mean differences, and have meaningful interpretations as such

2. when there is an interaction, the value of b1, eg., is the effect of X1 when X2 = 0.  Since X2=0 for one category of X2, b1 is not a main effect (an overall effect of X1 across all values of X2). It’s a marginal effect–an effect of X1 at a single value of X2.

In effect coding, we’ve set the value of 0 to being in between the two categories, so:

1. the coefficients are differences between cell means and grand means, and do not have particularly meaningful interpretations.  So you can use the p-value to tell that there is a significant interaction, but the only way to interpret that interaction in a meaningful way is to actually look at the means.  That’s why we usually just look at F statistics and means in ANOVA, which uses effect coding.  The coefficients themselves aren’t very interpretable.

2. when there is an interaction, the value of b1, eg., is the effect of X1 when X2 = 0.  Since X2 = 0 at the mean of the two categories of X2, b1 is a main effect.  It’s the effect of X1 at the mean value of X2.

Below, I’ve inserted an example.  I’ve displayed the means of each group and the coefficients when the variables are dummy and effect coded.

In dummy coding, the intercept is one of the four means–when both Poverty and Gender=0.  The various coefficients are differences from that mean.  Grab a calculator and see if you can figure out how to get each mean.

In effect coding, the intercept is the grand mean.  That point right in the middle of the graph.  The coefficients are differences from that point to the points marked with X on the graph.  Once again, see if you can figure out what each coefficient is telling you.

Interpreting Linear Regression Coefficients: A Walk Through Output
Learn the approach for understanding coefficients in that regression as we walk through output of a model that includes numerical and categorical predictors and an interaction.

Tagged With: effect coding, interaction, linear regression

Related Posts

  • Understanding Interactions Between Categorical and Continuous Variables in Linear Regression
  • Using Pairwise Comparisons to Help you Interpret Interactions in Linear Regression
  • Understanding Interaction Between Dummy Coded Categorical Variables in Linear Regression
  • The Difference Between Interaction and Association

Reader Interactions

Comments

  1. Liz says

    December 6, 2019 at 9:36 am

    Dear Karen, I have an interaction between 3 variables (one of the variables was effect coded). I later ran it dummy coded as well, to understand the triple interaction. Now I am not sure which one of these models to use in order to plot the results? Is it the effect coded model or the dummy coded one?

    Thank you so much for the wonderful and much needed explanations!

    Reply
    • Karen Grace-Martin says

      January 2, 2020 at 1:39 pm

      Hi Liv,
      Either one can work as long as you’re following the coding correctly. I think I would find the dummy one easier.

      Reply
  2. Sharon says

    July 3, 2019 at 12:49 pm

    Hi Karen,

    I hope you have heard of Backward difference coding.
    Would you know if itis possible to do an interaction if your variables are coded with backward difference coding?
    And if so, how would you then interpret this?
    With backward difference coding the mean of the dependent variable for a level is compared to the mean of the prior level.

    Therefore I wonder if it is possible to even do a interaction with this kind of coding.

    Hopefully you know more about this.

    Reply
    • Karen Grace-Martin says

      August 22, 2019 at 1:33 pm

      Hi Sharon, I haven’t. Do you mean that this is coding of ordinal independent variables? You wouldn’t be coding the dependent.

      Reply
  3. Elvira says

    September 5, 2018 at 1:56 pm

    What is exactly intereaction coding?

    Reply
  4. lawrence says

    April 30, 2014 at 3:06 pm

    Dear Karen, i have a problem in interpreting coefficients of coded categorical factors.i want to understand the effect of supervision, use of quality materials and material handling on waste generation on construction sites. i got this equation using a software “Design Expert”
    wastes, %= 12.49+0.2A-0.67B-1.66C-0.63D+0.17AC+0.43BC-0.69BD-0.087CD-0.41BCD
    A=quantity of materials used
    B=material handling(coded as Reuse=1, no reuse=0)
    C=Quality of material(coded as Good=1, not good=0)
    D=Supervision(coded as Strict=1, not strict=0)
    Now i want to know how for example what effect will material handling have on wastes when other factors are constant, or the effect of interaction between quality and supervision.
    I will be very grateful to hear from you.

    Reply
  5. Nahla Ibrahim says

    May 30, 2013 at 10:16 am

    Hi,
    I wonder what if there is an interaction between two dummies, how to determine the effect on Y?
    lets say: y = b0+ b1*D1 +b2*D2+ b3*D1*D2
    Y is wage, D1 is gender=1 for male and D2 is martial position = 1 for married, therefore the interaction represents married male.

    Thank you

    Reply
    • Karen says

      June 6, 2013 at 5:28 pm

      Nahla, the interaction represents not just married male. Its the difference in the marital difference for males compared to females.

      In other words it’s: (MaleMarried – MaleSingle) – (FemaleMarried – FemaleSingle).

      It tells you how much more marriage affects males than it does females.

      Reply
      • Prabah says

        August 24, 2017 at 6:14 am

        What a wonderfully worded answer!! Made my Day

        Reply
  6. Richard Hertzberg says

    May 10, 2013 at 1:36 pm

    Thank you for a wonderful resource for those of us needing to explain (and understand) the gist of key stat methods (my background is math not stat). In your description “interpreting interactions between two effect-coded categorical predictors” you say under the heading of Effect Coding, that “2. when there is an interaction, the value of b1, eg., is the effect of X1 when X2 = 0. Since X2 = 1 at the mean of the two categories of X2, b1 is a main effect. It’s the effect of X1 at the mean value of X2.”
    I was following this regarding the value of b1 as the effect of X1 when X2=0 but I expected a caution that it is not a main effect because X2=0 is not the same as factor 2 being absent: it is when X2 is at the average value of its max and min. Also, you then say “X2=1 at the mean of the two categories of X2” but the mean of the categories is at X2=0, correct? Please help this confused math guy.

    Reply
    • Karen says

      May 15, 2013 at 2:33 pm

      Hi Richard,

      First, per your last point, yes it should say (and I just fixed it) “X2=0 at the mean of the two categories of X2.”

      And it is a main effect. You’re right that X2 isn’t absent, but we are evaluating X1, averaging over all values of X2. This is a case where it’s important that the two values of X2 have equal sample sizes in order for 0 to be the mean of X2.

      Does that help?

      Reply
  7. Ly says

    September 4, 2012 at 4:51 am

    May I know how to interpret the INTERCEPT when you have two dummy coded variables – example – gender with females coded 0 and another IV with 4 categories (reference group coded 0) – would the intercept be the mean of females in the reference group? I am not getting that from my outputs. Many thanks!

    Reply
    • Karen says

      September 11, 2012 at 4:38 pm

      Hi Ly,

      Yes, that’s it exactly, as long as there are no other covariates in the model ( you don’t mention that).

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Please note that, due to the large number of comments submitted, any questions on problems related to a personal study/project will not be answered. We suggest joining Statistically Speaking, where you have access to a private forum and more resources 24/7.

Primary Sidebar

Free Webinars

Effect Size Statistics on Tuesday, Feb 2nd

This Month’s Statistically Speaking Live Training

  • January Member Training: A Gentle Introduction To Random Slopes In Multilevel Models

Upcoming Workshops

  • Logistic Regression for Binary, Ordinal, and Multinomial Outcomes (May 2021)
  • Introduction to Generalized Linear Mixed Models (May 2021)

Read Our Book



Data Analysis with SPSS
(4th Edition)

by Stephen Sweet and
Karen Grace-Martin

Statistical Resources by Topic

  • Fundamental Statistics
  • Effect Size Statistics, Power, and Sample Size Calculations
  • Analysis of Variance and Covariance
  • Linear Regression
  • Complex Surveys & Sampling
  • Count Regression Models
  • Logistic Regression
  • Missing Data
  • Mixed and Multilevel Models
  • Principal Component Analysis and Factor Analysis
  • Structural Equation Modeling
  • Survival Analysis and Event History Analysis
  • Data Analysis Practice and Skills
  • R
  • SPSS
  • Stata

Copyright © 2008–2021 The Analysis Factor, LLC. All rights reserved.
877-272-8096   Contact Us

The Analysis Factor uses cookies to ensure that we give you the best experience of our website. If you continue we assume that you consent to receive cookies on all websites from The Analysis Factor.
Continue Privacy Policy
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.