a__club 총매출요인

Team : R is well
2015.06.09

Regression Scale

총 매출에 오프라인,웹,모바일 판매 비중 분석.

adimem<-read.csv("adimemall.csv")
std.fitdum <- lm(scale(sales) ~ scale(age) + scale(web) + scale(offline) + scale(mobile) + scale(visit) + scale(quantity) + gender + grade , data=adimem)
summary(std.fitdum)

Call:
lm(formula = scale(sales) ~ scale(age) + scale(web) + scale(offline) + 
    scale(mobile) + scale(visit) + scale(quantity) + gender + 
    grade, data = adimem)

Residuals:
       Min         1Q     Median         3Q        Max 
-4.659e-14 -7.800e-17 -3.000e-17  2.200e-17  9.755e-14 

Coefficients:
                  Estimate Std. Error    t value Pr(>|t|)    
(Intercept)      2.190e-15  8.920e-17  2.455e+01  < 2e-16 ***
scale(age)      -2.136e-16  5.857e-17 -3.647e+00 0.000272 ***
scale(web)       5.204e-01  9.042e-17  5.756e+15  < 2e-16 ***
scale(offline)   8.333e-01  1.253e-16  6.651e+15  < 2e-16 ***
scale(mobile)    3.741e-01  7.647e-17  4.891e+15  < 2e-16 ***
scale(visit)     1.720e-17  1.153e-16  1.490e-01 0.881425    
scale(quantity) -5.885e-17  1.344e-16 -4.380e-01 0.661497    
genderM         -4.373e-17  1.170e-16 -3.740e-01 0.708616    
gradeGOLD       -4.397e-17  5.815e-16 -7.600e-02 0.939733    
gradeSILVER      5.778e-17  2.166e-16  2.670e-01 0.789653    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.589e-15 on 1989 degrees of freedom
Multiple R-squared:      1, Adjusted R-squared:      1 
F-statistic: 3.311e+31 on 9 and 1989 DF,  p-value: < 2.2e-16

Regression

fit_dum <- lm(sales ~ age  + gender + grade + visit + quantity , data=adimem)
summary(fit_dum)

Call:
lm(formula = sales ~ age + gender + grade + visit + quantity, 
    data = adimem)

Residuals:
     Min       1Q   Median       3Q      Max 
-2196024   -41973   -14153    30194  1524699 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)  15081.71    9760.24   1.545    0.122    
age             12.94     264.05   0.049    0.961    
genderM      -1848.49    5306.66  -0.348    0.728    
gradeGOLD   468591.61   24400.07  19.205   <2e-16 ***
gradeSILVER  91901.07    9635.05   9.538   <2e-16 ***
visit        34075.36    2494.97  13.658   <2e-16 ***
quantity     31193.83    1021.16  30.547   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 118400 on 1992 degrees of freedom
Multiple R-squared:  0.8397,    Adjusted R-squared:  0.8393 
F-statistic:  1740 on 6 and 1992 DF,  p-value: < 2.2e-16

ANOVA - Gender

성별 95% 신뢰수준에서 유의미한 차이가 있다고 말할 수 없음.

adimem<-read.csv("adimemall.csv")
library(ez)
gender<-ezANOVA(data=adimem, dv=sales, wid=id, between=gender, detailed = T, return_aov = T)
print(gender)
$ANOVA
  Effect DFn  DFd          SSn          SSd        F         p p<.05
1 gender   1 1997 105153922483 1.740776e+14 1.206314 0.2721957      
           ges
1 0.0006036987

$`Levene's Test for Homogeneity of Variance`
  DFn  DFd          SSn          SSd        F         p p<.05
1   1 1997 172358765679 1.565763e+14 2.198293 0.1383215      

$aov
Call:
   aov(formula = formula(aov_formula), data = data)

Terms:
                      gender    Residuals
Sum of Squares  1.051539e+11 1.740776e+14
Deg. of Freedom            1         1997

