# complex Difference-in-difference formula

I have 5-year sales information from a grocery store in Canada. I want to check whether an event that happened in 2017, affected the effect of the price of a product on its sales.

For example, imagine that before treatment price elasticity (i.e. the degree to which changes in price impact the unit sales of a product) for diary goods was -0.05, I am eager to know whether my treatment changed it or not. Actually, I already know that price influences sales, but I suspect that the imposition of the treatment might alter the consumers' price sensitivity.

The standard DiD model only investigates the impact of treatment on the outcome variable. While I need to see whether the treatment has affected the coefficient of the regression model (Sales ~ Price) or not. In other words, I need to check whether the treatment affected the relationship between my independent variable (Price) and dependent variable (Sales). Would you please guide me on what formula should I use as the standard difference-in-difference model does not seem to be working here?

$$log(Outcome_{it})= \beta_1 + \beta_2Treat_{i} + \beta_3 Post_{t} + \beta_4 (Treat \times Post)_{it} + \epsilon_{it}$$

can I use the below model instead?

$$log(Sales_{it})= \beta_1 + \beta_2Treat_{i} \times Price_{it} + \beta_3 Post_{t} \times Price_{i} + \beta_4 DiD_{it} \times Price_{it} + \epsilon_{it}$$

where DiD is:

$$DiD = Treat \times Post$$

• Welcome. Your equation is correct, so it may be a problem with how you coded the variables. Could you describe how you coded each variable in the model? Or, maybe try posting your output? Doing so will help you get the best possible answer. Jan 7 at 22:06
• Hi, thanks, I used my DiD model as below : linModel <- lm(log(sales) ~ Treat* Var1 + Post * Var1 + DiD * Var1 , data=mydata) where DiD is (Treat * Post), and I want to check whether the coefficient of the Var1 has changed. is my model correct instead of standard DiD model? Jan 7 at 23:23
• I added it to my question as well. Jan 7 at 23:31
• What is $Var_1$? Is it a covariate? And, what do you mean when you say the model is not working? Jan 7 at 23:37
• Var1 is my primary interest. I meant that the standard DiD model only investigates the impact of treatment on the outcome variable. However, I need to check whether the treatment affected the relationship between my independent variable and dependent variable. For example, imagine that before treatment price elasticity for diary good was -0.05, I am eager to know whether my treatment changed it or not. Jan 8 at 0:21