Mean of Profit:
store.df <- read.csv(paste("Store24.csv", sep=""))
View(store.df)
mean(store.df$Profit)
## [1] 276313.6
Standard deviation of Profit:
sd(store.df$Profit)
## [1] 89404.08
Mean of Manager Tenure:
mean(store.df$MTenure)
## [1] 45.29644
Standard deviation of Manager Tenure:
sd(store.df$MTenure)
## [1] 57.67155
Mean of Crew tenure:
mean(store.df$CTenure)
## [1] 13.9315
Standard deviation of Crew tenure:
sd(store.df$CTenure)
## [1] 17.69752
Ten store with Maximum Profit:
newd.df<-store.df[order(-store.df$Profit),]
newd.df[c(1:10),c(1:5)]
## store Sales Profit MTenure CTenure
## 74 74 1782957 518998 171.09720 29.519510
## 7 7 1809256 476355 62.53080 7.326488
## 9 9 2113089 474725 108.99350 6.061602
## 6 6 1703140 469050 149.93590 11.351130
## 44 44 1807740 439781 182.23640 114.151900
## 2 2 1619874 424007 86.22219 6.636550
## 45 45 1602362 410149 47.64565 9.166325
## 18 18 1704826 394039 239.96980 33.774130
## 11 11 1583446 389886 44.81977 2.036961
## 47 47 1665657 387853 12.84790 6.636550
Ten store with Minimum profit:
newd.df<-store.df[order(store.df$Profit),]
newd.df[c(1:10),c(1:5)]
## store Sales Profit MTenure CTenure
## 57 57 699306 122180 24.3485700 2.956879
## 66 66 879581 146058 115.2039000 3.876797
## 41 41 744211 147327 14.9180200 11.926080
## 55 55 925744 147672 6.6703910 18.365500
## 32 32 828918 149033 36.0792600 6.636550
## 13 13 857843 152513 0.6571813 1.577002
## 54 54 811190 159792 6.6703910 3.876797
## 52 52 1073008 169201 24.1185600 3.416838
## 61 61 716589 177046 21.8184200 13.305950
## 37 37 1202917 187765 23.1985000 1.347023
draw a scatter plot of Profit vs. MTenure.
attach(store.df)
plot(store.df$MTenure,store.df$Profit,cex=0.6,abline(lm(Profit~MTenure),col="red"))
draw a scatter plot of Profit vs. CTenure.
plot(store.df$CTenure,store.df$Profit,cex=0.6,abline(lm(Profit~MTenure),col="red"))
Correlation between Between Each variable of store24:
round(cor(store.df),digits = 2)
## store Sales Profit MTenure CTenure Pop Comp Visibility
## store 1.00 -0.23 -0.20 -0.06 0.02 -0.29 0.03 -0.03
## Sales -0.23 1.00 0.92 0.45 0.25 0.40 -0.24 0.13
## Profit -0.20 0.92 1.00 0.44 0.26 0.43 -0.33 0.14
## MTenure -0.06 0.45 0.44 1.00 0.24 -0.06 0.18 0.16
## CTenure 0.02 0.25 0.26 0.24 1.00 0.00 -0.07 0.07
## Pop -0.29 0.40 0.43 -0.06 0.00 1.00 -0.27 -0.05
## Comp 0.03 -0.24 -0.33 0.18 -0.07 -0.27 1.00 0.03
## Visibility -0.03 0.13 0.14 0.16 0.07 -0.05 0.03 1.00
## PedCount -0.22 0.42 0.45 0.06 -0.08 0.61 -0.15 -0.14
## Res -0.03 -0.17 -0.16 -0.06 -0.34 -0.24 0.22 0.02
## Hours24 0.03 0.06 -0.03 -0.17 0.07 -0.22 0.13 0.05
## CrewSkill 0.05 0.16 0.16 0.10 0.26 0.28 -0.04 -0.20
## MgrSkill -0.07 0.31 0.32 0.23 0.12 0.08 0.22 0.07
## ServQual -0.32 0.39 0.36 0.18 0.08 0.12 0.02 0.21
## PedCount Res Hours24 CrewSkill MgrSkill ServQual
## store -0.22 -0.03 0.03 0.05 -0.07 -0.32
## Sales 0.42 -0.17 0.06 0.16 0.31 0.39
## Profit 0.45 -0.16 -0.03 0.16 0.32 0.36
## MTenure 0.06 -0.06 -0.17 0.10 0.23 0.18
## CTenure -0.08 -0.34 0.07 0.26 0.12 0.08
## Pop 0.61 -0.24 -0.22 0.28 0.08 0.12
## Comp -0.15 0.22 0.13 -0.04 0.22 0.02
## Visibility -0.14 0.02 0.05 -0.20 0.07 0.21
## PedCount 1.00 -0.28 -0.28 0.21 0.09 -0.01
## Res -0.28 1.00 -0.09 -0.15 -0.03 0.09
## Hours24 -0.28 -0.09 1.00 0.11 -0.04 0.06
## CrewSkill 0.21 -0.15 0.11 1.00 -0.02 -0.03
## MgrSkill 0.09 -0.03 -0.04 -0.02 1.00 0.36
## ServQual -0.01 0.09 0.06 -0.03 0.36 1.00
Correlation between Profit and Manager Tenure:
round(cor(store.df[,c(3,4)]),digits = 2)
## Profit MTenure
## Profit 1.00 0.44
## MTenure 0.44 1.00
Correlation between Profit and Crew Tenure:
round(cor(store.df[,c(3,5)]),digits = 2)
## Profit CTenure
## Profit 1.00 0.26
## CTenure 0.26 1.00
Corrgram Between each variable of store24:
library(corrgram)
corrgram(store.df, order=TRUE, lower.panel=panel.shade,
upper.panel=panel.pie, text.panel=panel.txt,
main="Corrgram of store variables")
Pvalue of test between Profit and Manager Tenure:
cor.test(store.df$Profit,store.df$MTenure)$p.value
## [1] 8.193133e-05
Pvalue of test between Profit and Crew Tenure:
cor.test(store.df$Profit,store.df$CTenure)$p.value
## [1] 0.0256203
Regression Between Profit and MTenure+CTenure+Pop+Comp+Visibility+PedCount+Res+Hours24 with displaying names variable whose Pvalue is significant:
fit<-lm(store.df$Profit ~ store.df$MTenure+store.df$CTenure+store.df$Pop+store.df$Comp+store.df$Visibility+store.df$PedCount+store.df$Res+store.df$Hours24)
which(summary(fit)$coefficients[,4]<0.05)
## store.df$MTenure store.df$CTenure store.df$Pop store.df$Comp
## 2 3 4 5
## store.df$PedCount store.df$Res store.df$Hours24
## 7 8 9
Displaying names variable whose Pvalue is not significant:
which(summary(fit)$coefficients[,4]>0.05)
## (Intercept) store.df$Visibility
## 1 6
Performed regression and then Storing the prdicted value of profit:
temp.df<-store.df
temp.df$MTenure<-temp.df$MTenure+1
temp.df$CTenure<-temp.df$CTenure+1
fit2<-lm(Profit~MTenure,data = temp.df)
fit3<-lm(Profit~CTenure,data = temp.df)
InprofitM<-fitted(fit2)
InprofitC<-fitted(fit3)
Difference in profit when Manager Tenure is increased by 1 month:
InprofitM - store.df$Profit
## 1 2 3 4 5 6
## -19517.710 -119849.657 39013.799 35374.290 -52345.751 -121545.193
## 7 8 9 10 11 12
## -188316.035 -115618.710 -155075.253 -11712.057 -113896.691 105604.531
## 13 14 15 16 17 18
## 93430.402 43368.790 41545.290 65315.312 1485.430 14720.147
## 19 20 21 22 23 24
## -13673.729 20525.346 -20678.707 -109042.937 -23489.653 8635.309
## 25 26 27 28 29 30
## -36627.710 34031.402 49394.559 -11287.201 -5180.490 -38213.043
## 31 32 33 34 35 36
## 33611.290 121009.725 -12061.021 -116850.952 -51955.321 54506.461
## 37 38 39 40 41 42
## 73514.332 52931.195 47973.791 106126.087 108318.728 -16876.685
## 43 44 45 46 47 48
## 29072.870 -70300.628 -132237.110 -66080.859 -133615.673 -17256.057
## 49 50 51 52 53 54
## 87911.808 3224.327 10477.271 92704.293 -80578.285 90242.474
## 55 56 57 58 59 60
## 102362.474 59525.206 139881.779 21002.716 -48518.699 -87772.012
## 61 62 63 64 65 66
## 83294.398 51126.860 12071.542 24339.290 46065.054 177816.977
## 67 68 69 70 71 72
## -112993.816 21028.103 -99873.158 1442.728 76834.356 134770.902
## 73 74 75
## -5707.519 -157096.155 -49787.174
Difference in profit when Crew Tenure is increased by 1 month:
InprofitC - store.df$Profit
## 1 2 3 4 5
## 25453.9802 -157189.5039 41986.8842 55048.9437 -33363.1300
## 6 7 8 9 10
## -196095.3525 -208639.3849 -29034.1421 -208655.9360 9747.3631
## 11 12 13 14 15
## -129055.9671 -62202.5039 107718.2864 456.5258 65261.4819
## 16 17 18 19 20
## 67995.8247 -2658.3552 -91895.4646 18794.2945 -3315.6229
## 21 22 23 24 25
## -15018.0705 -75071.1504 -14787.7278 -4727.7278 -10516.5349
## 26 27 28 29 30
## 72867.8896 50694.0422 7253.2945 24865.4239 -44935.2630
## 31 32 33 34 35
## 60321.2129 117784.4961 -29519.9813 -98317.2320 -45178.7573
## 36 37 38 39 40
## 66086.6374 72166.9139 57047.2864 44190.6306 57076.9206
## 41 42 43 44 45
## 126376.0822 106178.9360 -71912.3694 -33006.6073 -140038.3978
## 46 47 48 49 50
## -50758.7433 -121035.5039 -15255.8907 82019.5557 28078.7990
## 51 52 53 54 55
## 30072.2425 93425.2722 -96104.8907 103433.0187 134413.5247
## 56 57 58 59 60
## 72493.1519 139847.5258 35923.3913 -26970.9398 -89552.8765
## 61 62 63 64 65
## 98453.3125 64475.8700 28080.8700 38176.1670 -12969.2630
## 66 67 68 69 70
## 117167.0187 -99440.7278 24790.4055 -82380.3548 9022.0187
## 71 72 73 74 75
## 109601.9999 97138.7668 -12674.8765 -222392.8683 -27314.1442
Store24 should focus on manager tenure because it is the intesively correlated with profit of the store
Store24 should open there new store in highly populated area.
After manager tenure, crew tenure is also an important factor and store24 should work to increase the tenure of staff.