DAM PROJECT

GROUP 6

Impact of COD on E-commerce Sales

Navin Chandran
Deepak Krishnan
R Santosh Kumar
Sivaramakrishnan R
Karuppaiya A
P Mohan Prashanth
P Praveen

Describing Data

The objective of this project is to determine what factors effect the COD purchase of products on E-commerce.

Reading data

Libraries Used

Importing and cleaning data

cod.df = read.csv("PromotionDataV4.csv")
cod.df$isMetro <- ifelse(cod.df$ShippingCity %like% "Delhi" | cod.df$ShippingCity %like% "Mumbai" | cod.df$ShippingCity %like% "Kolkata" | cod.df$ShippingCity %like% "Chennai" | cod.df$ShippingCity %like% "Bangalore" | cod.df$ShippingCity %like% "Hyderabad",1,0)
cod.df$isAddressSame <- ifelse(cod.df$ShippingPincode == cod.df$BillingPincode,1,0)
cod <- subset(cod.df,FinalTotalPrice!=0)
attach(cod)

Unique Customers

cod.df$CustomerID <- as.numeric(cod.df$CustomerID)
unique_customers<-unique(cod.df$CustomerID)
length(unique_customers)
[1] 31869

Effect of City on COD

mytable <- xtabs(~COD + isMetro)
prop.table(mytable,2)*100
   isMetro
COD        0        1
  0 33.79280 46.82649
  1 66.20720 53.17351

Contrary to the populistic view that people in Metros prefer electronic payment, it is seen from the data that Metro cities are more inclined towards COD.

This could be attributed to the increased liquidity of money in the Metro cities.

Effect of Difference in Addresses on COD

mytable <- xtabs(~COD + isAddressSame)
prop.table(mytable,2)*100
   isAddressSame
COD        0        1
  0 36.10063 39.35489
  1 63.89937 60.64511

If the Billing Address and Shipping Address are different, then it might indicate that the product might be intended as a gift to someone else.

Correlation Matrix

cod_df <- cod[,c("FinalTotalPrice","COD","VendorDiscount","WebsiteDiscount")]
cod_mat <- rcorr(as.matrix(cod_df), type="pearson")
cod_mat
                FinalTotalPrice   COD VendorDiscount WebsiteDiscount
FinalTotalPrice            1.00  0.09           0.10            0.31
COD                        0.09  1.00           0.01           -0.05
VendorDiscount             0.10  0.01           1.00           -0.33
WebsiteDiscount            0.31 -0.05          -0.33            1.00

n= 45507 


P
                FinalTotalPrice COD   VendorDiscount WebsiteDiscount
FinalTotalPrice                 0.000 0.000          0.000          
COD             0.000                 0.027          0.000          
VendorDiscount  0.000           0.027                0.000          
WebsiteDiscount 0.000           0.000 0.000                         

Correlation between Price and Discount

corrgram(cod[,c("FinalTotalPrice","VendorDiscount","WebsiteDiscount")], lower.panel = panel.shade, upper.panel = panel.pie)

plot of chunk unnamed-chunk-7

Correlation between COD and Discounts

corrgram(cod[,c("COD","HasVendorDiscount","HasWebsiteDiscount")], lower.panel = panel.shade, upper.panel = panel.pie)

plot of chunk unnamed-chunk-8

Finding the best model using glmulti

selector <- glmulti(FinalTotalPrice ~ SubCategory+Brand+ProductSize+ProductColor+COD+VendorDiscount+WebsiteDiscount+isMetro+ShippingState, data = cod,level = 1,fitfunction = lm,crit = "aicc",confsetsize = 128)

Based on glmulti initiating best model


Call:
lm(formula = FinalTotalPrice ~ 1 + SubCategory + Brand + ProductSize + 
    ProductColor + COD + VendorDiscount + WebsiteDiscount + isMetro, 
    data = cod)

Residuals:
    Min      1Q  Median      3Q     Max 
-2221.8  -106.5   -16.6    86.7  5593.0 

Coefficients:
                                      Estimate Std. Error t value Pr(>|t|)
