0% found this document useful (0 votes)
151 views

Assignment1 Solution

Solution of assignment Analytics R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views

Assignment1 Solution

Solution of assignment Analytics R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

1.

Discuss the relevance of the variables “Natural Retailers” and


“Fitness Centers” in this study.
The variable Natural Retailers represents the number of other natural retailers within a 5-mile
radius of the store and the variable Fitness Retailers represents the number of fitness centers
within a 5-mile radius of the store.
To see the relevance of these variable we will these variable impact on weekly sales and how
they might influence consumer behavior and purchasing patterns.

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 248.430 7.328 33.900 <2e-16 ***
Natural 6.888 3.065 2.247 0.0248 *
Fitness -1.853 1.876 -0.988 0.3236

Residual standard error: 110.8 on 1383 degrees of freedom


Multiple R-squared: 0.004644, Adjusted R-squared: 0.003204
F-statistic: 3.226 on 2 and 1383 DF, p-value: 0.04001

 Natural_Retailers: The coefficient is -1.853, indicating that for each additional natural
retailer within a 5-mile radius, weekly sales decrease by 1.8 units. This suggests that
increased competition from other natural retailers negatively impacts sales.

 Fitness_Centers: The coefficient is 6.88, indicating that for each additional fitness center
within a 5-mile radius, weekly sales increase by 6 units. This suggests that the presence of
fitness centers positively impacts sales, likely due to the health-conscious demographic that
frequents fitness centers.

But the Adjusted R square is 0.003204 that is very less, which signifies that the model is not
appropriate to go forward.

The number of natural retailers represents the competitive landscape. More natural retailers
nearby means more competition, which can negatively impact GoodBelly’s sales.

The number of fitness centers indicates the presence of a target demographic that is likely to
purchase health-oriented products like GoodBelly.

2. Build a simple linear regression model using “Weekly Sales” as the


dependent variable and “Average Retail Price” as the independent
variable. Provide the regression equation. Interpret the model
output.

The regression model will be Weekly Sales = -4.506(Average Retail Price)+ 272.327
Interpretation:- For every one unit increase in Average retail price there will be decrease in
weekly sales by 4.506 units.

3. Build a simple linear regression model using “Weekly Sales” as the


dependent variable and “Endcap”as the independent variable.
Provide the regression equation. Interpret the model output in detail.
The regression model will be Weekly Sales = 343.229(Endcap)+ 240.696

Interpretation:- When an endcap display is used, weekly sales increase by 343.229 units on
average.

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 240.696 2.448 98.31 <2e-16 ***
Endcap 343.229 12.521 27.41 <2e-16 ***

4. Discuss in detail the model-building strategy with “Weekly Sales” as


the dependent variable.
On building the model with Weekly sales as a dependent variable,
with all other as a dependent variable we can compare the p values
of the different models
If the p-value (Pr(>|t|)) is small , we can reject the null hypothesis and conclude that there is a
statistically significant relationship between the predictor variable and the response variable.

Coefficients: (10 not defined because of singularities)