Residual standard error: 295244.9
Estimated effects may be unbalanced

ANOVA - Grade

등급간 95% 신뢰수준에서 유의미한 차이가 있다고 말할 수 있음.

grade<-ezANOVA(data=adimem, dv=sales, wid=id, between=grade, detailed = T, return_aov = T)
print(grade)
$ANOVA
  Effect DFn  DFd          SSn          SSd        F p p<.05       ges
1  grade   2 1996 1.007296e+14 7.345318e+13 1368.602 0     * 0.5782983

$`Levene's Test for Homogeneity of Variance`
  DFn  DFd          SSn          SSd       F             p p<.05
1   2 1996 2.667455e+13 2.879147e+13 924.621 6.403002e-285     *

$aov
Call:
   aov(formula = formula(aov_formula), data = data)

Terms:
                       grade    Residuals
Sum of Squares  1.007296e+14 7.345318e+13
Deg. of Freedom            2         1996

Residual standard error: 191833.8
Estimated effects may be unbalanced

ANOVA - Grade- Post-Hoc : Tukey 진행

TukeyHSD(grade$aov)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = formula(aov_formula), data = data)

$grade
                    diff        lwr       upr p adj
GOLD-BRONZE    1397559.3  1328872.0 1466246.5     0
SILVER-BRONZE   326311.4   294362.7  358260.0     0
SILVER-GOLD   -1071247.9 -1145441.9 -997053.9     0

ANOVA - 연령대

등급간 95% 신뢰수준에서 유의미한 차이가 있다고 말할 수 있음.

agerange<-ezANOVA(data=adimem, dv=sales, wid=id, between=agerange, detailed = T, return_aov = T)
print(agerange)
$ANOVA
    Effect DFn  DFd          SSn          SSd        F            p p<.05
1 agerange   5 1993 3.120015e+12 1.710628e+14 7.270067 9.282381e-07     *
        ges
1 0.0179123

$`Levene's Test for Homogeneity of Variance`
  DFn  DFd          SSn          SSd        F            p p<.05
1   5 1993 2.564092e+12 1.525197e+14 6.701082 3.353963e-06     *

$aov
Call:
   aov(formula = formula(aov_formula), data = data)

Terms:
                    agerange    Residuals
Sum of Squares  3.120015e+12 1.710628e+14
Deg. of Freedom            5         1993

Residual standard error: 292970.7
Estimated effects may be unbalanced

ANOVA - 연령대 - Post-Hoc : Tukey 진행

TukeyHSD(agerange$aov)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = formula(aov_formula), data = data)

$agerange
                           diff         lwr       upr     p adj
20th-10th less       45690.5508  -47968.623 139349.72 0.7322175
30th-10th less      118246.7032   24215.442 212277.96 0.0046127
40th-10th less      120061.5585   20823.807 219299.31 0.0075140
50th-10th less      118324.7256   -7669.106 244318.56 0.0799251
60th over-10th less  61872.9676 -159324.957 283070.89 0.9679237
30th-20th            72556.1524   28739.891 116372.41 0.0000365
40th-20th            74371.0078   20277.403 128464.61 0.0012745
50th-20th            72634.1748  -21983.119 167251.47 0.2428925
60th over-20th       16182.4168 -188772.477 221137.31 0.9999210
40th-30th             1814.8554  -52920.465  56550.18 0.9999989
50th-30th               78.0224  -94907.606  95063.65 1.0000000
60th over-30th      -56373.7355 -261498.931 148751.46 0.9702848
50th-40th            -1736.8330 -101879.346  98405.68 1.0000000
60th over-40th      -58188.5909 -265752.073 149374.89 0.9676136
60th over-50th      -56451.7579 -278057.068 165153.55 0.9787053

ANOVA - 성별-등급간 Twoway Between

