模型扩展第2部分:滞后效应

在 R 中构建响应模型

Kathrin Gruber

Assistant Professor of Econometrics Erasmus University Rotterdam

关于滞后

延续效应(Carry-over)

  • 营销活动到响应的时间跨度。
  • 通过向后移位评估多个时期。

如何做滞后?

head(cbind(sales.data$PRICE, 
           lag(sales.data$PRICE, n = 1)))
        [,1]     [,2]
[1,] 1.090000       NA
[2,] 1.271818 1.090000
[3,] 1.271818 1.271818
[4,] 1.271818 1.271818
[5,] 1.271818 1.271818
[6,] 1.271818 1.271818
在 R 中构建响应模型

加入价格的滞后效应

Price.lag <- lag(sales.data$PRICE)

lag.model <- lm(log(SALES) ~ PRICE + Price.lag, data = sales.data)
coef(lag.model)
(Intercept)        PRICE    Price.lag  
      3.906       -4.579        4.935
在 R 中构建响应模型

更多滞后项

Coupon.lag <-  lag(sales.data$COUPON)

lm(update(lag.model, . ~ . + COUPON + Coupon.lag), data = sales.data)
Call:
lm(formula = update(lag.model, . ~ . + COUPON + Coupon.lag), data = sales.data)

Coefficients:
(Intercept)        PRICE    Price.lag       COUPON   Coupon.lag  
     3.8327      -4.5050       4.8426       0.9697       0.3840
在 R 中构建响应模型

增值是什么?

lag.model <- lm(log(SALES) ~ PRICE + Price.lag + DISPLAY + Display.lag + 
                COUPON + Coupon.lag + DISPLAYCOUPON + DisplayCoupon.lag, 
                data = sales.data)

plot(log(SALES) ~ 1, data = sales.data) lines(c(NA, fitted.values(lag.model)) ~ 1)

在 R 中构建响应模型

让我们练习!

在 R 中构建响应模型

Preparing Video For Download...