Building Response Models in R
Kathrin Gruber
Assistant Professor of Econometrics Erasmus University Rotterdam
aggregate(log(SALES) ~ DISPLAY, FUN = mean, data = sales.data)
DISPLAY log(SALES)
1 0 4.194953
2 1 4.657477
dummy.model <- lm(log(SALES) ~ DISPLAY, data = sales.data)
coef(dummy.model)
(Intercept) DISPLAY
4.1950 0.4625
DISPLAY
exp(coef(dummy.model)[1])
(Intercept)
66.35063
DISPLAY
to DISPLAY
exp(coef(dummy.model)[2] - 1)
DISPLAY1
0.5842211
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
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
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
Building Response Models in R