gender_grade<-ezANOVA(data=adimem, dv=sales, wid=id, between=.(gender,grade), detailed = T, return_aov = T, type=3)
print(gender_grade)
$ANOVA
        Effect DFn  DFd          SSn          SSd          F            p
1  (Intercept)   1 1993 1.587171e+14 7.084507e+13 4464.99874 0.000000e+00
2       gender   1 1993 2.503342e+12 7.084507e+13   70.42354 8.939466e-17
3        grade   2 1993 1.025298e+14 7.084507e+13 1442.17417 0.000000e+00
4 gender:grade   2 1993 2.492903e+12 7.084507e+13   35.06493 1.079694e-15
  p<.05        ges
1     * 0.69139046
2     * 0.03412947
3     * 0.59137633
4     * 0.03399198

$`Levene's Test for Homogeneity of Variance`
  DFn  DFd          SSn          SSd        F             p p<.05
1   5 1993 2.505882e+13 2.749028e+13 363.3447 3.103997e-277     *

$aov
Call:
   aov(formula = formula(aov_formula), data = data)

Terms:
                      gender        grade gender:grade    Residuals
Sum of Squares  1.051539e+11 1.007397e+14 2.492903e+12 7.084507e+13
Deg. of Freedom            1            2            2         1993

Residual standard error: 188539
Estimated effects may be unbalanced

ANOVA - 성별-등급간 Twoway Between Post Hoc

TukeyHSD(gender_grade$aov) 
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = formula(aov_formula), data = data)

$gender
        diff       lwr      upr     p adj
M-F -14515.3 -31066.39 2035.781 0.0855998

$grade
                    diff        lwr       upr p adj
GOLD-BRONZE    1397929.8  1330422.1 1465437.4     0
SILVER-BRONZE   326022.1   294622.1  357422.1     0
SILVER-GOLD   -1071907.7 -1144827.5 -998987.9     0

$`gender:grade`
                          diff         lwr         upr     p adj
M:BRONZE-F:BRONZE     3634.792   -22238.48    29508.07 0.9986737
F:GOLD-F:BRONZE    1649632.847  1527937.52  1771328.17 0.0000000
M:GOLD-F:BRONZE    1190962.681  1079609.78  1302315.59 0.0000000
F:SILVER-F:BRONZE   365244.258   311110.15   419378.36 0.0000000
M:SILVER-F:BRONZE   291158.186   237024.08   345292.29 0.0000000
F:GOLD-M:BRONZE    1645998.056  1524412.41  1767583.70 0.0000000
M:GOLD-M:BRONZE    1187327.889  1076094.87  1298560.91 0.0000000
F:SILVER-M:BRONZE   361609.466   307722.39   415496.54 0.0000000
M:SILVER-M:BRONZE   287523.395   233636.32   341410.47 0.0000000
M:GOLD-F:GOLD      -458670.167  -621498.64  -295841.69 0.0000000
F:SILVER-F:GOLD   -1284388.589 -1414941.81 -1153835.37 0.0000000
M:SILVER-F:GOLD   -1358474.661 -1489027.88 -1227921.44 0.0000000
F:SILVER-M:GOLD    -825718.423  -946688.92  -704747.93 0.0000000
M:SILVER-M:GOLD    -899804.494 -1020774.99  -778834.00 0.0000000
M:SILVER-F:SILVER   -74086.071  -145953.25    -2218.89 0.0388543

ANOVA - 성별- 연령대 Twoway Between

gender_agerange<-ezANOVA(data=adimem, dv=sales, wid=id, between=.(gender,agerange), detailed = T, return_aov = T, type=3)
print(gender_agerange)
$ANOVA
           Effect DFn  DFd          SSn          SSd           F
1     (Intercept)   1 1987 1.243843e+13 1.707268e+14 144.7644079
2          gender   1 1987 2.031496e+10 1.707268e+14   0.2364352
3        agerange   5 1987 3.087306e+12 1.707268e+14   7.1863077
4 gender:agerange   5 1987 2.147804e+11 1.707268e+14   0.4999433
             p p<.05          ges
