3
$\begingroup$

I'm estimating the simple model communication_share ~ grid_size * n_procs. From the theoretical background I would expect a negative effect of grid size and a positive effect of number of processors. Estimating my model gives me the following coefficients.

Predictor B SE t p
Intercept -5.24327 0.36280 -14.45 <0.05
Grid Size 0.00774 0.00084 9.22 <0.05
Number of Processors 2.51033 0.07824 32.08 <0.05
Grid Size:Number of Processors -0.00352 0.00018 -19.44 <0.05

The interaction term and the main effect of number of processors make total sense to me: A higher number of processors increases the share of communication and increasing the grid size makes this effect less pronounced. However, the positive main effect of grid size is a mystery to me. I know that an interaction term can mask main effects to the extent that it switches the sign of the main effect. But if I look at an interaction plot, I don't see this happening. (plot was generated plot_model(model, type = "pred", terms = c("grid_size", "n_procs")) Interaction plot of the model The grid size seems to have a negative trend for ALL values of number of processors so no inversion of the sign should be happening?

Can someone explain why my grid size could have a positive main effect here?

$\endgroup$

1 Answer 1

10
$\begingroup$

When the interaction (product term) is in the model, the coefficient for the "main effect" (lower-order term) of grid size (0.00774) gives you the expected slope when the number of processors is zero. The question is whether that makes sense and/or whether "number of processors = zero" is part of your actual data. That's one reason why people often center predictors prior to forming and including an interaction term in moderated regression (i.e., to make the zero point of the predictors and therefore the lower-order regression slope coefficients more easily interpretable).

$\endgroup$
3
  • 1
    $\begingroup$ Ah that is good to know! So if I'm only interested in cases where num_processors > 3 I should estimate the model with num_procs - 3? $\endgroup$
    – tadeseus
    Dec 4, 2023 at 11:22
  • 1
    $\begingroup$ @tadeseus while you're at it, also consider standardising the grid size variable - if 200 is the lower range of your data, make that the intercept coordinate rather than 0. Then the model can be read like a story, which corresponds to your figure. eg "The intercept represents the communication share for a system with the minimum number of processors (3) and the minimum grid size (200." And so on for the effects, which are relative to that value. The intercept should ideally be meaningful (a bit less than 2 - not sure what that represents) rather than (in this case) a negative number. $\endgroup$ Dec 5, 2023 at 3:19
  • $\begingroup$ Thanks! For the grid_size I actually want to have an intercept of 0 as a very small grid would be a possible scenario. The context for this data is communication time in a parallelized program. So less than 2 processors doesn't make sense but a small grid does. $\endgroup$
    – tadeseus
    Dec 6, 2023 at 6:38

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.