0
$\begingroup$

For a research I am conducting I am looking at the effect of two categorical variables (dummy with values 0 and 1 for each group) on the speed and quantity with which customers make future purchases. The variables are simply made as follows:

  • speed is measured as the days until the next purchase
  • Quantity is measured as a count variable counting the number of products purchased at the next purchase My goal is to understand how the two categorical variables affect the speed and quantity. For Speed I used a hazard Cox regression to analyze the time until the event of the next purchase. For quantity I used a negative binomial model (to accoutn for overdispersion) to analyse the quantity of products. In both analyses I add first one variable, and then both and then their interaction in a hierarchical fashion.

However the signs of the coefficient of one categorical variable change everytime I add the other one. I checked multicollinearity because the correlation between the variables is .130 and the VIF scores are around 1.

Here is an example of the negative binomial count model results (*significant below .001) :

Models Model 1 Model 2 Model 3
Variables B coefficient B coefficient B coefficient
------------- -------------- ------------- -------------
Intercept 2.30* 2.31* 2.32
Categorical 1 5.20* -2.20* -2.30
Categorical 2 5.30* 2.72
Interaction 7.32

Could anyone help me explain why this is happening or suggest how to deal with this issue? I do not know how to explain this and it happens both with the cox regression as with the negative binomial model..

Thank you already!

$\endgroup$
2
  • $\begingroup$ This is an interaction. It will be easier to explain if you tell us what the two categorical variables are. But you can also search for other questions on CV that involve interactions. I know this has been answered before. $\endgroup$
    – Peter Flom
    Commented Jul 17, 2023 at 14:52
  • $\begingroup$ Hi Peter, thank you! categorical variable 1 indicates whether the customer made their first purchase with a discount (=1) or regularly (=0), and categorical variable 2 indicates the same but for the second purchase. Does this help? $\endgroup$
    – user234
    Commented Jul 18, 2023 at 8:00

1 Answer 1

0
$\begingroup$

Reading your comment, yes, that does help. You have an interaction. In model 1 (for the NB) people who used a discount at time 1 made more purchases later. That's sensible, because that's one reason people offer discounts in the first place. In model 2, we see that, holding discount at time 1 constant, discount at time 2 increased later sales, but, holding discount at time 2 constant, the reverse happens. I would not use this model. In model 3 you add the interaction. The easiest way to interpret the results, I think, is to give the predicted values for each combination of the two categorical variables. With most software, you can get this with some sort of option.

Another option is to make the two variables into one, with four levels (yes yes, yes no, no yes, and no no) and then do the regression, using one combination as the reference level (I suggest "no no"). This ought to be equivalent but may be clearer output.

I wonder why you chose 0.001 for sig level? In any case, I wouldn't worry too much about p values.

$\endgroup$
2
  • $\begingroup$ Hi Peter, thank you so much for the answer, this really helps already. I just have a few questions: - As I understand now, does it make more sense to just make use of model 1 and 3? - I am not completely sure yet how to give the predicted value for each category, do you have suggestions for that? What I did however, is plotting the values of the variables in model 3 to create an interaction graph ( I used the two way linear interaction graph provided by jeremydawson.co.uk/slopes.htm) is that a correct way to interpret it too? $\endgroup$
    – user234
    Commented Jul 19, 2023 at 7:43
  • $\begingroup$ Yes, I would use either model 1 or 3, or the alternate that I proposed. The predicted values should be available in your software. In R, the glm.nb function will output fitted.values. The graph you linked to looks fine, although you could do the same thing within R and save yourself some effort. $\endgroup$
    – Peter Flom
    Commented Jul 19, 2023 at 11:03

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.