1 3.097826e-32     * 0.0679082582
2 6.268464e-01       0.0001189769
3 1.122396e-06     * 0.0177621130
4 7.764905e-01       0.0012564548

$`Levene's Test for Homogeneity of Variance`
  DFn  DFd          SSn          SSd        F            p p<.05
1  11 1987 3.013053e+12 1.523333e+14 3.572869 5.285201e-05     *

$aov
Call:
   aov(formula = formula(aov_formula), data = data)

Terms:
                      gender     agerange gender:agerange    Residuals
Sum of Squares  1.051539e+11 3.136075e+12    2.147804e+11 1.707268e+14
Deg. of Freedom            1            5               5         1987

Residual standard error: 293124.4
Estimated effects may be unbalanced

ANOVA - 성별-연령대 Twoway Between Post Hoc

TukeyHSD(gender_agerange$aov) 
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = formula(aov_formula), data = data)

$gender
        diff       lwr      upr     p adj
M-F -14515.3 -40247.57 11216.96 0.2687439

$agerange
                           diff         lwr       upr     p adj
20th-10th less       47874.0568  -45834.530 141582.64 0.6916123
30th-10th less      120972.3592   26891.489 215053.23 0.0034197
40th-10th less      120796.6467   21506.539 220086.75 0.0070204
50th-10th less      119119.5710   -6940.732 245179.87 0.0765504
60th over-10th less  65720.0506 -155594.573 287034.67 0.9585622
30th-20th            73098.3024   29258.924 116937.68 0.0000311
40th-20th            72922.5899   18800.446 127044.73 0.0017413
50th-20th            71245.5143  -23421.698 165912.73 0.2637287
60th over-20th       17845.9939 -187217.030 222909.02 0.9998722
40th-30th             -175.7125  -54939.910  54588.49 1.0000000
50th-30th            -1852.7882  -96888.528  93182.95 0.9999999
60th over-30th      -55252.3086 -260485.723 149981.11 0.9728381
50th-40th            -1677.0756 -101872.421  98518.27 1.0000000
60th over-40th      -55076.5960 -262749.584 152596.39 0.9745652
60th over-50th      -53399.5204 -275121.744 168322.70 0.9834226

$`gender:agerange`
                              diff         lwr       upr     p adj