Estimate Std. Error t value Pr(>|t|)
(Intercept) 188.33720 40.26353 4.678 3.26e-06 ***
Date04-05-2010 1.69810 8.49636 0.200 0.841625
Date06-07-2010 -0.87078 8.21619 -0.106 0.915614
Date08-06-2010 -3.60298 8.21776 -0.438 0.661154
Date11-05-2010 11.06844 8.32713 1.329 0.184054
Date13-07-2010 9.71198 8.22036 1.181 0.237674
Date15-06-2010 1.68172 8.21024 0.205 0.837741
Date18-05-2010 0.12858 7.97022 0.016 0.987132
Date22-06-2010 15.45845 8.47172 1.825 0.068312 .
Date25-05-2010 -1.73674 7.86827 -0.221 0.825345
Date29-06-2010 6.48906 8.51341 0.762 0.446093
RegionMA 136.42810 26.71228 5.107 3.84e-07 ***
RegionMW 213.48865 49.30542 4.330 1.63e-05 ***
RegionNC 277.20571 35.01121 7.918 5.83e-15 ***
RegionNE 182.33187 27.90352 6.534 9.70e-11 ***
RegionPN 192.06364 29.12731 6.594 6.60e-11 ***
RegionRM 196.08378 29.36990 6.676 3.86e-11 ***
RegionSO 158.73124 26.06350 6.090 1.55e-09 ***
RegionSP 203.20160 29.27956 6.940 6.64e-12 ***
RegionSW 173.07861 32.63784 5.303 1.37e-07 ***
StoreAlamo Quarry -8.80316 25.21811 -0.349 0.727095
StoreAlpharetta (aka Alpharetta Harry's) 12.29141 32.05684 0.383 0.701477
StoreAnn Arbor -18.14724 32.01507 -0.567 0.570941
StoreAnnapolis 41.23157 25.44296 1.621 0.105398
StoreArroyo 20.71476 46.87840 0.442 0.658660
StoreBellaire -5.64545 46.81982 -0.121 0.904047
StoreBellevue 34.16552 25.55821 1.337 0.181570
StoreBelmar 0.96544 32.06410 0.030 0.975985
StoreBend -9.58154 32.19581 -0.298 0.766062
StoreBethesda -156.08247 47.39464 -3.293 0.001022 **
StoreBiscayne (aka Aventura) 179.40961 26.57377 6.751 2.35e-11 ***
StoreBoca Raton 168.15585 32.64878 5.150 3.07e-07 ***
StoreBowery 0.19423 25.32826 0.008 0.993883
StoreBridgeport 44.46877 25.70169 1.730 0.083874 .
StoreCedar Center 25.79802 32.08887 0.804 0.421594
StoreCerrillos (aka Santa Fe) 9.58723 25.71581 0.373 0.709358
StoreChelsea -1.26389 30.97286 -0.041 0.967457
StoreCobb (aka Cobb Harry's) 0.01524 32.04769 0.000 0.999621
StoreColumbus 41.21306 32.14681 1.282 0.200100
StoreColumbus Circle 33.98497 32.13261 1.058 0.290446
StoreCoral Gables 20.16272 32.02423 0.630 0.529080
StoreCoral Springs 174.78955 26.00509 6.721 2.87e-11 ***
StoreDeerfield 28.62660 25.25498 1.134 0.257247
StoreDuluth -7.29053 25.40787 -0.287 0.774212
StoreEdgewater 14.64979 32.05429 0.457 0.647738
StoreFair Lakes 27.83146 46.81341 0.595 0.552286
StoreFairfax 5.42186 32.01304 0.169 0.865541
StoreForest 21.10387 32.01271 0.659 0.509882
StoreFort Apache 9.24695 25.35106 0.365 0.715363
StoreFort Collins 14.06260 32.20643 0.437 0.662457
StoreFort Lauderdale 162.36056 47.23284 3.437 0.000609 ***
StoreFremont 33.25758 32.07073 1.037 0.299958
StoreFresno -75.83575 25.86523 -2.932 0.003437 **
StoreGalleria -49.70284 46.97555 -1.058 0.290259
StoreGeorgetown 25.99827 32.14530 0.809 0.418818
StoreGlendale 16.13269 32.03126 0.504 0.614604
StoreGold Coast -16.62458 46.91015 -0.354 0.723112
StoreGreen Hills -5.66365 32.02158 -0.177 0.859643
StoreHenderson 10.43892 32.12966 0.325 0.745318
StoreHighlands Ranch -26.16757 32.05041 -0.816 0.414417
StoreJamboree 7.32421 25.27688 0.290 0.772054
StoreJenkintown 38.88941 25.29186 1.538 0.124424
StoreJericho 17.77790 25.45684 0.698 0.485101
StoreKentlands 33.36895 46.90262 0.711 0.476953
StoreLake Calhoun (aka Minneapolis) -23.01547 46.83855 -0.491 0.623255
StoreLakeview -14.12875 32.00813 -0.441 0.659001
StoreLamar -9.44693 25.25016 -0.374 0.708376
StoreLas Vegas Blvd -21.16690 32.31545 -0.655 0.512597
StoreLos Altos -80.06100 32.49543 -2.464 0.013899 *
StoreLouisville 42.40800 64.36722 0.659 0.510132
StoreMarlton 33.70951 46.93306 0.718 0.472756
StoreMetcalf 24.01172 25.68116 0.935 0.349994
StoreMiddletown 43.19049 32.87015 1.314 0.189126
StoreMill Plain 27.63194 25.26390 1.094 0.274309
StoreMilwaukee -1.98535 25.23141 -0.079 0.937297
StoreMount Washington 16.52785 32.15888 0.514 0.607393
StoreMountain Brook 37.86831 25.22342 1.501 0.133558
StoreNapa -74.52099 32.48762 -2.294 0.021986 *
StoreNew Lincoln Park (aka Lincoln Park) 5.16613 32.05327 0.161 0.871986
StoreNorthbrook -12.25287 32.39075 -0.378 0.705293
StoreOld Town 10.61083 25.21509 0.421 0.673973
StoreP Street 53.32538 25.44221 2.096 0.036313 *
StorePacific Coast Highway (aka El Segundo) 2.90209 25.23991 0.115 0.908481
StorePalatine -18.90644 46.84430 -0.404 0.686583
StorePalm Beach Gardens 192.46334 25.95243 7.416 2.39e-13 ***
StoreParkway (aka Arlington) -24.59027 46.82187 -0.525 0.599557
StorePasadena -4.42202 32.01557 -0.138 0.890170
StorePearl 27.24916 25.63070 1.063 0.287947
StorePetaluma -44.42462 25.86827 -1.717 0.086195 .
StorePhiladelphia 52.75134 64.33279 0.820 0.412405
StorePike's Peak 29.58072 32.38465 0.913 0.361221
StorePlano -19.79849 32.08737 -0.617 0.537349
StorePlantation 179.15780 32.57848 5.499 4.73e-08 ***
StorePonce de Lyon 0.38870 32.07693 0.012 0.990334
StorePrinceton 20.10987 32.08082 0.627 0.530886
StoreRedmond 45.80446 32.47589 1.410 0.158697
StoreRedwood City 8.60841 32.10946 0.268 0.788675
StoreRegency (aka Omaha) -27.51798 25.51139 -1.079 0.280975
StoreRockville 31.07942 25.28460 1.229 0.219263
StoreRoosevelt Square 40.34350 47.08118 0.857 0.391689
StoreRose City -1.89706 25.28516 -0.075 0.940207
StoreRoseville -73.40255 25.99411 -2.824 0.004830 **
StoreSacramento -71.97269 32.57168 -2.210 0.027331 *
StoreSan Mateo -51.23286 32.46888 -1.578 0.114871
StoreSan Rafael -65.71151 33.10153 -1.985 0.047373 *
StoreSan Ramon -69.36568 25.76182 -2.693 0.007197 **
StoreSanta Cruz -57.88610 32.84159 -1.763 0.078245 .
StoreSanta Rosa -46.17296 32.50935 -1.420 0.155801
StoreSarasota NA NA NA NA
StoreSauganash -42.05782 64.42666 -0.653 0.514019
StoreShort Pump 30.95991 32.07571 0.965 0.334647
StoreSoMa -79.84666 47.15043 -1.693 0.090651 .
StoreSouth Loop -3.81953 64.32984 -0.059 0.952665
StoreStevens Creek (aka Cupertino) -19.03442 32.08054 -0.593 0.553079
StoreSuperior -7.39482 25.34210 -0.292 0.770494
StoreTamarac 28.60286 25.27691 1.132 0.258054
StoreTanasbourne -20.41751 32.12474 -0.636 0.525188
StoreThousand Oaks 23.21033 46.86638 0.495 0.620525
StoreTysons 34.70868 32.06013 1.083 0.279215
StoreUnion Square -3.90288 25.44722 -0.153 0.878133
StoreValencia 3.48690 32.01195 0.109 0.913282
StoreVeterans NA NA NA NA
StoreVienna NA NA NA NA
StoreWalnut Creek NA NA NA NA
StoreWest Bloomfield -13.76303 46.82618 -0.294 0.768876
StoreWest Orange 16.00830 32.13166 0.498 0.618435
StoreWest Paces Ferry NA NA NA NA
StoreWestlake NA NA NA NA
StoreWheaton -17.41324 32.01986 -0.544 0.586670
StoreWhite Plains NA NA NA NA
StoreWillowbrook NA NA NA NA
StoreWoodland Hills NA NA NA NA
Average.Retail.Price -41.90275 6.96477 -6.016 2.42e-09 ***
Sales.Rep 34.65519 13.31932 2.602 0.009395 **
Endcap 328.22040 11.41784 28.746 < 2e-16 ***
Demo 107.82292 7.77876 13.861 < 2e-16 ***
Demo1.3 69.66443 5.76094 12.093 < 2e-16 ***
Demo4.5 64.15476 6.89691 9.302 < 2e-16 ***
Natural -4.70620 19.72081 -0.239 0.811428
Fitness NA NA NA NA

From the output we can conclude that we can remove date, store , Natural, Fitness, as
models and for sales rep has a p value of 0.0077 with dicy conclusion and some of the
stores are showing better p value and also the adjusted R square of the model; increase
after keeping store so, we are keeping the store

Coefficients: (9 not defined because of singularities)


Estimate Std. Error t value Pr(>|t|)
(Intercept) 174.2996 31.2910 5.570 3.18e-08 ***
RegionMA 140.1838 26.4354 5.303 1.37e-07 ***
RegionMW 205.0106 28.9248 7.088 2.40e-12 ***
RegionNC 272.2588 28.4688 9.563 < 2e-16 ***
RegionNE 182.4621 27.7695 6.571 7.65e-11 ***
RegionPN 192.7711 28.9253 6.664 4.15e-11 ***
RegionRM 195.1656 29.1383 6.698 3.33e-11 ***
RegionSO 161.0027 25.9935 6.194 8.22e-10 ***
RegionSP 202.4958 29.1173 6.954 5.99e-12 ***
RegionSW 179.5191 25.9284 6.924 7.39e-12 ***
Average.Retail.Price -39.2299 5.7384 -6.836 1.33e-11 ***
Sales.Rep 34.1061 12.7869 2.667 0.00776 **
Endcap 331.4898 11.1015 29.860 < 2e-16 ***
Demo 112.5605 7.3177 15.382 < 2e-16 ***
Demo1.3 72.8611 5.1499 14.148 < 2e-16 ***
Demo4.5 67.6527 6.6595 10.159 < 2e-16 ***
StoreAlamo Quarry -8.9558 25.2175 -0.355 0.72255
StoreAlpharetta (aka Alpharetta Harry's) 8.2425 25.2548 0.326 0.74420
StoreAnn Arbor -14.2799 25.2356 -0.566 0.57160
StoreAnnapolis 38.4730 25.3912 1.515 0.13000
StoreArroyo 9.8966 25.2595 0.392 0.69528
StoreBellaire -15.3701 25.2242 -0.609 0.54242
StoreBellevue 33.7592 25.5488 1.321 0.18665
StoreBelmar -1.7214 25.3149 -0.068 0.94580
StoreBend -2.3947 25.3621 -0.094 0.92479
StoreBethesda -169.4040 25.9899 -6.518 1.07e-10 ***
StoreBiscayne (aka Aventura) 180.2730 25.9738 6.941 6.59e-12 ***
StoreBoca Raton 174.7071 25.9376 6.736 2.60e-11 ***
StoreBowery 0.5570 25.3078 0.022 0.98245
StoreBridgeport 45.7304 25.6862 1.780 0.07529 .
StoreCedar Center 20.2342 25.2825 0.800 0.42369
StoreCerrillos (aka Santa Fe) 11.5321 25.5898 0.451 0.65233
StoreChelsea -4.8346 25.2842 -0.191 0.84840
StoreCobb (aka Cobb Harry's) 5.3100 25.2470 0.210 0.83345
StoreColumbus 43.1727 25.3892 1.700 0.08933 .
StoreColumbus Circle 31.9242 25.4165 1.256 0.20936
StoreCoral Gables 15.8235 25.2369 0.627 0.53079
StoreCoral Springs 175.9296 25.9652 6.776 1.99e-11 ***
StoreDeerfield 28.5567 25.2501 1.131 0.25832
StoreDuluth -6.0913 25.3464 -0.240 0.81012
StoreEdgewater 11.1353 25.2972 0.440 0.65989
StoreFair Lakes 18.3249 25.2161 0.727 0.46755
StoreFairfax 1.2632 25.2280 0.050 0.96008
StoreForest 16.2710 25.2168 0.645 0.51890
StoreFort Apache 10.5046 25.3106 0.415 0.67820
StoreFort Collins 7.1962 25.3700 0.284 0.77673
StoreFort Lauderdale 155.2239 25.9942 5.971 3.15e-09 ***
StoreFremont 29.9607 25.3051 1.184 0.23667
StoreFresno -75.3205 25.8403 -2.915 0.00363 **
StoreGalleria -37.6781 25.3835 -1.484 0.13800
StoreGeorgetown 19.3747 25.3122 0.765 0.44418
StoreGlendale 11.8632 25.2328 0.470 0.63834
StoreGold Coast -5.3596 25.3034 -0.212 0.83229
StoreGreen Hills -0.6416 25.2244 -0.025 0.97971
StoreHenderson 16.4316 25.3160 0.649 0.51643
StoreHighlands Ranch -23.3418 25.3003 -0.923 0.35642
StoreJamboree 8.0027 25.2574 0.317 0.75142
StoreJenkintown 37.3893 25.2719 1.479 0.13929
StoreJericho 18.0811 25.4064 0.712 0.47681
StoreKentlands 22.2997 25.2842 0.882 0.37799
StoreLake Calhoun (aka Minneapolis) -12.8179 25.2309 -0.508 0.61154
StoreLakeview -9.9718 25.2286 -0.395 0.69273
StoreLamar -9.9583 25.2392 -0.395 0.69324
StoreLas Vegas Blvd -14.7621 25.4777 -0.579 0.56243
StoreLos Altos -75.6126 25.8247 -2.928 0.00348 **
StoreLouisville 27.2622 25.3116 1.077 0.28168
StoreMarlton 22.4295 25.3115 0.886 0.37573
StoreMetcalf 27.1404 25.6300 1.059 0.28986
StoreMiddletown 37.2393 25.9932 1.433 0.15223
StoreMill Plain 26.9875 25.2595 1.068 0.28556
StoreMilwaukee -1.9488 25.2303 -0.077 0.93844
StoreMount Washington 18.4262 25.3999 0.725 0.46833
StoreMountain Brook 38.1188 25.2211 1.511 0.13097
StoreNapa -78.4357 25.7844 -3.042 0.00240 **
StoreNew Lincoln Park (aka Lincoln Park) 8.2402 25.2919 0.326 0.74464
StoreNorthbrook -5.8954 25.5496 -0.231 0.81756
StoreOld Town 10.5812 25.2154 0.420 0.67484
StoreP Street 51.0043 25.3794 2.010 0.04470 *
StorePacific Coast Highway (aka El Segundo) 3.0123 25.2320 0.119 0.90499
StorePalatine -8.5815 25.2446 -0.340 0.73397
StorePalm Beach Gardens 194.0320 25.9186 7.486 1.43e-13 ***
StoreParkway (aka Arlington) -33.6490 25.2268 -1.334 0.18252
StorePasadena -8.6271 25.2250 -0.342 0.73241
StorePearl 24.2933 25.5154 0.952 0.34125
StorePetaluma -45.3587 25.8581 -1.754 0.07968 .
StorePhiladelphia 37.9989 25.2520 1.505 0.13266
StorePike's Peak 26.6576 25.6239 1.040 0.29841
StorePlano -23.6560 25.2811 -0.936 0.34962
StorePlantation 176.2186 25.9309 6.796 1.74e-11 ***
StorePonce de Lyon -3.5290 25.2721 -0.140 0.88897
StorePrinceton 22.9820 25.3030 0.908 0.36393
StoreRedmond 40.5948 25.7339 1.577 0.11497
StoreRedwood City 2.4420 25.2827 0.097 0.92307
StoreRegency (aka Omaha) -24.6810 25.4272 -0.971 0.33193
StoreRockville 29.6992 25.2704 1.175 0.24014
StoreRoosevelt Square 28.9007 25.5778 1.130 0.25875
StoreRose City -0.9281 25.2808 -0.037 0.97072
StoreRoseville -72.6376 25.9188 -2.803 0.00516 **
StoreSacramento -74.2539 25.8588 -2.872 0.00416 **
StoreSan Mateo -46.6518 25.7857 -1.809 0.07069 .
StoreSan Rafael -65.4429 26.6123 -2.459 0.01408 *
StoreSan Ramon -67.7305 25.7276 -2.633 0.00859 **
StoreSanta Cruz -60.1387 26.0787 -2.306 0.02129 *
StoreSanta Rosa -42.1815 25.8540 -1.632 0.10306
StoreSarasota NA NA NA NA
StoreSauganash -25.5136 25.3541 -1.006 0.31449
StoreShort Pump 34.8850 25.2710 1.380 0.16773
StoreSoMa -71.2328 25.8690 -2.754 0.00599 **
StoreSouth Loop 10.8872 25.2469 0.431 0.66639
StoreStevens Creek (aka Cupertino) -15.8762 25.3363 -0.627 0.53104
StoreSuperior -5.8313 25.3173 -0.230 0.81788
StoreTamarac 28.2253 25.2565 1.118 0.26400
StoreTanasbourne -13.8784 25.3027 -0.548 0.58346
StoreThousand Oaks 14.6574 25.2828 0.580 0.56221
StoreTysons 37.5028 25.2966 1.483 0.13848
StoreUnion Square -1.5599 25.4112 -0.061 0.95106
StoreValencia -1.3133 25.2161 -0.052 0.95847
StoreVeterans NA NA NA NA
StoreVienna NA NA NA NA
StoreWalnut Creek NA NA NA NA
StoreWest Bloomfield -3.9271 25.2241 -0.156 0.87631
StoreWest Orange 13.6149 25.4135 0.536 0.59225
StoreWest Paces Ferry NA NA NA NA
StoreWestlake NA NA NA NA
StoreWheaton -12.6753 25.2304 -0.502 0.61550
StoreWhite Plains NA NA NA NA
StoreWillowbrook NA NA NA NA
StoreWoodland Hills NA NA NA NA
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 59.14 on 1124 degrees of freedom


(143 observations deleted due to missingness)
Multiple R-squared: 0.7521, Adjusted R-squared: 0.7261
F-statistic: 28.9 on 118 and 1124 DF, p-value: < 2.2e-16

5. Divide the data set into two parts- a training set comprising 80% of
observations and a test set comprising the remaining observations.
Based on the training set, build a linear regression model using all
the relevant variables. Are all the variables significant? If not, build a
linear regression model using an appropriate set of variables. Which
model is better? Why?
We'll split the data into a training set (80%) and a test set (20%) then building an initial linear
regression model using all the relevant variables.

Call:
Residuals:
Min 1Q Median 3Q Max
-236.990 -34.560 0.003 34.999 270.409

Coefficients: (10 not defined because of singularities)


Estimate Std. Error t value Pr(>|t|)
(Intercept) 186.5528 45.2329 4.124 4.08e-05 ***
Date04-05-2010 6.4459 9.8619 0.654 0.513536
Date06-07-2010 -1.0477 9.5651 -0.110 0.912804
Date08-06-2010 -6.5472 9.3702 -0.699 0.484912
Date11-05-2010 10.2295 9.3748 1.091 0.275502
Date13-07-2010 6.1329 9.4528 0.649 0.516646
Date15-06-2010 -0.6180 9.4634 -0.065 0.947946
Date18-05-2010 0.2177 9.3836 0.023 0.981496
Date22-06-2010 15.7480 9.8199 1.604 0.109148
Date25-05-2010 2.0249 8.9562 0.226 0.821183
Date29-06-2010 0.4576 9.7437 0.047 0.962553
RegionMA 121.6876 29.5663 4.116 4.23e-05 ***
RegionMW 196.9861 51.7287 3.808 0.000150 ***
RegionNC 272.8745 38.2336 7.137 2.02e-12 ***
RegionNE 148.9362 31.1393 4.783 2.03e-06 ***
RegionPN 160.4986 33.4679 4.796 1.91e-06 ***
RegionRM 152.9482 39.6924 3.853 0.000125 ***
RegionSO 136.2929 30.3120 4.496 7.86e-06 ***
RegionSP 169.7370 33.0757 5.132 3.55e-07 ***
RegionSW 153.7419 36.1147 4.257 2.30e-05 ***
StoreAlamo Quarry -9.3550 27.9408 -0.335 0.737846
StoreAlpharetta (aka Alpharetta Harry's) 13.6601 34.3175 0.398 0.690692
StoreAnn Arbor -22.2995 34.7566 -0.642 0.521309
StoreAnnapolis 37.7022 26.6043 1.417 0.156800
StoreArroyo 35.1870 48.3876 0.727 0.467307
StoreBellaire -15.3891 48.8289 -0.315 0.752713
StoreBellevue 50.0119 30.8231 1.623 0.105051
StoreBelmar 26.5796 40.6500 0.654 0.513373
StoreBend 4.7037 35.8990 0.131 0.895785
StoreBethesda -234.1494 49.6706 -4.714 2.83e-06 ***
StoreBiscayne (aka Aventura) 157.4656 29.4074 5.355 1.10e-07 ***
StoreBoca Raton 159.7199 37.0053 4.316 1.77e-05 ***
StoreBowery 17.1091 27.2320 0.628 0.529992
StoreBridgeport 66.8762 29.5406 2.264 0.023829 *
StoreCedar Center 33.2664 33.6334 0.989 0.322898
StoreCerrillos (aka Santa Fe) 37.5421 36.7539 1.021 0.307330
StoreChelsea 18.8810 32.9109 0.574 0.566321
StoreCobb (aka Cobb Harry's) 22.8575 34.8562 0.656 0.512151
StoreColumbus 45.0305 34.4111 1.309 0.191017
StoreColumbus Circle 50.5315 33.7179 1.499 0.134329
StoreCoral Gables -29.5909 34.7919 -0.851 0.395277
StoreCoral Springs 154.5613 28.7426 5.377 9.74e-08 ***
StoreDeerfield 27.2749 28.7494 0.949 0.343033
StoreDuluth -17.7250 30.7790 -0.576 0.564846
StoreEdgewater 23.7243 35.9708 0.660 0.509724
StoreFair Lakes 28.8648 48.4273 0.596 0.551302
StoreFairfax 1.2438 34.8490 0.036 0.971538
StoreForest 21.0800 35.5106 0.594 0.552919
StoreFort Apache 27.3316 27.9967 0.976 0.329218
StoreFort Collins 34.1570 40.3829 0.846 0.397884
StoreFort Lauderdale 135.0893 49.8658 2.709 0.006881 **
StoreFremont 44.2312 34.3661 1.287 0.198419
StoreFresno -93.5963 27.6151 -3.389 0.000732 ***
StoreGalleria -37.1456 48.1941 -0.771 0.441067
StoreGeorgetown 14.5049 35.2976 0.411 0.681225
StoreGlendale 28.4653 34.1137 0.834 0.404272
StoreGold Coast -9.4515 48.0713 -0.197 0.844176
StoreGreen Hills 2.7340 35.5379 0.077 0.938696
StoreHenderson 30.8435 33.6682 0.916 0.359870
StoreHighlands Ranch -10.8452 41.2852 -0.263 0.792852
StoreJamboree 11.9125 27.1604 0.439 0.661062
StoreJenkintown 33.4507 26.4400 1.265 0.206157
StoreJericho 26.3868 28.0452 0.941 0.347037
StoreKentlands 20.1878 47.6125 0.424 0.671670
StoreLake Calhoun (aka Minneapolis) -15.0809 48.3885 -0.312 0.755373
StoreLakeview -15.7286 36.9151 -0.426 0.670159
StoreLamar -5.2252 28.6442 -0.182 0.855297
StoreLas Vegas Blvd -7.8067 34.5683 -0.226 0.821384
StoreLos Altos -98.7778 34.9632 -2.825 0.004834 **
StoreLouisville 51.8112 66.0961 0.784 0.433328
StoreMarlton 16.9927 48.1158 0.353 0.724054
StoreMetcalf 49.2185 35.9408 1.369 0.171221
StoreMiddletown 41.9980 35.8545 1.171 0.241783
StoreMill Plain 42.4498 28.0090 1.516 0.129993
StoreMilwaukee 2.7304 28.6542 0.095 0.924110
StoreMount Washington 16.1036 32.6330 0.493 0.621802
StoreMountain Brook 43.1021 27.3937 1.573 0.115986
StoreNapa -103.0779 34.3792 -2.998 0.002793 **
StoreNew Lincoln Park (aka Lincoln Park) 1.0618 33.5595 0.032 0.974766
StoreNorthbrook -15.2066 34.1373 -0.445 0.656104
StoreOld Town 7.4046 27.0708 0.274 0.784514
StoreP Street 46.0010 26.6371 1.727 0.084534 .
StorePacific Coast Highway (aka El Segundo) 5.9688 27.1059 0.220 0.825765
StorePalatine -21.3751 47.9769 -0.446 0.656049
StorePalm Beach Gardens 168.9366 32.5042 5.197 2.52e-07 ***
StoreParkway (aka Arlington) -30.1830 48.8835 -0.617 0.537102
StorePasadena 11.4437 33.5236 0.341 0.732915
StorePearl 29.5565 36.6455 0.807 0.420146
StorePetaluma -63.2522 28.1298 -2.249 0.024791 *
StorePhiladelphia 46.2016 64.9385 0.711 0.476987
StorePike's Peak 47.5829 40.9639 1.162 0.245727
StorePlano -13.0822 34.3541 -0.381 0.703442
StorePlantation 158.3278 34.8674 4.541 6.40e-06 ***
StorePonce de Lyon 7.1936 34.3209 0.210 0.834030
StorePrinceton 29.2472 33.6295 0.870 0.384713
StoreRedmond 55.8639 34.3965 1.624 0.104716
StoreRedwood City -25.6284 35.8909 -0.714 0.475380
StoreRegency (aka Omaha) -32.1928 29.0711 -1.107 0.268439
StoreRockville 29.1390 28.0905 1.037 0.299874
StoreRoosevelt Square 54.7563 49.2486 1.112 0.266519
StoreRose City 8.5224 27.1464 0.314 0.753640
StoreRoseville -87.9720 29.0044 -3.033 0.002493 **
StoreSacramento -85.0519 35.7802 -2.377 0.017668 *
StoreSan Mateo -81.4139 34.9097 -2.332 0.019923 *
StoreSan Rafael -83.6652 35.8955 -2.331 0.019994 *
StoreSan Ramon -79.4045 31.9500 -2.485 0.013134 *
StoreSanta Cruz -88.3678 44.8972 -1.968 0.049362 *
StoreSanta Rosa -59.0093 35.6944 -1.653 0.098658 .
StoreSarasota NA NA NA NA
StoreSauganash -45.8316 65.7117 -0.697 0.485700
StoreShort Pump 18.2142 34.2724 0.531 0.595242
StoreSoMa -84.0027 48.8777 -1.719 0.086041 .
StoreSouth Loop 0.3662 65.5572 0.006 0.995544
StoreStevens Creek (aka Cupertino) -43.9311 34.1857 -1.285 0.199112
StoreSuperior 12.7082 35.1076 0.362 0.717456
StoreTamarac 44.0405 45.2170 0.974 0.330339
StoreTanasbourne 0.3601 36.5157 0.010 0.992134
StoreThousand Oaks 26.7371 48.9429 0.546 0.585007
StoreTysons 41.7095 34.2404 1.218 0.223504
StoreUnion Square 15.5436 28.0434 0.554 0.579539
StoreValencia 21.1717 34.8005 0.608 0.543100
StoreVeterans NA NA NA NA
StoreVienna NA NA NA NA
StoreWalnut Creek NA NA NA NA
StoreWest Bloomfield -14.4288 47.6202 -0.303 0.761965
StoreWest Orange 36.8971 33.7883 1.092 0.275135
StoreWest Paces Ferry NA NA NA NA
StoreWestlake NA NA NA NA
StoreWheaton -21.6734 33.0657 -0.655 0.512344
StoreWhite Plains NA NA NA NA
StoreWillowbrook NA NA NA NA
StoreWoodland Hills NA NA NA NA
Average.Retail.Price -37.7070 8.1437 -4.630 4.22e-06 ***
Sales.Rep 32.7310 14.7868 2.214 0.027123 *
Endcap 332.9231 13.1792 25.261 < 2e-16 ***
Demo 109.7428 8.7638 12.522 < 2e-16 ***
Demo1.3 73.5836 6.5837 11.177 < 2e-16 ***
Demo4.5 66.9684 7.8637 8.516 < 2e-16 ***
Natural -1.4835 19.7728 -0.075 0.940211
Fitness NA NA NA NA
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 58.86 on 862 degrees of freedom


(116 observations deleted due to missingness)
Multiple R-squared: 0.7625, Adjusted R-squared: 0.727
F-statistic: 21.46 on 129 and 862 DF, p-value: < 2.2e-16
From the summary output, we identified which variables are significant. Typically, variables
with p-values less than 0.05 are considered significant then building a new model using only
the significant variables identified in the previous step.

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 291.000 19.263 15.106 < 2e-16 ***
Average.Retail.Price -25.973 4.686 -5.543 3.71e-08 ***
Sales.Rep 82.546 4.522 18.254 < 2e-16 ***
Endcap 295.784 10.380 28.496 < 2e-16 ***
Demo 108.424 8.575 12.644 < 2e-16 ***
Demo1.3 69.290 5.791 11.965 < 2e-16 ***
Natural -1.019 2.122 -0.480 0.631
Fitness -1.366 1.267 -1.078 0.281
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 67.06 on 1100 degrees of freedom


Multiple R-squared: 0.636, Adjusted R-squared: 0.6337
F-statistic: 274.6 on 7 and 1100 DF, p-value: < 2.2e-16

Now compairing AIC of both models

df AIC
mod.8 131 11023.06
mod.9 9 12474.05

Based on this we choose model 9

The regression model will be Weekly Sales = -25.973 (Average Retail Price)+-82.546(Sales
Rep)+ 295.784(Endcap)+ 108.424 (Demo)+ 69.290(Demo1.3)-1.019(Natural)-1.366(Fitness) +
272.327

Interpretation:- For every one unit increase in Average retail price, sales rep, endcap, Demo,
Demo1.3, Natural and Fitness there will be increase in weekly sales by 527.688 units.

6. Evaluate the performance of your suggested model using an


appropriate cross-validation method.
Linear Regression

1108 samples
7 predictor

No pre-processing
Resampling: Cross-Validated (10 fold)
Summary of sample sizes: 998, 998, 997, 997, 998, 997, ...
Resampling results:
RMSE Rsquared MAE
67.30908 0.6216211 49.21859

Tuning parameter 'intercept' was held constant at a value of TRUE

 The model appears to have a reasonably good fit with an R-squared value of
approximately 0.622, suggesting that the predictors explain a significant portion of the
variance in the outcome variable.
 The RMSE of 67.30908 and MAE of 49.21859 provide information about the prediction
accuracy. These values can be considered in the context of the scale of the outcome variable
to judge if they are acceptable.
 The inclusion of the intercept term helps in adjusting the predictions to better match the
actual data.

7. Is there any contradiction in your findings in (e) as opposed to the


observations made in (b) and (c)?
If yes, briefly explain the same.
Yes, there is a contradiction as in model used in b the weekly sales is decreased by 4.506
by the impact of unit increment Average.reatil.price where as in model used in e impact of
Average.reatil.price is much higher i.e. -25.973. Also the impact of end cap was much
higher in model used in c i.e. +343.229 whereas +295.784 in model used in e.

8. Interpret the regression output of your chosen model in detail.


The regression model will be Weekly Sales = -25.973 (Average Retail Price)+-82.546(Sales
Rep)+ 295.784(Endcap)+ 108.424 (Demo)+ 69.290(Demo1.3)-1.019(Natural)-1.366(Fitness)
+ 272.327

Interpretation:- For every one unit increase in Average retail price, sales rep, endcap, Demo,
Demo1.3, Natural and Fitness there will be increase in weekly sales by 527.688 units.

9. Does the in-store demo program boost sales? If so, for how long
does the sales lift last? Estimate the effect of the in-store demo
program on the “Weekly Sales”

To estimate the effect of the in-store demo program on weekly sales, we examined the
coefficients for Demo, Demo1-3, and Demo4-5

Estimate Std. Error t value Pr(>|t|)


Demo 111.08654 8.295044 13.391917 5.380777e-38
Demo1.3 69.81041 5.598536 12.469404 1.791602e-33
Demo4.5 65.03667 7.359006 8.837698 3.804712e-18
Estimating the Sales Lift

To quantify the sales lift from the in-store demo program, we sum the effects over the
weeks:

Total Sales Lift

 Immediate Week: 111.1 units


 1-3 Weeks After: 69.8 units
 4-5 Weeks After: 65.0 units

Total estimated sales lift from a single demo: 111.1+69.8+65.0=245.9 units111.1 + 69.8 +
65.0 = 245.9 \text{ units}111.1+69.8+65.0=245.9 units

Conclusion

The in-store demo program significantly boosts sales, with the lift lasting for up to 5 weeks.
The immediate impact in the demo week is the highest, adding approximately 111.1 units.
This positive effect continues but diminishes over the next 4-5 weeks, with additional lifts of
69.8 and 65.0 units respectively.

10. What are your recommendations to GoodBelly’s management?


Discuss in detail using your chosen model
The recommendations that we provide are
 Schedule Regular Demos: Plan in-store demos at least every 4-5 weeks to maintain the
sales lift.
 Maximize Demo Impact: Ensure that demos are well-promoted and executed to capture the
maximum sales boost.
 Analyze Further: Continuously monitor and analyze the performance of the demos to refine
strategies and optimize their effectiveness.
 Combine Promotions: Leverage other promotional activities like endcaps in conjunction
with demos to further enhance sales.

The in-store demo program significantly boosts sales, with the lift lasting for up to 5 weeks.
The immediate impact in the demo week is the highest, adding approximately 111.1 units.
This positive effect continues but diminishes over the next 4-5 weeks, with additional lifts of
69.8 and 65.0 units respectively.

R – Code

 d=read.csv(file.choose())
 install.packages("tidyverse")
 library(tidyverse)
 is.na(d)
 attach(d)
 head(d)
 mod.1=lm(Units.Sold~Natural+Fitness,data=d)
 summary(mod.1)
 mod.2=lm(Average.Retail.Price~Natural+Fitness,data=d)
 summary(mod.2)
 mod.3=lm( Units.Sold~Average.Retail.Price,data=d)
 summary(mod.3)
 mod.4=lm(Units.Sold~Endcap,data=d)
 summary(mod.4)
 mod.5=lm(Units.Sold~Date+Region+Store+Average.Retail.Price+Sales.Rep+Endcap+Demo+D
emo1.3+Demo4.5+Natural+Fitness,data=d)
 summary(mod.5)
 mod.6=lm(Units.Sold~Region+Average.Retail.Price+Sales.Rep+Endcap+Demo+Demo1.3+De
mo4.5+Store,data=d)
 summary(mod.6)
 mod.7=lm(Units.Sold~Average.Retail.Price + Endcap + Demo, data = d)
 summary(mod.7)

 Sales.Rep <- as.factor(Sales.Rep)


 Endcap <- as.factor(Endcap)
 Demo <- as.factor(Demo)
 Demo1.3 <- as.factor(Demo1.3)
 Demo4.5 <- as.factor(Demo4.5)
 set.seed(123)
 d=read.csv(file.choose())
 set.seed(123)
 train_indices <- sample(seq_len(nrow(d)), size = 0.8 * nrow(d))
 train1 <- d[train_indices, ]
 test1 <- d[-train_indices, ]
 mod.8 <- lm(Units.Sold ~ ., data = train1)
 summary(mod.8)
 mod.9 <- lm(Units.Sold ~ Average.Retail.Price + Sales.Rep + Endcap + Demo + Demo1.3 +
Natural + Fitness, data = train1)
 summary(mod.9)
 AIC(mod.8, mod.9)
 install.packages("caret")
 library(caret)
 train_control <- trainControl(method = "cv", number = 10)
 mod.10 <- train(Units.Sold ~ Average.Retail.Price + Sales.Rep + Endcap + Demo + Demo1.3 +
Natural + Fitness, data = train1, method = "lm", trControl = train_control)
 print(mod.10)
 mod.11 <- train(Units.Sold ~ Average.Retail.Price + Sales.Rep + Endcap + Demo + Demo1.3+
Demo4.5 + Natural + Fitness, data = train1, method = "lm", trControl = train_control)
 coef(summary(mod.11))[c("Demo", "Demo1.3", "Demo4.5"), ]
 str(d)

You might also like