I have a pretty generic question which I am guessing could be relevant to many social scientists who deal with panel data sets. What are the best practices for making graphs about interaction effects.

There is a variety of articles that talk about packages like ggplot, ggplot2, sjPlot, effects and so on but to my knowledge none of them really takes into account multiple years and multiple individuals.

In my field of management what I see most often is the complete disregard for year and individual effects so that an interaction for instance gets fitted by one x-variable on the x-axis, a simple high versus low of the other interacting variable in the graph and the y-variable on the y-axis of course. A difference in slope then shows how the interaction results in different impact on the y-variable.

This seems pretty simplistic as it (if I understand correctly) pretty much erases everything idiosyncratic about panel data, so basically it disregards the fundamental reasons why panels are interesting for statistical inference. So hence my question to the broader community: How do you plot results (and interactions) from panel data.

I'd appreciate both general and coding suggestions :)

Some extra questions:

  1. When you have a bunch of control variables, do you chose artificial values for all of them? What about time and individual variables?
  2. Is there a way of plotting the difference in residuals between the regression without interaction effects and the ones with interactions (similar to marginal effects) that clarifies how the interacting variables affect the dependent (response) variable y?
  3. While uncommon in management, can we draw 3 dimensional figures to show interactions?

Looking forward to your feedback and suggestions


1 Answer 1


If I understand correctly, you are estimating something like:

$y_{it} = \beta_0 + x_{it} \beta_1 + D_{it} x_{it} \beta_2 + \tau_t +c_i + \epsilon_{it}$

Once you have estimated the model, you are right that you need to choose some values for $\tau_t$ and $c_i$ to plot the effects, but whatever values you choose only affect the intercept of the plot (not the slope) so they are usually only of secondary importance. Same with additional covariates that you include. Usually, you would set these at their mean value, but they will only affect the intercept of the plot.

  • $\begingroup$ Hi, thanks for your comment. Assuming your D stands for dummy in the formula you are almost right. I understand the need to pick some artificial values for the time- and individual fixed effects which is only going to affect the intercept as you said. However, what is the best way forward when you not only have interactions between a dummy and an explanatory variable but interactions with multiple (discrete) explanatory variables. Something like y = B0 + B1x1 + B2x2 + ... + B10x1^2 + B11x1*x2 + B12x1^2*x2 $\endgroup$
    – SJDS
    Commented May 21, 2014 at 16:54
  • $\begingroup$ If all the covariates are categorical (i.e the value has no meaning), then your estimates would be differences in sample means for each group (removing time and fe), and you could probably just plot these in a bar graph with one bar for each group. From the last line that you wrote, it looks like some of the covariates may be continuous. You could fix x2 (probably at its mean or some other choice that makes since) and make a plot varying x1 for something 2d. You could let both of them vary and make a 3d plot. If you use R, check out the lattice package (and wireframe method) for 3d plots. $\endgroup$
    – bmciv
    Commented May 21, 2014 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.