M:10th less-F:10th less  23386.578 -185846.881 232620.04 0.9999999
F:20th-F:10th less       58209.614  -80823.522 197242.75 0.9690742
M:20th-F:10th less       51476.845  -86409.310 189363.00 0.9873213
F:30th-F:10th less      145678.107    5071.338 286284.87 0.0344791
M:30th-F:10th less      113215.511  -24712.125 251143.15 0.2340034
F:40th-F:10th less      127416.717  -18768.432 273601.87 0.1594661
M:40th-F:10th less      131066.285  -19983.713 282116.28 0.1645053
F:50th-F:10th less      161747.922  -26657.857 350153.70 0.1768062
M:50th-F:10th less       82786.268 -119527.419 285099.96 0.9739612
F:60th over-F:10th less  68300.303 -344048.637 480649.24 0.9999944
M:60th over-F:10th less  72174.545 -244600.685 388949.78 0.9998579
F:20th-M:10th less       34823.036 -137397.765 207043.84 0.9999568
M:20th-M:10th less       28090.268 -143205.919 199386.45 0.9999950
F:30th-M:10th less      122291.529  -51202.145 295785.20 0.4723027
M:30th-M:10th less       89828.934  -81500.644 261158.51 0.8613007
F:40th-M:10th less      104030.140  -74014.488 282074.77 0.7519901
M:40th-M:10th less      107679.708  -74380.430 289739.85 0.7369419
F:50th-M:10th less      138361.345  -75709.973 352432.66 0.6121770
M:50th-M:10th less       59399.690 -167008.392 285807.77 0.9994436
F:60th over-M:10th less  44913.725 -379776.090 469603.54 1.0000000
M:60th over-M:10th less  48787.968 -283892.566 381468.50 0.9999984
M:20th-F:20th            -6732.768  -76689.584  63224.05 1.0000000
F:30th-F:20th            87468.493   12291.187 162645.80 0.0080028
M:30th-F:20th            55005.898  -15032.641 125044.44 0.2977522
F:40th-F:20th            69207.103  -15948.413 154362.62 0.2477623
M:40th-F:20th            72856.672  -20403.536 166116.88 0.3058061
F:50th-F:20th           103538.308  -42674.214 249750.83 0.4646494
M:50th-F:20th            24576.654 -139167.635 188320.94 0.9999980
F:60th over-F:20th       10090.689 -384767.528 404948.91 1.0000000
M:60th over-F:20th       13964.932 -279680.961 307610.82 1.0000000
F:30th-M:20th            94201.261   21166.979 167235.54 0.0015248
M:30th-M:20th            61738.666   -5994.456 129471.79 0.1144201
F:40th-M:20th            75939.872   -7329.816 159209.56 0.1139496
M:40th-M:20th            79589.440  -11952.055 171130.93 0.1622563
F:50th-M:20th           110271.077  -34851.219 255393.37 0.3491523
M:50th-M:20th            31309.423 -131462.108 194080.95 0.9999739
F:60th over-M:20th       16823.458 -377632.359 411279.27 1.0000000
M:60th over-M:20th       20697.700 -272406.871 313802.27 1.0000000
M:30th-F:30th           -32462.595 -105575.161  40649.97 0.9526366
F:40th-F:30th           -18261.389 -105962.657  69439.88 0.9999419
M:40th-F:30th           -14611.821 -110202.180  80978.54 0.9999976
F:50th-F:30th            16069.816 -131639.873 163779.50 0.9999999
M:50th-F:30th           -62891.839 -227974.371 102190.69 0.9850769
F:60th over-F:30th      -77377.804 -472792.854 318037.25 0.9999690
M:60th over-F:30th      -73503.561 -367897.788 220890.67 0.9996535
F:40th-M:30th            14201.206  -69137.151  97539.56 0.9999925
M:40th-M:30th            17850.774  -73753.189 109454.74 0.9999703
F:50th-M:30th            48532.411  -96629.297 193694.12 0.9949629
M:50th-M:30th           -30429.243 -193235.914 132377.43 0.9999806
F:60th over-M:30th      -44915.208 -439385.526 349555.11 0.9999999
M:60th over-M:30th      -41040.966 -334165.053 252083.12 0.9999990
M:40th-F:40th             3649.568  -99971.623 107270.76 1.0000000
F:50th-F:40th            34331.205 -118698.160 187360.57 0.9998780
M:50th-F:40th           -44630.449 -214489.441 125228.54 0.9994356
F:60th over-F:40th      -59116.414 -456549.298 338316.47 0.9999982
M:60th over-F:40th      -55242.172 -352341.137 241856.79 0.9999816
F:50th-M:40th            30681.637 -127001.561 188364.83 0.9999707
M:50th-M:40th           -48280.017 -222343.458 125783.42 0.9990607
F:60th over-M:40th      -62765.982 -462013.902 336481.94 0.9999967
M:60th over-M:40th      -58891.740 -358414.360 240630.88 0.9999674
M:50th-F:50th           -78961.654 -286274.743 128351.43 0.9851053
F:60th over-F:50th      -93447.619 -508272.325 321377.09 0.9998729
M:60th over-F:50th      -89573.377 -409564.681 230417.93 0.9989771
F:60th over-M:50th      -14485.965 -435809.626 406837.70 1.0000000
M:60th over-M:50th      -10611.722 -338984.263 317760.82 1.0000000
M:60th over-F:60th over   3874.242 -482879.644 490628.13 1.0000000