Building Response Models in R
Kathrin Gruber
Assistant Professor of Econometrics Erasmus University Rotterdam
summary(extended.model)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.2561 0.5654 3.991 0.000117 ***
PRICE -2.6857 0.7921 -3.390 0.000959 ***
Price.lag 3.9920 0.7959 5.016 1.96e-06 ***
DISPLAY 0.4570 0.1279 3.572 0.000521 ***
Display.lag 0.5097 0.1180 4.319 3.36e-05 ***
COUPON 1.7531 0.1576 11.121 < 2e-16 ***
Coupon.lag -0.2098 0.1567 -1.339 0.183344
DISPLAYCOUPON 2.0087 0.2017 9.960 < 2e-16 ***
DisplayCoupon.lag 0.4489 0.2112 2.126 0.035695 *
Residual standard error: 0.5 on 114 degrees of freedom
(1 observation deleted due to missingness)
Multiple R-squared: 0.7135, Adjusted R-squared: 0.6934
F-statistic: 35.5 on 8 and 114 DF, p-value: < 2.2e-16
summary(extended.model)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.2561 0.5654 3.991 0.000117 ***
PRICE -2.6857 0.7921 -3.390 0.000959 ***
Price.lag 3.9920 0.7959 5.016 1.96e-06 ***
DISPLAY 0.4570 0.1279 3.572 0.000521 ***
Display.lag 0.5097 0.1180 4.319 3.36e-05 ***
COUPON 1.7531 0.1576 11.121 < 2e-16 ***
Coupon.lag -0.2098 0.1567 -1.339 0.183344
DISPLAYCOUPON 2.0087 0.2017 9.960 < 2e-16 ***
DisplayCoupon.lag 0.4489 0.2112 2.126 0.035695 *
Residual standard error: 0.5 on 114 degrees of freedom
(1 observation deleted due to missingness)
Multiple R-squared: 0.7135, Adjusted R-squared: 0.6934
F-statistic: 35.5 on 8 and 114 DF, p-value: < 2.2e-16
AIC(extended.model)
189.21
AIC(lm(update(extended.model, . ~ . - Coupon.lag), data = sales.data))
189.1284
library(MASS)
final.model <- stepAIC(extended.model, direction = "backward", trace = FALSE)
summary(final.model)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.1887 0.5651 3.873 0.000179 ***
PRICE -2.6888 0.7949 -3.383 0.000982 ***
Price.lag 4.0267 0.7982 5.045 1.71e-06 ***
DISPLAY 0.4524 0.1283 3.525 0.000609 ***
Display.lag 0.5447 0.1155 4.717 6.78e-06 ***
COUPON 1.7635 0.1580 11.161 < 2e-16 ***
DISPLAYCOUPON 1.9954 0.2021 9.872 < 2e-16 ***
DisplayCoupon.lag 0.4839 0.2103 2.301 0.023182 *
Residual standard error: 0.5017 on 115 degrees of freedom
(1 observation deleted due to missingness)
Multiple R-squared: 0.709, Adjusted R-squared: 0.6913
F-statistic: 40.04 on 7 and 115 DF, p-value: < 2.2e-16
Building Response Models in R