模型延伸(2):落後效應

在 R 中建立反應模型

Kathrin Gruber

Assistant Professor of Econometrics Erasmus University Rotterdam

關於落後值(lags)

延續效應(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...