(Intercept)                          2.681e+01  1.001e+02   0.268 0.788850
SubCategoryASYMMETRIC DRESS          2.646e+02  7.112e+01   3.720 0.000199
SubCategoryBEACHWEAR                -8.665e+01  1.148e+02  -0.755 0.450518
SubCategoryBODYCON DRESS             3.882e+02  6.302e+01   6.160 7.33e-10
SubCategoryCAMISOLES                -3.317e+02  6.017e+01  -5.513 3.54e-08
SubCategoryCAPRIS                    2.543e+02  5.910e+01   4.303 1.69e-05
SubCategoryCAPS & HATS               2.641e+02  4.997e+01   5.285 1.26e-07
SubCategoryCASUAL JACKETS            1.255e+03  5.345e+01  23.485  < 2e-16
SubCategoryCASUAL SHIRTS             1.383e+02  5.015e+01   2.758 0.005827
SubCategoryCHINOS                    6.022e+02  5.363e+01  11.227  < 2e-16
SubCategoryDENIM JACKETS             4.453e+02  7.576e+01   5.878 4.19e-09
SubCategoryDRESSES                   4.040e+02  4.821e+01   8.379  < 2e-16
SubCategoryETHNIC JACKETS            6.491e+02  5.468e+01  11.870  < 2e-16
SubCategoryFORMAL SHIRTS            -7.896e+01  1.518e+02  -0.520 0.602871
SubCategoryFORMAL TROUSERS           4.889e+02  8.404e+01   5.818 6.01e-09
SubCategoryGSTOP235BLK               1.836e+02  2.085e+02   0.880 0.378614
SubCategoryHENLEY T-SHIRTS          -1.650e+01  4.904e+01  -0.336 0.736513
SubCategoryHIGH NECK T SHIRTS        5.114e+01  4.914e+01   1.041 0.297994
SubCategoryJACKETS & BLAZERS         3.037e+03  6.195e+01  49.026  < 2e-16
SubCategoryJEANS                     4.962e+02  1.512e+02   3.282 0.001032
SubCategoryJEGGINGS                  5.452e+02  5.042e+01  10.815  < 2e-16
SubCategoryJUMPSUITS                 5.321e+02  5.076e+01  10.483  < 2e-16
SubCategoryKURTAS                    2.032e+02  5.182e+01   3.921 8.84e-05
SubCategoryKURTIS                    1.178e+02  5.126e+01   2.297 0.021610
SubCategoryLEGGINGS                 -1.343e+01  6.083e+01  -0.221 0.825234
SubCategoryLOUNGEWEAR                9.316e+00  1.267e+02   0.074 0.941404
SubCategoryMANDARIN T-SHIRTS         1.978e+02  5.654e+01   3.498 0.000469
SubCategoryNIGHTWEAR                -1.804e+01  5.790e+01  -0.311 0.755438
SubCategoryOFF SHOULDER/TUBE/HALTER  3.927e+02  1.267e+02   3.100 0.001935
SubCategoryPOLO-T-SHIRTS             6.727e+01  4.884e+01   1.377 0.168453
SubCategoryQUILTED JACKETS           5.883e+02  1.517e+02   3.878 0.000105
SubCategoryROUND NECK SWEATERS       3.951e+02  6.412e+01   6.162 7.25e-10
SubCategoryROUND NECK T-SHIRTS      -6.482e+01  4.892e+01  -1.325 0.185139
SubCategoryROUND NECK VESTS         -1.244e+02  7.150e+01  -1.739 0.082011
SubCategorySALWAR                    1.316e+02  5.457e+01   2.412 0.015850
SubCategorySCARVES                  -3.206e+02  9.371e+01  -3.422 0.000623
SubCategorySHIFT DRESS               1.760e+02  5.711e+01   3.081 0.002061
SubCategorySHIRTS                    1.730e+02  4.830e+01   3.582 0.000341
SubCategorySHORTS                   -1.670e+01  4.966e+01  -0.336 0.736606
SubCategorySHRUGS                    8.038e+01  5.020e+01   1.601 0.109309
SubCategorySKATER DRESS              3.045e+02  6.007e+01   5.069 4.02e-07
SubCategorySKIRTS                    2.913e+02  4.871e+01   5.980 2.25e-09
SubCategorySTOCKINGS                -6.463e+02  2.098e+02  -3.080 0.002072
SubCategorySUITS                     1.827e+03  5.855e+01  31.205  < 2e-16
SubCategorySUMMER JACKETS            8.965e+02  1.122e+02   7.988 1.41e-15
SubCategorySWEATERS                  1.670e+02  5.149e+01   3.244 0.001178
SubCategorySWEATSHIRTS               5.555e+02  5.306e+01  10.470  < 2e-16
SubCategoryT SHIRTS                 -3.908e+01  4.872e+01  -0.802 0.422517
SubCategoryTOPS                      3.554e+00  4.817e+01   0.074 0.941185
SubCategoryTRACK PANTS               4.890e+02  5.522e+01   8.855  < 2e-16
SubCategoryTRACKPANTS                1.472e+03  1.514e+02   9.725  < 2e-16
SubCategoryTRACKSUITS                3.220e+03  2.086e+02  15.437  < 2e-16
SubCategoryTROUSERS                  1.950e+02  4.860e+01   4.013 6.01e-05
SubCategoryTUNICS                    7.918e+01  5.164e+01   1.533 0.125186
SubCategoryV NECK SWEATERS           1.970e+02  9.124e+01   2.159 0.030866
SubCategoryV NECK T-SHIRTS          -1.327e+02  4.902e+01  -2.707 0.006785
SubCategoryWAISTCOATS                4.585e+02  5.039e+01   9.098  < 2e-16
SubCategoryWINTER JACKETS            6.718e+02  4.905e+01  13.697  < 2e-16
BrandFABALLEY                        7.844e+01  4.717e+00  16.627  < 2e-16
BrandGRITSTONES                     -2.056e+02  8.837e+00 -23.269  < 2e-16
BrandHARPA                           4.292e+01  4.668e+00   9.193  < 2e-16
BrandMEIRA                          -2.916e+02  5.098e+00 -57.189  < 2e-16
BrandMISS CHASE                      5.029e+01  6.519e+00   7.714 1.24e-14
BrandMONTEIL & MUNERO               -1.382e+02  9.397e+00 -14.706  < 2e-16
BrandMR BUTTON                       8.948e+02  1.364e+01  65.626  < 2e-16
BrandTHE VANCA                      -3.951e+01  5.145e+00  -7.680 1.62e-14
BrandTSHIRT COMPANY                  5.177e+01  7.639e+00   6.777 1.24e-11
ProductSize30                        2.856e+01  3.799e+01   0.752 0.452166
ProductSize32                        1.812e+01  3.600e+01   0.503 0.614850
ProductSize34                       -5.688e+01  4.403e+01  -1.292 0.196419
ProductSize36                        3.883e+01  5.775e+01   0.672 0.501366
ProductSize38                        6.844e+02  3.548e+01  19.287  < 2e-16
ProductSize3XL                       5.094e+02  5.781e+01   8.812  < 2e-16
ProductSize40                        7.240e+02  3.531e+01  20.501  < 2e-16
ProductSize42                        7.108e+02  3.595e+01  19.769  < 2e-16
ProductSize44                        7.207e+02  3.899e+01  18.484  < 2e-16
ProductSize46                        2.340e+02  2.062e+02   1.134 0.256601
ProductSizeFree Size                 7.612e+02  3.984e+01  19.104  < 2e-16
ProductSizeL                         3.837e+02  3.151e+01  12.177  < 2e-16
ProductSizeM                         3.861e+02  3.150e+01  12.256  < 2e-16
ProductSizeS                         3.772e+02  3.152e+01  11.968  < 2e-16
ProductSizeXL                        3.926e+02  3.154e+01  12.445  < 2e-16
ProductSizeXS                        3.613e+02  3.258e+01  11.092  < 2e-16
ProductSizeXXL                       3.945e+02  3.181e+01  12.401  < 2e-16
ProductColorAQUA BLUE                3.440e+02  8.329e+01   4.130 3.63e-05
ProductColorBEIGE                    3.865e+02  8.317e+01   4.647 3.38e-06
ProductColorBLACK                    3.455e+02  8.283e+01   4.171 3.03e-05
ProductColorBLUE                     3.633e+02  8.289e+01   4.383 1.18e-05
ProductColorBROWN                    3.223e+02  8.338e+01   3.865 0.000111
ProductColorCAMEL                    3.666e+02  1.229e+02   2.983 0.002859
ProductColorCHARCOAL GREY            4.205e+02  1.434e+02   2.932 0.003374
ProductColorCOBALT BLUE              8.018e+02  8.898e+01   9.011  < 2e-16
ProductColorCOFFEE                   4.179e+02  8.678e+01   4.815 1.47e-06
ProductColorCREAM                    3.575e+02  8.457e+01   4.227 2.38e-05
ProductColorDARK GREY                2.056e+02  8.422e+01   2.441 0.014640
ProductColorFUCHSIA                  3.564e+02  8.320e+01   4.283 1.85e-05
ProductColorGOLDEN                   5.827e+02  8.465e+01   6.883 5.92e-12
ProductColorGREEN                    3.158e+02  8.296e+01   3.807 0.000141
ProductColorGREY                     3.324e+02  8.295e+01   4.007 6.16e-05
ProductColorGREY MILANGE             3.164e+02  8.332e+01   3.797 0.000147
ProductColorICE BLUE                 4.322e+02  9.547e+01   4.527 5.99e-06
ProductColorKHAKI                    3.450e+02  8.494e+01   4.062 4.87e-05
ProductColorLAVENDER                 1.582e+03  1.667e+02   9.485  < 2e-16
ProductColorLEMON                    2.184e+02  9.180e+01   2.379 0.017370
ProductColorLIGHT BLUE               3.044e+02  8.955e+01   3.399 0.000678
ProductColorLIGHT GREY               2.724e+02  8.384e+01   3.249 0.001157
ProductColorLILAC                    1.095e+02  1.313e+02   0.834 0.404128
ProductColorMAGENTA                  1.970e+02  2.190e+02   0.900 0.368237
ProductColorMAROON                   3.261e+02  8.308e+01   3.925 8.68e-05
ProductColorMULTI                    2.917e+02  8.301e+01   3.513 0.000443
ProductColorMUSTARD YELLOW           2.469e+02  8.553e+01   2.886 0.003903
ProductColorNAVY BLUE                3.725e+02  8.293e+01   4.492 7.08e-06
ProductColorNUDE                     3.829e+02  8.384e+01   4.566 4.98e-06
ProductColorOFF WHITE                3.652e+02  8.444e+01   4.325 1.53e-05
ProductColorOLIVE                    4.092e+02  8.417e+01   4.862 1.16e-06
ProductColorORANGE                   3.223e+02  8.304e+01   3.881 0.000104
ProductColorPEACH                    3.807e+02  8.314e+01   4.579 4.68e-06
ProductColorPINK                     3.853e+02  8.293e+01   4.647 3.38e-06
ProductColorPURPLE                   2.962e+02  8.316e+01   3.561 0.000369
ProductColorRED                      3.727e+02  8.288e+01   4.497 6.91e-06
ProductColorRUST                     4.248e+02  8.449e+01   5.028 4.98e-07
ProductColorSILVER                   8.825e+02  9.132e+01   9.664  < 2e-16
ProductColorTAN                      1.026e+03  2.201e+02   4.661 3.16e-06
ProductColorVIOLET INDIGO            3.172e+02  8.653e+01   3.665 0.000248
ProductColorWHITE                    3.436e+02  8.294e+01   4.143 3.44e-05
ProductColorWINE                     3.904e+02  8.449e+01   4.621 3.83e-06
ProductColorYELLOW                   3.042e+02  8.314e+01   3.659 0.000253
COD                                  4.630e+01  1.985e+00  23.329  < 2e-16
VendorDiscount                      -4.522e-01  5.589e-03 -80.923  < 2e-16
WebsiteDiscount                     -2.573e-01  8.441e-03 -30.488  < 2e-16
isMetro                             -1.874e-02  1.963e+00  -0.010 0.992384

