Hi there! I've got a question concerning the mathematical formulation of a model containing an intercation between a categorical and a continue variables using lm function.

it's built this way :

lm(Y~X1*X2, data=data)

with

Y being the variable to predict

X1 being a continuous variable

X2 being a categorical variable.

I obtained estimates :

a - intercept

b1- estimate of the continuous effect

b2- estimate of the categorical variable having a different value for each level of X2

b3-estimate of the interaction having a different value for each level o X2.

Now the fitted values obtained with this model are pretty good and within the range of observed data. The thing is, when I try to apply this model in an other software to estimate Y, I formulated this way :

Y=a+b1X1+b2+b3X1

And this gives values which are not even realistic about what should be expected. Do you know how I should translate this interaction in my formula to get a correct estimation of Y?

because of data privacy, I can't produce a reprex to help, but in my mind, it is more a question related to the matematical formulation of the interaction within the lm function that something related to coding... Anyway, thanks for your help and I'll be happy to give you any possible precision