Feeding the data
Pricedata = read.csv(paste("PricePromoData.csv", sep=""))
#library(psych)
#describe(Pricedata)
1. Measure the own price elasticity of X
#Own price elasticity of product X
loglogModel <- log(Pricedata$oz_X)~log(Pricedata$pX)
fitX <- lm(loglogModel,data=Pricedata)
summary(fitX)
##
## Call:
## lm(formula = loglogModel, data = Pricedata)
##
## 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(Pricedata$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
-6.9446
2. Measure the own price elasticity of Y
#Own price elasticity of product Y
loglogModel <- log(Pricedata$oz_Y)~log(Pricedata$pY)
fitY <- lm(loglogModel,data=Pricedata)
summary(fitY)
##
## Call:
## lm(formula = loglogModel, data = Pricedata)
##
## 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(Pricedata$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
-6.6942
Qualitatively compare the elasticities. What do you infer?
We can see that product X is showing more negative price elasticity than product Y which means that a slight % change in price of product x will generate more demand than product y.
4. Measure the cross-price elasticity of X w.r.t Y
#Cross price elasticity of product X w.r.t. Y
crosslogModel <- log(Pricedata$oz_X)~log(Pricedata$pY)
fitX <- lm(crosslogModel,data=Pricedata)
summary(fitX)
##
## Call:
## lm(formula = crosslogModel, data = Pricedata)
##
## 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(Pricedata$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
0.3268
5.Measure the cross-price elasticity of Y w.r.t. X
#Cross price elasticity of product Y w.r.t. X
crosslogModel <- log(Pricedata$oz_Y)~log(Pricedata$pX)
fitY <- lm(crosslogModel,data=Pricedata)
summary(fitY)
##
## Call:
## lm(formula = crosslogModel, data = Pricedata)
##
## 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(Pricedata$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
0.8120
6. Are they the same? Or different? What do you infer?
They are different and value of Cross price elasticity of product Y w.r.t. X is higher. It shows that with slight % increase in price of Y will yield more demand for product X.
7. Measure the price elasticity of X when a deal is (not) offered?
#Own price elasticity of product X under promotion
withPromoModel <- log(Pricedata$oz_X)~log(Pricedata$pX):Pricedata$deal_X
#withPromoModel <- log(Pricedata$oz_X)~log(Pricedata$pX) *Pricedata$deal_X
fitXpromo <-lm(withPromoModel,data=Pricedata)
summary(fitXpromo)
##
## Call:
## lm(formula = withPromoModel, data = Pricedata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.50837 -0.11509 -0.01762 0.06939 1.28990
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.9781 0.4703 -6.332 4.25e-10
## log(Pricedata$pX):Pricedata$deal_XNo -3.0711 0.1337 -22.970 < 2e-16
## log(Pricedata$pX):Pricedata$deal_XYes -3.4460 0.1242 -27.753 < 2e-16
##
## (Intercept) ***
## log(Pricedata$pX):Pricedata$deal_XNo ***
## log(Pricedata$pX):Pricedata$deal_XYes ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.23 on 725 degrees of freedom
## Multiple R-squared: 0.942, Adjusted R-squared: 0.9418
## F-statistic: 5883 on 2 and 725 DF, p-value: < 2.2e-16
8. Is the price elasticity of X when a deal is offered different than the price elasticity when a deal is not offered?
Yes they are different.
9. Measure the price elasticity of Y when a deal is (not) offered?
#Own price elasticity of product Y under promotion
withPromoModel <- log(Pricedata$oz_Y)~log(Pricedata$pY):Pricedata$deal_Y
fitYpromo <-lm(withPromoModel,data=Pricedata)
summary(fitYpromo)
##
## Call:
## lm(formula = withPromoModel, data = Pricedata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.83232 -0.62545 0.02988 0.60166 3.06757
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.0021 1.6767 -2.387 0.0172
## log(Pricedata$pY):Pricedata$deal_YNo -3.3663 0.4782 -7.039 4.49e-12
## log(Pricedata$pY):Pricedata$deal_YYes -3.7292 0.4400 -8.476 < 2e-16
##
## (Intercept) *
## log(Pricedata$pY):Pricedata$deal_YNo ***
## log(Pricedata$pY):Pricedata$deal_YYes ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9271 on 725 degrees of freedom
## Multiple R-squared: 0.5348, Adjusted R-squared: 0.5335
## F-statistic: 416.7 on 2 and 725 DF, p-value: < 2.2e-16
10. Is the price elasticity of Y when a deal is offered different than the price elasticity when a deal is not offered?
Yes they are different.