(Intercept)                            
SubCategoryASYMMETRIC DRESS         ***
SubCategoryBEACHWEAR                   
SubCategoryBODYCON DRESS            ***
SubCategoryCAMISOLES                ***
SubCategoryCAPRIS                   ***
SubCategoryCAPS & HATS              ***
SubCategoryCASUAL JACKETS           ***
SubCategoryCASUAL SHIRTS            ** 
SubCategoryCHINOS                   ***
SubCategoryDENIM JACKETS            ***
SubCategoryDRESSES                  ***
SubCategoryETHNIC JACKETS           ***
SubCategoryFORMAL SHIRTS               
SubCategoryFORMAL TROUSERS          ***
SubCategoryGSTOP235BLK                 
SubCategoryHENLEY T-SHIRTS             
SubCategoryHIGH NECK T SHIRTS          
SubCategoryJACKETS & BLAZERS        ***
SubCategoryJEANS                    ** 
SubCategoryJEGGINGS                 ***
SubCategoryJUMPSUITS                ***
SubCategoryKURTAS                   ***
SubCategoryKURTIS                   *  
SubCategoryLEGGINGS                    
SubCategoryLOUNGEWEAR                  
SubCategoryMANDARIN T-SHIRTS        ***
SubCategoryNIGHTWEAR                   
SubCategoryOFF SHOULDER/TUBE/HALTER ** 
SubCategoryPOLO-T-SHIRTS               
SubCategoryQUILTED JACKETS          ***
SubCategoryROUND NECK SWEATERS      ***
SubCategoryROUND NECK T-SHIRTS         
SubCategoryROUND NECK VESTS         .  
SubCategorySALWAR                   *  
SubCategorySCARVES                  ***
SubCategorySHIFT DRESS              ** 
SubCategorySHIRTS                   ***
SubCategorySHORTS                      
SubCategorySHRUGS                      
SubCategorySKATER DRESS             ***
SubCategorySKIRTS                   ***
SubCategorySTOCKINGS                ** 
SubCategorySUITS                    ***
SubCategorySUMMER JACKETS           ***
SubCategorySWEATERS                 ** 
SubCategorySWEATSHIRTS              ***
SubCategoryT SHIRTS                    
SubCategoryTOPS                        
SubCategoryTRACK PANTS              ***
SubCategoryTRACKPANTS               ***
SubCategoryTRACKSUITS               ***
SubCategoryTROUSERS                 ***
SubCategoryTUNICS                      
SubCategoryV NECK SWEATERS          *  
SubCategoryV NECK T-SHIRTS          ** 
SubCategoryWAISTCOATS               ***
SubCategoryWINTER JACKETS           ***
BrandFABALLEY                       ***
BrandGRITSTONES                     ***
BrandHARPA                          ***
BrandMEIRA                          ***
BrandMISS CHASE                     ***
BrandMONTEIL & MUNERO               ***
BrandMR BUTTON                      ***
BrandTHE VANCA                      ***
BrandTSHIRT COMPANY                 ***
ProductSize30                          
ProductSize32                          
ProductSize34                          
ProductSize36                          
ProductSize38                       ***
ProductSize3XL                      ***
ProductSize40                       ***
ProductSize42                       ***
ProductSize44                       ***
ProductSize46                          
ProductSizeFree Size                ***
ProductSizeL                        ***
ProductSizeM                        ***
ProductSizeS                        ***
ProductSizeXL                       ***
ProductSizeXS                       ***
ProductSizeXXL                      ***
ProductColorAQUA BLUE               ***
ProductColorBEIGE                   ***
ProductColorBLACK                   ***
ProductColorBLUE                    ***
ProductColorBROWN                   ***
ProductColorCAMEL                   ** 
ProductColorCHARCOAL GREY           ** 
ProductColorCOBALT BLUE             ***
ProductColorCOFFEE                  ***
ProductColorCREAM                   ***
ProductColorDARK GREY               *  
ProductColorFUCHSIA                 ***
ProductColorGOLDEN                  ***
ProductColorGREEN                   ***
ProductColorGREY                    ***
ProductColorGREY MILANGE            ***
ProductColorICE BLUE                ***
ProductColorKHAKI                   ***
ProductColorLAVENDER                ***
ProductColorLEMON                   *  
ProductColorLIGHT BLUE              ***
ProductColorLIGHT GREY              ** 
ProductColorLILAC                      
ProductColorMAGENTA                    
ProductColorMAROON                  ***
ProductColorMULTI                   ***
ProductColorMUSTARD YELLOW          ** 
ProductColorNAVY BLUE               ***
ProductColorNUDE                    ***
ProductColorOFF WHITE               ***
ProductColorOLIVE                   ***
ProductColorORANGE                  ***
ProductColorPEACH                   ***
ProductColorPINK                    ***
ProductColorPURPLE                  ***
ProductColorRED                     ***
ProductColorRUST                    ***
ProductColorSILVER                  ***
ProductColorTAN                     ***
ProductColorVIOLET INDIGO           ***
ProductColorWHITE                   ***
ProductColorWINE                    ***
ProductColorYELLOW                  ***
COD                                 ***
VendorDiscount                      ***
WebsiteDiscount                     ***
isMetro                                
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 202.7 on 45376 degrees of freedom
Multiple R-squared:  0.6411,    Adjusted R-squared:  0.6401 
F-statistic: 623.5 on 130 and 45376 DF,  p-value: < 2.2e-16

Performing Normality and Linearity Tests

Visual inspection code

Error in shapiro.test(FinalTotalPrice) : 
  sample size must be between 3 and 5000