setwd("C:/Users/Risheel/Desktop/2018 DAM")
dat<-read.csv("PricePromoData.csv")
head(dat)
## STORE Hval_150 WEEK OUNCES UPC_X deal_X feat_X oz_X pack_X UPC_Y
## 1 62 0.09001 101 72 4.9e+09 Yes No 13032 181 1200000044
## 2 62 0.09001 102 72 4.9e+09 No Yes 3384 47 1200000044
## 3 62 0.09001 103 72 4.9e+09 No No 2088 29 1200000044
## 4 62 0.09001 104 72 4.9e+09 Yes Yes 35064 487 1200000044
## 5 62 0.09001 105 72 4.9e+09 Yes Yes 26640 370 1200000044
## 6 62 0.09001 106 72 4.9e+09 No No 2304 32 1200000044
## deal_Y feat_Y oz_Y pack_Y pX pY cx cY class
## 1 No No 2088 29 0.025 0.028 0.021 0.022 lit
## 2 No No 3960 55 0.028 0.030 0.023 0.025 lit
## 3 No Yes 19296 268 0.030 0.028 0.025 0.022 lit
## 4 No No 576 8 0.021 0.030 0.017 0.025 lit
## 5 No No 3312 46 0.022 0.028 0.018 0.022 lit
## 6 No No 1800 25 0.030 0.030 0.025 0.024 lit
Q.1. Measure the own price elasticity of X
Mod1<-log(oz_X)~log(pX)
fitmod<-lm(Mod1,data = dat)
summary(fitmod)
##
## Call:
## lm(formula = Mod1, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6564 -0.2395 -0.0788 0.1190 1.2732
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -16.5304 0.3840 -43.05 <2e-16 ***
## log(pX) -6.9446 0.1074 -64.63 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3671 on 726 degrees of freedom
## Multiple R-squared: 0.8519, Adjusted R-squared: 0.8517
## F-statistic: 4177 on 1 and 726 DF, p-value: < 2.2e-16
Q.2. Measure the own price elasticity of Y
Mod2<-log(oz_Y)~log(pY)
fitmod1<-lm(Mod2,data = dat)
summary(fitmod1)
##
## Call:
## lm(formula = Mod2, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.9059 -0.6063 0.0550 0.6057 3.4900
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -15.5981 0.8990 -17.35 <2e-16 ***
## log(pY) -6.6942 0.2519 -26.57 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9671 on 726 degrees of freedom
## Multiple R-squared: 0.4931, Adjusted R-squared: 0.4924
## F-statistic: 706.1 on 1 and 726 DF, p-value: < 2.2e-16
Q.3. Qualitatively compare the elasticities. What do you infer? The price elasticity for X is higher than Y.Hence, for every unit change in price in X, its demand will fluctuate more than that of Y.
CROSS PRICE ELASTICITY Measure the cross-price elasticity of X w.r.t Y
Mod2<-log(oz_X)~log(pY)
fitmod1<-lm(Mod2,data = dat)
summary(fitmod1)
##
## Call:
## lm(formula = Mod2, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.3777 -0.5510 -0.4059 -0.1456 2.5414
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.4395 0.8857 10.658 <2e-16 ***
## log(pY) 0.3268 0.2482 1.317 0.188
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9528 on 726 degrees of freedom
## Multiple R-squared: 0.002383, Adjusted R-squared: 0.001008
## F-statistic: 1.734 on 1 and 726 DF, p-value: 0.1883
Q.5. Measure the cross-price elasticity of Y w.r.t. X
Mod2<-log(oz_Y)~log(pX)
fitmod1<-lm(Mod2,data = dat)
summary(fitmod1)
##
## Call:
## lm(formula = Mod2, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.3541 -0.9954 -0.0906 0.9914 3.6652
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.1712 1.4169 7.884 1.16e-14 ***
## log(pX) 0.8120 0.3965 2.048 0.0409 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.354 on 726 degrees of freedom
## Multiple R-squared: 0.005745, Adjusted R-squared: 0.004376
## F-statistic: 4.195 on 1 and 726 DF, p-value: 0.0409
COMPARE OWN PRICE ELASTICITY WHEN A DEAL IS OFFERED
Measure the price elasticity of X when a deal is offered?
Mod3<-log(oz_X)~log(pX)+deal_X+log(pX)*deal_X
fitmod2<-lm(Mod3,data = dat)
summary(fitmod2)
##
## Call:
## lm(formula = Mod3, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.47804 -0.11484 -0.01953 0.06748 1.28798
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.4229 0.5048 -4.800 1.93e-06 ***
## log(pX) -2.9133 0.1435 -20.302 < 2e-16 ***
## deal_XYes -3.9397 1.3448 -2.930 0.0035 **
## log(pX):deal_XYes -1.4255 0.3588 -3.973 7.80e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2288 on 724 degrees of freedom
## Multiple R-squared: 0.9426, Adjusted R-squared: 0.9424
## F-statistic: 3966 on 3 and 724 DF, p-value: < 2.2e-16
Measure the price elasticity of Y when a deal is offered?
Mod4<-log(oz_Y)~log(pY)+deal_Y+log(pY)*deal_Y
fitmod3<-lm(Mod4,data = dat)
summary(fitmod3)
##
## Call:
## lm(formula = Mod4, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.83238 -0.61046 0.02982 0.60163 3.06752
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.5422 1.7345 -2.042 0.0415 *
## log(pY) -3.2352 0.4947 -6.539 1.17e-10 ***
## deal_YYes -7.0003 6.7669 -1.034 0.3013
## log(pY):deal_YYes -2.2084 1.7845 -1.238 0.2163
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.927 on 724 degrees of freedom
## Multiple R-squared: 0.5355, Adjusted R-squared: 0.5335
## F-statistic: 278.2 on 3 and 724 DF, p-value: < 2.2e-16
Are they the same? Or different? What do you infer?
They are different. The effect of promotions by product X is more on product Y.