Linear regression with product of factor and independent variable

前端 未结 1 1627
轻奢々
轻奢々 2021-01-23 21:37

I am try to estimate a demand model:

d_t^k = a_t - b^k p_t^k + e_t^k

The indices t are for week number, k are for pro

相关标签:
1条回答
  • 2021-01-23 22:00

    After doing some experimentation, it seems that

    lm(demand ~ factor(week) + factor(product) * price, data = df)
    

    does work.

    I don't know why I hadn't thought it would work earlier.

    0 讨论(0)
提交回复
热议问题