Model genişletmeleri 1: Kukla değişkenler

R ile Tepki Modelleri Oluşturma

Kathrin Gruber

Assistant Professor of Econometrics Erasmus University Rotterdam

Kukla değişkenler

R ile Tepki Modelleri Oluşturma

Kukla değişkenleri anlama

aggregate(log(SALES) ~ DISPLAY, FUN = mean, data = sales.data)
  DISPLAY log(SALES)
1       0   4.194953
2       1   4.657477
R ile Tepki Modelleri Oluşturma
dummy.model <- lm(log(SALES) ~ DISPLAY, data = sales.data)
coef(dummy.model)
(Intercept)      DISPLAY  
     4.1950       0.4625
  • DISPLAY yokken ortalama birim satış
exp(coef(dummy.model)[1])
(Intercept) 
   66.35063
  • DISPLAY yoktan DISPLAY var durumuna geçiş
exp(coef(dummy.model)[2] - 1)
 DISPLAY1 
0.5842211
R ile Tepki Modelleri Oluşturma

Birden çok kuklanın satışlara etkisi (1)

aggregate(log(SALES) ~ DISPLAY + COUPON + DISPLAYCOUPON, FUN = mean, 
          data = sales.data)
  DISPLAY COUPON DISPLAYCOUPON log(SALES)
1       0      0             0   3.797571
2       1      0             0   4.657477
3       0      1             0   5.557327
4       0      0             1   5.946818
R ile Tepki Modelleri Oluşturma

Birden çok kuklanın satışlara etkisi (2)

aggregate(log(SALES) ~ DISPLAY + COUPON + DISPLAYCOUPON, FUN = mean, 
          data = sales.data)
  DISPLAY COUPON DISPLAYCOUPON log(SALES)
1       0      0             0   3.797571
2       1      0             0   4.657477
3       0      1             0   5.557327
4       0      0             1   5.946818
dummy.model <- lm(log(SALES) ~ DISPLAY + COUPON + DISPLAYCOUPON, 
                  data = sales.data)

coef(dummy.model)
  (Intercept)        DISPLAY         COUPON  DISPLAYCOUPON  
       3.7976         0.8599         1.7598         2.1492
R ile Tepki Modelleri Oluşturma

Peki ya fiyat?

lm(update(dummy.model, . ~ . + PRICE), data = sales.data)
Call:
lm(formula = update(dummy.model, . ~ . + PRICE), data = sales.data)

Coefficients:
  (Intercept)        DISPLAY         COUPON  DISPLAYCOUPON          PRICE  
       3.4310         0.8747         1.7646         2.1630         0.3123
R ile Tepki Modelleri Oluşturma

Hadi pratik yapalım!

R ile Tepki Modelleri Oluşturma

Preparing Video For Download...