Por José Alejandro Llamas C.

El e-commerce es una realidad que ha venido creciendo durante los últimos años. El 2020 no fue la excepción, el cual logró crecer en +30% tan solo en U.S.A. (CNBC, 2020).

Entre mis aspiraciones personales y profesionales es poder montar un e-commerce a principios del 2021. Por ende consideré realizar el siguiente proyecto basado en esta industria con la finalidad de comprender un poco sobre el comportamiento de los usuarios así como algunas buenas prácticas al momento de realizarlo.

Debo aclarar que el siguiente dataset no es mío. El mismo puede ser descargado de Kaggle en el siguiente link: https://www.kaggle.com/sarthi316/ecommerce-dataset-for-begginers

1. Sobre el data set

#Carga del data set
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
dataset = read.csv("Ecommerce Customers.csv")
glimpse(dataset)
## Rows: 500
## Columns: 8
## $ Email                <fct> mstephenson@fernandez.com, hduke@hotmail.com, ...
## $ Address              <fct> "835 Frank Tunnel\nWrightmouth, MI 82180-9605"...
## $ Avatar               <fct> Violet, DarkGreen, Bisque, SaddleBrown, Medium...
## $ Avg..Session.Length  <dbl> 34.49727, 31.92627, 33.00091, 34.30556, 33.330...
## $ Time.on.App          <dbl> 12.65565, 11.10946, 11.33028, 13.71751, 12.795...
## $ Time.on.Website      <dbl> 39.57767, 37.26896, 37.11060, 36.72128, 37.536...
## $ Length.of.Membership <dbl> 4.082621, 2.664034, 4.104543, 3.120179, 4.4463...
## $ Yearly.Amount.Spent  <dbl> 587.9511, 392.2049, 487.5475, 581.8523, 599.40...
El data set consiste en 500 registros y 8 columnas (Variables) donde las primeras 3 son nominales: email del usuario, su dirección de envío y el avatar que emplean. Las siguientes 5 son numéricas: tiempo promedio por sesión, tiempo (en minutos) del uso del App y el Sitio Web, tiempo (en años) de ser miembro, y el consumo promedio anual.
En base a las variables anteriores, nos interesará conocer el consumo promedio anual. Para ello se desecharán las variables nominales ya que se considera que no aportarán valor alguno:
#Filtro de variables nominales
library(dplyr)
dataset = dataset %>%
  select(Avg..Session.Length, Time.on.App, Time.on.Website, Length.of.Membership, Yearly.Amount.Spent)
dataset
##     Avg..Session.Length Time.on.App Time.on.Website Length.of.Membership
## 1              34.49727   12.655651        39.57767            4.0826206
## 2              31.92627   11.109461        37.26896            2.6640342
## 3              33.00091   11.330278        37.11060            4.1045432
## 4              34.30556   13.717514        36.72128            3.1201788
## 5              33.33067   12.795189        37.53665            4.4463083
## 6              33.87104   12.026925        34.47688            5.4935072
## 7              32.02160   11.366348        36.68378            4.6850172
## 8              32.73914   12.351959        37.37336            4.4342734
## 9              33.98777   13.386235        37.53450            3.2734336
## 10             31.93655   11.814128        37.14517            3.2028061
## 11             33.99257   13.338975        37.22581            2.4826078
## 12             33.87936   11.584783        37.08793            3.7132092
## 13             29.53243   10.961298        37.42022            4.0464232
## 14             33.19033   12.959226        36.14467            3.9185418
## 15             32.38798   13.148726        36.61996            2.4945436
## 16             30.73772   12.636606        36.21376            3.3578468
## 17             32.12539   11.733862        34.89409            3.1361327
## 18             32.33890   12.013195        38.38514            2.4208062
## 19             32.18781   14.715388        38.24411            1.5165756
## 20             32.61786   13.989593        37.19050            4.0645486
## 21             32.91279   11.365492        37.60779            4.5999374
## 22             33.50309   12.877984        37.44102            1.5591519
## 23             31.53160   13.378563        38.73401            2.2451478
## 24             32.90325   11.657576        36.77260            3.9193023
## 25             34.50755   12.893670        37.63576            5.7051540
## 26             33.02933   11.765813        37.73852            2.7217360
## 27             33.54123   12.783892        36.43065            4.6481993
## 28             32.33599   13.007819        37.85178            2.9963645
## 29             33.11021   11.982045        35.29309            3.9234887
## 30             33.10544   11.965020        37.27781            4.7425775
## 31             33.24190   12.305418        36.16365            3.0623681
## 32             33.46106   10.869164        35.62244            3.4714135
## 33             32.17550   13.387492        35.69417            4.3430629
## 34             32.72836   13.104507        38.87804            2.8200972
## 35             32.82031   11.634893        35.36863            4.1245853
## 36             33.61604   11.936386        38.76864            3.6492862
## 37             31.72165   11.755024        36.76572            1.8473704
## 38             32.86533   11.984418        37.04436            3.4523886
## 39             32.74937    9.954976        37.38831            4.6504913
## 40             32.56723   12.489013        36.37148            4.2224362
## 41             32.07055   11.733106        37.53429            4.6712755
## 42             33.01955   10.634561        37.49669            4.6461200
## 43             33.79204   12.507525        37.14286            4.2144951
## 44             32.89398   11.529878        36.88809            4.6432585
## 45             32.04449   13.414935        36.11244            2.2586864
## 46             34.55577   12.170525        39.13110            3.6631055
## 47             34.56456   13.146551        37.33545            3.8768752
## 48             32.72678   12.988510        36.46200            4.1132261
## 49             33.11722   11.864126        36.58273            3.2025312
## 50             31.66105   11.398064        36.59446            3.1983993
## 51             33.25634   13.858062        37.78026            5.9767681
## 52             33.90022   10.956791        37.26688            2.9526690
## 53             34.18777   10.320116        37.45341            2.0948917
## 54             33.76207    9.984514        35.93345            3.8554717
## 55             34.39016   12.645195        38.46832            2.8745969
## 56             33.92530   11.588655        35.25224            3.3920505
## 57             32.68823   13.761533        39.25293            2.9957612
## 58             34.30187   10.568295        36.17313            3.3152248
## 59             32.84393   11.832286        36.81401            3.4719191
## 60             33.75499   12.064157        37.27122            3.9705556
## 61             33.87978   12.495592        38.05261            4.6393203
## 62             33.07654    9.607315        36.49399            5.0812101
## 63             32.22730   13.728627        37.99703            4.8026306
## 64             32.78977   11.670066        37.40875            3.4146884
## 65             32.77261   13.276313        36.60078            3.4622988
## 66             34.37426   15.126994        37.15762            5.3775936
## 67             33.07872   12.695790        35.35844            4.0017863
## 68             32.80522   11.835476        36.37507            3.4395906
## 69             32.43076   11.306232        37.68040            2.7795207
## 70             32.17910   11.187539        40.00518            3.5526498
## 71             33.15418   11.887494        36.26500            2.6022871
## 72             34.33590   12.228935        36.15719            4.6943223
## 73             32.38625   10.674653        38.00658            3.4015223
## 74             32.80870   12.817113        37.03154            3.8515788
## 75             33.87974   13.587806        38.26035            3.2581129
## 76             32.04984   12.238057        38.73086            3.1205689
## 77             33.55521   11.551821        36.62883            2.8379432
## 78             33.14208   11.433380        35.89243            4.4702826
## 79             32.59718   10.889567        38.21257            4.4420543
## 80             33.16714   11.928842        36.91463            3.1649440
## 81             31.51474   12.595671        39.60038            3.7517346
## 82             34.59402   10.947259        35.88399            3.1597544
## 83             33.50137   13.898082        37.05891            4.1305628
## 84             32.40237   10.875560        37.78114            1.9140899
## 85             34.65549   10.338073        36.15726            4.3966519
## 86             31.80930   11.634668        36.18254            5.1133195
## 87             33.87778   12.517666        37.15192            2.6699416
## 88             34.44787   10.607724        36.81910            3.3664637
## 89             31.95630   12.828893        36.95162            4.5712130
## 90             32.60558   12.068816        36.10500            3.9174511
## 91             32.49145   12.530357        37.87522            2.4761391
## 92             33.61602   13.516284        36.77312            4.1255844
## 93             33.47160   11.662263        36.05024            3.9972554
## 94             33.71065   13.664748        37.72439            1.3626741
## 95             32.19772   11.830231        36.63386            4.1933246
## 96             32.46121   13.291143        38.63363            3.8710034
## 97             33.79039   11.942341        38.06341            4.0818027
## 98             34.18382   13.349913        37.82739            4.2520061
## 99             32.28867   12.020112        39.07440            3.9117087
## 100            33.82635   12.084092        35.89036            3.0216718
## 101            32.49839   13.410759        35.99049            3.1846187
## 102            31.88541   11.281931        37.38532            2.8772249
## 103            32.42570   11.448902        37.58019            2.5869680
## 104            33.43783   12.595420        36.26203            2.9696402
## 105            31.38959   10.994224        38.07445            3.4288599
## 106            33.46870   13.085506        35.84583            2.9269402
## 107            32.29176   12.190474        36.15246            3.7818230
## 108            32.06377   10.719150        37.71251            3.0047425
## 109            33.15570   12.931550        38.16644            3.8544739
## 110            33.35687   13.452129        38.50301            3.3188223
## 111            31.85307   12.149375        37.32533            3.3618146
## 112            32.01230   12.178331        37.71599            3.7225612
## 113            32.38845   11.010482        38.41504            3.5435471
## 114            32.65318   11.602532        37.30969            2.7894615
## 115            32.93134   12.732212        35.60082            5.4859767
## 116            33.23561   11.223369        37.69230            2.5941897
## 117            33.92579   12.011022        36.70105            2.7534242
## 118            33.05926   11.725910        35.99910            5.0048206
## 119            32.40173   12.089310        38.30991            3.8733376
## 120            33.88994   13.068639        37.54052            3.7987253
## 121            34.56938   12.854990        35.00748            3.2927977
## 122            33.70161   11.564022        37.67321            4.7161050
## 123            33.26833   11.113330        37.38795            4.0187266
## 124            31.35848   12.809883        36.54967            3.6377013
## 125            33.01479   11.761172        37.57016            3.8341697
## 126            31.57613   12.579894        37.09326            4.5319866
## 127            32.65727   11.957923        36.63465            4.1060552
## 128            34.70932   10.651794        37.14601            3.2182654
## 129            34.53666   12.752077        36.71414            3.2836635
## 130            32.77172   11.540832        37.52642            2.9240207
## 131            33.70040   11.924395        37.24503            3.9052503
## 132            32.43977   12.424130        38.94883            4.9203184
## 133            34.31217   11.810587        37.41413            2.4735961
## 134            32.45518   12.759169        36.59911            4.1312766
## 135            33.54098   11.851891        37.42455            1.7677307
## 136            33.35840   12.703688        36.10091            2.7241082
## 137            32.68613   12.215252        36.59436            3.8971159
## 138            34.55829   11.281445        36.49441            2.4916715
## 139            33.54775   10.735363        37.45837            3.8634254
## 140            31.95490   10.963132        37.32728            3.5786339
## 141            31.06622   11.735095        36.59937            3.9588923
## 142            31.85125   12.418962        35.97765            3.2517418
## 143            32.60928   10.537308        35.73055            3.9143847
## 144            32.11512   11.919242        39.29404            1.4435151
## 145            33.92462   11.911416        38.27470            2.9100379
## 146            33.47719   12.488067        36.51838            3.3455710
## 147            32.11640   12.380695        37.23200            3.0895278
## 148            32.25590   10.480507        37.33867            4.5141224
## 149            32.69239   12.296518        36.95156            1.8258847
## 150            32.38473   10.861604        36.58444            3.9936565
## 151            34.33873   10.716355        38.30720            2.6521583
## 152            32.88710   12.387184        37.43116            6.4012288
## 153            32.51022   10.984836        37.39650            5.3912751
## 154            31.94540   12.965761        36.96639            6.0766536
## 155            36.13966   12.050267        36.95964            3.8648607
## 156            32.44952   13.457725        37.23881            2.9414108
## 157            32.29464   12.443048        37.32785            5.0848613
## 158            34.60331   12.207298        33.91385            6.9226893
## 159            33.59852   11.586320        39.09463            3.6043986
## 160            34.56868   11.378087        38.30447            3.7849321
## 161            32.83810   12.364342        38.03911            3.3091823
## 162            33.50371   12.399436        35.01281            0.9686221
## 163            33.30188   12.542481        38.31136            3.7685620
## 164            30.87948   13.280432        36.93616            3.5851606
## 165            33.15425   11.795887        37.65862            4.5203534
## 166            32.04780   12.718039        37.66111            3.6758488
## 167            33.63080   12.039648        38.92409            2.8730075
## 168            34.04664   12.474455        35.03786            4.0557760
## 169            33.64418   13.160020        36.40775            3.0151753
## 170            32.65462   11.052324        37.63301            4.7171025
## 171            33.42875   10.636761        37.57884            2.9263964
## 172            31.86483   13.443406        36.87832            2.3610869
## 173            34.48239   13.283033        35.90730            4.9687427
## 174            32.52977   11.747732        36.93988            0.8015157
## 175            33.43223   10.859609        38.83567            3.6692256
## 176            33.30857   11.691686        37.48091            1.7157772
## 177            32.33264   11.548761        38.57652            4.7735030
## 178            34.71345   11.724002        36.81386            4.0878373
## 179            32.63588   12.178573        35.67426            4.1317550
## 180            33.07570   12.319845        37.81916            3.4427992
## 181            32.23015   11.084361        37.95968            4.7240274
## 182            34.14286   13.177775        38.85604            3.2309738
## 183            32.49720   12.832803        37.67924            2.9722714
## 184            33.12240   11.509048        37.25306            3.1823297
## 185            33.08853   11.857663        36.08693            4.8063496
## 186            32.53380   12.293366        37.06462            3.6203650
## 187            32.48426   10.933252        36.54551            3.2613247
## 188            32.54346   13.332839        37.96439            3.5974600
## 189            32.28312   10.902556        36.09424            4.7892016
## 190            32.20080   12.276982        38.23261            3.3164647
## 191            34.71332   12.038808        37.63530            4.6324609
## 192            32.71251   11.724474        37.15315            3.3084430
## 193            33.69490   11.202670        35.49396            4.0159866
## 194            31.57020   13.378063        36.33780            4.3693668
## 195            33.45948   11.388613        37.90914            2.5666398
## 196            31.82100   10.771074        37.27864            3.5190324
## 197            32.73322   11.818572        37.10203            1.5038544
## 198            32.40715   13.808799        37.42677            5.0399553
## 199            33.50609   11.659833        37.28139            4.4787126
## 200            30.83643   13.100110        35.90772            3.3616130
## 201            34.87849   13.067896        36.67822            1.9207155
## 202            34.00721   12.494323        36.04546            4.3307145
## 203            31.52575   11.340036        37.03951            3.8112482
## 204            31.04722   11.199661        38.68871            3.0887640
## 205            34.59578   11.332488        35.45986            4.5416953
## 206            34.96761   13.919494        37.95201            5.0666969
## 207            32.29525   11.031358        38.25298            3.1074687
## 208            33.32424   11.084584        36.77602            4.7469897
## 209            32.90345   10.542645        35.53386            3.0918269
## 210            32.55949   11.797796        37.77737            3.1956258
## 211            31.76562   12.442617        38.13171            3.8502796
## 212            34.08165   12.104542        36.05965            3.9745225
## 213            33.30443   12.378490        38.76430            3.8438489
## 214            34.33075   13.722454        35.77312            2.9090085
## 215            32.07895   12.725909        36.54466            1.1390935
## 216            33.60580   13.685119        34.89198            2.6852848
## 217            32.74515   10.012583        38.35496            3.1089114
## 218            32.12236   11.435534        36.22356            4.8528424
## 219            32.53083   12.354607        37.12235            2.3075524
## 220            31.73664   10.748534        35.73871            4.8355287
## 221            34.11757   11.591872        37.74362            3.6785894
## 222            33.63662   11.236507        37.67502            5.2547089
## 223            34.33486   11.109456        38.58585            3.8928915
## 224            34.81498   12.114945        36.28872            4.3894552
## 225            34.64267   11.866481        37.71777            4.0033250
## 226            32.83694   10.256549        36.14391            0.7895199
## 227            32.29965   12.168596        37.07362            4.4033698
## 228            31.94802   13.085357        37.60565            2.6485968
## 229            32.72732   13.013376        36.65128            2.3678482
## 230            33.94624   10.983977        37.95149            3.0507130
## 231            32.35148   13.105159        35.57484            3.6414972
## 232            34.17375   12.144749        37.25803            3.3973631
## 233            32.97518   13.909916        37.79224            4.2976865
## 234            32.00475   11.395209        37.33281            3.8033650
## 235            34.19706   13.033566        37.07680            2.6334200
## 236            33.17720   11.622777        35.96890            3.6340937
## 237            32.69324   12.600750        37.37012            3.4670141
## 238            31.62536   13.187911        37.06709            1.4943109
## 239            31.26065   13.266760        36.97120            2.2672511
## 240            31.72077   11.752343        38.57361            5.0239342
## 241            32.92261   11.568116        36.90938            2.4717507
## 242            32.68625   12.638572        36.09722            4.2977375
## 243            34.05095   11.388645        39.08156            2.4369589
## 244            32.45455   11.822983        36.94613            3.6569839
## 245            31.28345   12.725677        35.96567            5.0002434
## 246            32.98003   11.201160        37.68934            2.4128310
## 247            31.90963   11.347264        36.32365            5.3143541
## 248            34.40241   14.220979        37.52320            4.0777751
## 249            32.95976   11.546276        36.94795            3.2750707
## 250            33.78016   11.917636        36.84473            3.6349960
## 251            32.67294   12.276057        37.19279            3.9824715
## 252            32.72852   10.131712        34.84561            3.2877018
## 253            33.40992   12.026942        36.13389            2.3133499
## 254            31.72420   13.172287        36.19975            3.5578137
## 255            32.71112   12.326291        36.67388            3.3502793
## 256            33.13666   13.891313        39.22071            2.9070949
## 257            34.37939   12.930929        36.36025            3.7927120
## 258            35.53090   11.379257        36.63610            4.0294538
## 259            33.24727   14.069382        38.99332            4.9784758
## 260            32.09611   10.804891        37.37276            2.6995621
## 261            35.03928   14.426491        37.37418            3.9306153
## 262            32.55053   13.041245        36.65521            3.4562338
## 263            32.58249   11.739744        36.85481            2.1820170
## 264            33.29698   12.491059        38.23894            2.7095266
## 265            33.10834   12.892375        36.52739            4.5941169
## 266            33.90272   11.668867        37.34127            4.2569833
## 267            34.55528   11.777772        37.97983            3.7842731
## 268            33.73265   12.138794        36.85388            1.6234196
## 269            31.60051   12.222967        36.82275            3.4145062
## 270            34.31893   13.402332        37.29204            3.6060869
## 271            34.00649   12.956277        38.65509            3.2757337
## 272            33.54048   12.884125        36.22604            5.0072720
## 273            34.43643   13.325469        36.76860            3.3712581
## 274            33.55170   12.158585        36.57513            5.4539695
## 275            31.81862   11.226546        35.66994            3.7558694
## 276            32.36312   12.461135        37.74561            4.6642585
## 277            33.19157    9.846125        36.87631            3.8066709
## 278            32.19250   13.325412        36.89729            5.0499275
## 279            32.60790   13.677246        37.74470            2.8719475
## 280            32.26200   11.644970        37.02688            3.2367328
## 281            32.27185   13.485009        37.55088            3.0863373
## 282            33.79512   11.620997        38.41947            4.5596991
## 283            31.65481   13.014459        37.78904            3.0102098
## 284            33.07773   11.466984        35.67573            1.8092296
## 285            31.31235   11.684904        38.71708            3.5942951
## 286            32.87274   12.093966        36.62077            3.0491957
## 287            33.70815   14.325655        35.72183            3.6343402
## 288            33.90857   12.914847        39.06886            1.4823596
## 289            32.31291    9.824402        35.74278            2.9213501
## 290            34.39433   12.807752        38.55103            1.8100799
## 291            32.42330   13.058278        37.26388            3.3731047
## 292            33.53940   10.534553        37.03479            2.2147975
## 293            33.37402   11.143433        35.94640            5.4544633
## 294            33.79476   10.982806        34.81063            3.2018017
## 295            33.77090   11.153966        37.24033            4.7294845
## 296            31.30919   11.947175        36.19083            3.2055298
## 297            33.61256   11.470565        37.06169            3.8025114
## 298            33.39826   11.037850        38.61733            4.1163405
## 299            33.62259   11.167357        35.62659            5.4625008
## 300            30.49254   11.562936        35.97656            1.4816166
## 301            31.90486   12.227728        36.98591            3.7714201
## 302            33.02642   13.186813        38.06693            2.8982996
## 303            32.97519   13.394452        37.80698            3.5690465
## 304            30.81620   11.851399        36.92504            1.0845853
## 305            33.91402   12.266504        36.57503            3.0234744
## 306            33.30267   13.459222        36.33952            5.5663849
## 307            31.91208   11.792972        36.25782            2.3951681
## 308            32.40856   10.985740        37.36839            3.5048335
## 309            32.64462   12.637557        36.51709            5.2266877
## 310            34.10228    8.508152        35.46240            1.8382107
## 311            33.24851   11.656592        36.54861            3.3634114
## 312            34.72908   11.966898        36.54760            2.9574488
## 313            30.39318   11.802986        36.31576            2.0838142
## 314            33.38411   12.677401        35.62253            3.6808473
## 315            32.87847   13.032535        37.87095            4.6937321
## 316            34.50142   12.447617        37.53453            4.0083522
## 317            33.56647   12.235659        37.27757            2.5320441
## 318            32.84879   10.973162        36.60951            2.8709869
## 319            33.53186   13.665770        36.90022            3.5156883
## 320            33.41907   13.391120        37.19419            4.0699166
## 321            32.49542   12.968326        38.29611            1.2004839
## 322            33.67403   12.968893        37.33311            3.2294509
## 323            33.26463   10.732131        36.14579            4.0865663
## 324            32.76246   10.952353        37.64629            4.0194704
## 325            33.47947   12.608889        37.22939            4.2059039
## 326            33.78521   13.039511        36.31273            2.0181946
## 327            33.21719   10.999684        38.44277            4.2438128
## 328            31.12809   13.278956        37.38718            4.6260753
## 329            33.36952   10.627949        38.04031            3.0029570
## 330            32.83789   13.185181        35.92160            1.8235952
## 331            30.57436   11.351049        37.08885            4.0783080
## 332            32.27459   12.954811        37.10882            3.6899166
## 333            33.14423   11.737041        37.93519            2.1901322
## 334            33.48552   11.887345        35.86245            3.2067567
## 335            31.97648   10.757131        36.59587            1.9770071
## 336            32.13386   11.612651        39.24880            3.3492454
## 337            32.30255   11.979061        38.26906            3.5328616
## 338            31.82798   12.461147        37.42900            2.9747368
## 339            32.01807   10.079463        38.07066            2.6181653
## 340            32.99746   12.589241        37.33224            2.8040137
## 341            31.81643   14.288015        36.77386            2.9644979
## 342            34.46151   11.917116        37.76669            4.3508878
## 343            32.34280   11.409645        35.77778            3.8724320
## 344            32.30275   12.815393        37.95781            4.6154263
## 345            33.06644   11.673229        37.84066            2.7272095
## 346            33.89464   10.610537        37.97739            3.5371239
## 347            32.76566   12.506548        35.82347            3.1265095
## 348            33.76981   11.304462        37.83397            5.1378167
## 349            31.81248   10.886921        34.89783            3.1286389
## 350            32.00850   12.095889        36.37751            3.1789524
## 351            33.30434   12.692661        37.33359            3.8273759
## 352            32.18984   11.386776        38.19748            4.8083204
## 353            34.93561   10.728419        36.88119            4.0485101
## 354            33.55165   11.936895        35.90025            4.5433324
## 355            32.38697   12.717995        35.12882            3.4810621
## 356            33.34451   10.969803        35.97458            2.6276250
## 357            33.67276   13.420546        37.76369            4.7943123
## 358            34.00207   11.854682        37.49189            2.7618619
## 359            32.65540   11.918860        35.71627            2.1596760
## 360            32.05426   13.149670        37.65040            4.1956144
## 361            33.22877   12.685394        36.04899            2.1394030
## 362            32.07759   10.347877        39.04516            3.4345597
## 363            33.98101    9.316289        36.91495            2.8684282
## 364            34.17952   12.581548        35.44426            3.1370690
## 365            32.60274   11.764448        37.92270            3.5258064
## 366            32.03055   12.644202        38.00183            5.0381075
## 367            33.10036   11.832112        36.84149            3.6122392
## 368            32.99060   10.441235        35.93896            2.8950752
## 369            34.38582   12.729720        36.23211            5.7059407
## 370            34.35720    9.477778        37.90601            5.0470226
## 371            33.70511   10.163179        37.76304            4.7789736
## 372            32.40430   11.608998        38.11046            2.9665589
## 373            31.82935   11.268259        36.95697            2.6689198
## 374            31.36621   11.163160        37.08832            3.6203546
## 375            31.44745   10.101632        38.04345            4.2382962
## 376            33.58295   12.761531        36.90819            2.4793398
## 377            32.39742   12.055340        37.68547            3.5069676
## 378            35.03745   11.935935        35.78392            3.3101503
## 379            32.78494   12.451200        36.66579            3.5358025
## 380            33.97172   12.284467        38.29573            1.1304770
## 381            33.38599   12.782172        35.55077            3.2287177
## 382            33.55656   12.960307        37.95195            3.3459223
## 383            33.58737    9.953995        37.34574            3.2156668
## 384            34.18818   13.130022        35.42933            3.7905521
## 385            33.59396   11.520567        36.18913            3.5612153
## 386            33.23627   10.972554        34.57403            2.9316195
## 387            33.20892   13.531913        38.95246            3.0465406
## 388            33.63781   12.039502        34.48718            2.7392005
## 389            33.59049   10.942070        36.17049            2.7839631
## 390            34.19551   12.664193        37.02715            4.3304074
## 391            35.86024   11.730661        36.88215            3.4162100
## 392            33.48193   11.918670        37.31770            3.3363394
## 393            33.25824   11.514949        37.12804            4.6628453
## 394            32.31986   12.418113        36.15534            3.2220808
## 395            32.43084   13.887275        38.38196            3.7729690
## 396            31.44597   12.846499        37.86922            3.4201495
## 397            35.74267   10.889828        35.56544            6.1151989
## 398            34.01262   12.914570        36.04620            3.4880300
## 399            34.14039   11.568527        38.91875            4.0828553
## 400            32.37799   11.971751        37.19937            2.8296996
## 401            33.17233   13.078692        37.32982            5.4054065
## 402            33.24732   11.956426        36.51735            3.4517507
## 403            33.59891   13.252737        37.30596            2.9355773
## 404            33.08530   13.093537        38.31565            4.7503601
## 405            32.27844   12.527472        36.68837            3.5314023
## 406            33.44155   11.235969        37.05262            3.9044794
## 407            32.86530   12.074830        35.56917            2.3990798
## 408            31.52620   12.045332        38.50588            2.8477090
## 409            33.00085   11.230743        36.99529            3.7817036
## 410            32.08838   11.907844        35.18912            4.3497784
## 411            33.26544   13.052210        38.77567            4.5742877
## 412            32.99257   13.004362        36.98504            4.6204164
## 413            33.86319   11.523523        35.93805            3.0130325
## 414            32.59209   10.314718        36.72903            4.7911087
## 415            32.38103   12.433129        37.62691            4.3340014
## 416            31.51712   10.745189        38.79123            1.4288239
## 417            33.45430   11.016756        37.63731            4.1370004
## 418            32.21553   12.216855        36.95396            2.9105308
## 419            31.67392   12.329147        37.07437            3.9824623
## 420            33.71755   10.806966        36.01232            3.7012292
## 421            33.21547   12.135101        37.14209            5.8405059
## 422            31.57414   12.941556        36.72528            4.5603961
## 423            33.89457   13.300299        36.39368            4.4900021
## 424            33.12869   10.398458        36.68339            3.8598180
## 425            34.37033   11.887800        37.86145            3.0466202
## 426            34.08026   11.591440        36.45690            4.6528544
## 427            31.42523   13.271475        37.23985            4.0221029
## 428            33.62531   12.988221        39.67259            3.9694178
## 429            31.86274   14.039867        37.02227            3.7382252
## 430            33.29259   11.906508        38.42287            3.3766875
## 431            33.74923   11.137140        38.40137            4.5955227
## 432            34.14497   12.902665        36.61120            2.2239935
## 433            31.12397   12.386516        35.63211            4.2884868
## 434            34.27825   11.822722        36.30855            2.1173825
## 435            33.66662   10.985764        36.35250            0.9364976
## 436            32.25997   14.132893        37.02348            3.7620704
## 437            35.43317   11.912210        36.08964            4.0009636
## 438            31.96732   11.481587        39.24096            3.5325172
## 439            32.14906   10.047315        37.18145            3.5350884
## 440            33.91884   12.428737        37.30536            4.1582147
## 441            33.20062   11.965980        36.83154            3.5490361
## 442            32.53677   11.121366        36.97937            4.1292547
## 443            34.08366    8.668350        35.90676            2.2524460
## 444            33.02502   12.504220        37.64584            4.0513825
## 445            31.26810   12.132509        35.45680            3.0720761
## 446            32.21292   11.732991        35.63395            4.3318630
## 447            33.49951   11.946591        36.48633            3.9378626
## 448            32.90485   12.556108        37.80551            0.2699011
## 449            32.20465   12.480702        37.68029            3.2794663
## 450            32.67515   12.594194        37.68388            2.5717778
## 451            32.99839   10.946842        37.64781            3.8260306
## 452            33.94312   11.484199        36.83937            2.4024538
## 453            33.55211   11.120871        36.80838            4.0278138
## 454            33.67683   10.971392        37.72237            3.6293399
## 455            32.64195   11.588949        36.32214            3.1896099
## 456            33.42121   10.706642        35.76615            3.3939750
## 457            32.76708   11.076259        34.77975            2.5749485
## 458            33.11995   12.953263        37.03428            3.4720214
## 459            35.37188   10.572467        36.86218            4.1983491
## 460            33.97608   11.658037        37.42528            2.0863481
## 461            34.03416   13.592513        36.83866            3.6059339
## 462            32.77049   11.371767        35.26150            4.0343861
## 463            33.50381   11.233415        37.21115            2.3205502
## 464            31.87455   10.290351        36.92976            3.4910933
## 465            32.53324   14.121784        38.40633            5.3200939
## 466            34.85131   12.415542        37.67232            3.1305385
## 467            34.21146   10.770249        34.64980            4.9852050
## 468            33.45962   12.664391        36.36684            1.7269620
## 469            34.20054   12.667809        37.48705            3.7016223
## 470            31.16951   13.970181        36.67395            1.7851739
## 471            32.51820   11.509253        36.59929            3.0226758
## 472            34.52302   11.405770        36.37827            4.0412450
## 473            33.66599   12.263718        38.86023            3.1395269
## 474            31.60984   12.710701        36.16646            2.5628188
## 475            33.70089   13.471578        37.07164            2.3790765
## 476            33.81173   11.186809        36.29889            4.3019965
## 477            34.33668   11.246813        38.68258            2.0947617
## 478            31.06133   12.357638        36.16604            4.0893308
## 479            33.06977   11.764326        36.87503            3.5160510
## 480            34.60624   11.761884        38.12652            1.8208106
## 481            34.23824   11.550300        35.76933            4.1831437
## 482            32.04781   12.482670        35.53602            3.3939028
## 483            30.97168   11.731364        36.07455            4.4263641
## 484            33.60685   12.214074        37.19843            2.9052384
## 485            33.44813   11.903757        36.87454            2.7827578
## 486            33.36938   12.222484        36.35523            3.4470178
## 487            33.45230   12.005916        36.53410            4.7122336
## 488            32.90469   11.913745        36.05865            1.2281124
## 489            35.63085   12.125402        38.18776            4.0190514
## 490            32.24635   11.305551        37.13313            1.7073897
## 491            34.69559   11.608997        37.68488            3.1630919
## 492            34.34392   11.693058        36.81293            3.4470929
## 493            33.68094   11.201570        37.83545            2.2088137
## 494            32.06091   12.625433        35.53914            5.4123578
## 495            33.43110   13.350632        37.96597            2.7688519
## 496            33.23766   13.566160        36.41798            3.7465730
## 497            34.70253   11.695736        37.19027            3.5765259
## 498            32.64678   11.499409        38.33258            4.9582645
## 499            33.32250   12.391423        36.84009            2.3364847
## 500            33.71598   12.418808        35.77102            2.7351596
##     Yearly.Amount.Spent
## 1              587.9511
## 2              392.2049
## 3              487.5475
## 4              581.8523
## 5              599.4061
## 6              637.1024
## 7              521.5722
## 8              549.9041
## 9              570.2004
## 10             427.1994
## 11             492.6060
## 12             522.3374
## 13             408.6404
## 14             573.4159
## 15             470.4527
## 16             461.7807
## 17             457.8477
## 18             407.7045
## 19             452.3157
## 20             605.0610
## 21             534.7057
## 22             419.9388
## 23             436.5156
## 24             519.3410
## 25             700.9171
## 26             423.1800
## 27             619.8956
## 28             486.8389
## 29             529.5377
## 30             554.7221
## 31             497.5867
## 32             447.6879
## 33             588.7126
## 34             491.0732
## 35             507.4418
## 36             521.8836
## 37             347.7769
## 38             490.7386
## 39             478.1703
## 40             537.8462
## 41             532.7518
## 42             501.8744
## 43             591.1972
## 44             547.2443
## 45             448.2298
## 46             549.8606
## 47             593.9150
## 48             563.6729
## 49             479.7319
## 50             416.3584
## 51             725.5848
## 52             442.6673
## 53             384.6266
## 54             451.4574
## 55             522.4041
## 56             483.6733
## 57             520.8988
## 58             453.1695
## 59             496.6507
## 60             547.3651
## 61             616.8515
## 62             507.2126
## 63             613.5993
## 64             483.1597
## 65             540.2634
## 66             765.5185
## 67             553.6015
## 68             469.3109
## 69             408.6202
## 70             451.5757
## 71             444.9666
## 72             595.8228
## 73             418.1501
## 74             534.7772
## 75             578.2416
## 76             478.7194
## 77             444.2859
## 78             544.7799
## 79             488.7861
## 80             475.7591
## 81             489.8125
## 82             462.8976
## 83             596.4302
## 84             338.3199
## 85             533.5149
## 86             536.7719
## 87             487.3793
## 88             473.7290
## 89             547.1259
## 90             505.1133
## 91             449.0703
## 92             611.0000
## 93             515.8288
## 94             439.0748
## 95             514.0890
## 96             543.3402
## 97             521.1430
## 98             614.7153
## 99             507.3901
## 100            495.2994
## 101            518.0646
## 102            390.1033
## 103            420.7377
## 104            492.1051
## 105            410.0696
## 106            497.5137
## 107            494.5519
## 108            378.3309
## 109            570.4517
## 110            549.0082
## 111            459.2851
## 112            492.9451
## 113            424.7626
## 114            422.4268
## 115            642.1016
## 116            413.3718
## 117            479.2311
## 118            593.0772
## 119            506.5473
## 120            571.3075
## 121            576.3112
## 122            576.8025
## 123            514.2395
## 124            495.1760
## 125            514.3366
## 126            541.2266
## 127            516.8316
## 128            468.4457
## 129            548.2803
## 130            431.6177
## 131            552.9403
## 132            573.3062
## 133            452.6273
## 134            542.7116
## 135            407.8040
## 136            482.3536
## 137            529.2301
## 138            433.0488
## 139            476.1914
## 140            439.9979
## 141            448.9333
## 142            472.9922
## 143            463.9235
## 144            350.0582
## 145            460.0613
## 146            505.7711
## 147            463.4850
## 148            479.7319
## 149            424.1855
## 150            465.8893
## 151            426.7752
## 152            684.1634
## 153            555.8926
## 154            657.0199
## 155            595.8038
## 156            503.9784
## 157            586.1559
## 158            744.2219
## 159            512.8254
## 160            528.2238
## 161            468.9135
## 162            357.5914
## 163            536.4231
## 164            490.2066
## 165            550.0476
## 166            513.4506
## 167            497.8119
## 168            578.9863
## 169            506.5364
## 170            501.7492
## 171            421.9668
## 172            439.8913
## 173            666.1256
## 174            298.7620
## 175            465.1766
## 176            373.8857
## 177            532.7175
## 178            554.9008
## 179            537.7732
## 180            501.1002
## 181            517.1651
## 182            557.5293
## 183            493.7192
## 184            452.1226
## 185            577.2735
## 186            485.9231
## 187            425.7451
## 188            537.2151
## 189            524.6380
## 190            478.8854
## 191            612.3852
## 192            476.7667
## 193            505.1196
## 194            545.9455
## 195            434.0217
## 196            424.6753
## 197            352.5501
## 198            662.9611
## 199            560.5602
## 200            467.5019
## 201            504.8704
## 202            590.5627
## 203            443.9656
## 204            392.4974
## 205            568.7176
## 206            712.3963
## 207            413.2960
## 208            562.0820
## 209            412.0129
## 210            468.6685
## 211            496.5541
## 212            548.5185
## 213            536.1309
## 214            558.4273
## 215            357.8637
## 216            529.0567
## 217            387.3571
## 218            528.9336
## 219            420.9162
## 220            496.9334
## 221            519.3730
## 222            591.4377
## 223            502.4098
## 224            604.3348
## 225            555.0684
## 226            256.6706
## 227            547.1110
## 228            461.9209
## 229            458.3769
## 230            436.2835
## 231            532.9352
## 232            512.5525
## 233            630.4228
## 234            463.7460
## 235            493.1802
## 236            501.2092
## 237            501.9283
## 238            376.3369
## 239            421.3266
## 240            538.7749
## 241            398.1635
## 242            571.4710
## 243            451.6286
## 244            490.6004
## 245            591.7811
## 246            409.0705
## 247            563.4460
## 248            647.6195
## 249            448.3404
## 250            518.7865
## 251            523.6339
## 252            393.8574
## 253            426.1545
## 254            503.3879
## 255            482.6025
## 256            524.7976
## 257            574.6548
## 258            574.7472
## 259            660.4252
## 260            375.3985
## 261            640.1877
## 262            514.0098
## 263            376.4968
## 264            484.5198
## 265            614.7296
## 266            567.4750
## 267            554.0031
## 268            399.9839
## 269            479.1729
## 270            585.9318
## 271            540.9957
## 272            628.0478
## 273            582.4919
## 274            640.7862
## 275            446.4187
## 276            570.6301
## 277            423.3083
## 278            616.6603
## 279            530.3625
## 280            442.3631
## 281            511.9799
## 282            560.4438
## 283            475.2634
## 284            374.2697
## 285            463.5914
## 286            471.6029
## 287            626.0187
## 288            432.4721
## 289            356.6156
## 290            467.4278
## 291            503.2174
## 292            378.4736
## 293            584.2183
## 294            451.7279
## 295            557.6341
## 296            432.7207
## 297            506.4239
## 298            510.1598
## 299            587.5748
## 300            282.4712
## 301            473.9499
## 302            489.9081
## 303            541.9722
## 304            266.0863
## 305            494.6872
## 306            689.7876
## 307            387.5347
## 308            441.8966
## 309            604.8413
## 310            302.1895
## 311            479.6148
## 312            506.1323
## 313            319.9289
## 314            528.3092
## 315            610.1280
## 316            584.1059
## 317            466.4212
## 318            404.8245
## 319            564.7910
## 320            596.5167
## 321            368.6548
## 322            542.4125
## 323            478.2621
## 324            473.3605
## 325            559.1990
## 326            447.1876
## 327            505.2301
## 328            557.2527
## 329            422.3687
## 330            445.0622
## 331            442.0644
## 332            533.0401
## 333            424.2028
## 334            498.6356
## 335            330.5944
## 336            443.4419
## 337            478.6009
## 338            440.0027
## 339            357.7831
## 340            476.1392
## 341            501.1225
## 342            592.6885
## 343            486.0834
## 344            576.0252
## 345            442.7229
## 346            461.7910
## 347            488.3875
## 348            593.1564
## 349            392.8103
## 350            443.1972
## 351            535.4808
## 352            533.3966
## 353            532.1274
## 354            558.9481
## 355            508.7719
## 356            403.7669
## 357            640.5841
## 358            461.6283
## 359            382.4161
## 360            561.8747
## 361            444.5761
## 362            401.0331
## 363            384.3261
## 364            527.7830
## 365            482.1450
## 366            594.2745
## 367            502.0925
## 368            407.6572
## 369            708.9352
## 370            531.9616
## 371            521.2408
## 372            447.3690
## 373            385.1523
## 374            430.5889
## 375            418.6027
## 376            478.9514
## 377            483.7965
## 378            538.9420
## 379            486.1638
## 380            385.0950
## 381            527.7838
## 382            547.1907
## 383            410.6029
## 384            583.9778
## 385            474.5323
## 386            414.9351
## 387            550.8134
## 388            458.7811
## 389            407.5422
## 390            581.3089
## 391            546.5567
## 392            503.1751
## 393            549.1316
## 394            482.8310
## 395            557.6083
## 396            484.8770
## 397            669.9871
## 398            547.7100
## 399            537.8253
## 400            408.2169
## 401            663.0748
## 402            506.3759
## 403            528.4193
## 404            632.1236
## 405            488.2703
## 406            508.7357
## 407            411.1870
## 408            409.0945
## 409            467.8009
## 410            512.1659
## 411            608.2718
## 412            589.0265
## 413            444.0538
## 414            493.1813
## 415            532.7248
## 416            275.9184
## 417            511.0388
## 418            438.4177
## 419            475.7251
## 420            483.5432
## 421            663.8037
## 422            544.4093
## 423            630.1567
## 424            461.1122
## 425            491.9115
## 426            574.4157
## 427            530.7667
## 428            581.7988
## 429            556.2981
## 430            502.1328
## 431            556.1864
## 432            475.0716
## 433            486.9471
## 434            434.1442
## 435            304.1356
## 436            571.2160
## 437            583.0796
## 438            445.7498
## 439            392.9923
## 440            565.9944
## 441            499.1402
## 442            510.5394
## 443            308.5277
## 444            561.5165
## 445            423.4705
## 446            513.1531
## 447            529.1945
## 448            314.4385
## 449            478.5843
## 450            444.5822
## 451            475.0154
## 452            436.7206
## 453            521.1953
## 454            478.1831
## 455            432.4812
## 456            438.3037
## 457            388.9405
## 458            534.7715
## 459            537.9158
## 460            407.8764
## 461            618.8460
## 462            502.7711
## 463            397.4206
## 464            392.2852
## 465            689.2357
## 466            543.1326
## 467            577.7360
## 468            436.5807
## 469            553.9947
## 470            427.3565
## 471            424.7288
## 472            541.0498
## 473            469.3831
## 474            444.5455
## 475            492.5568
## 476            535.3216
## 477            408.9583
## 478            487.5555
## 479            487.6462
## 480            402.1671
## 481            551.0230
## 482            497.3896
## 483            494.6386
## 484            479.2474
## 485            462.6565
## 486            515.5025
## 487            576.4776
## 488            357.8580
## 489            597.7399
## 490            327.3780
## 491            510.4014
## 492            510.5015
## 493            403.8195
## 494            627.6033
## 495            510.6618
## 496            573.8474
## 497            529.0490
## 498            551.6201
## 499            456.4695
## 500            497.7786
Ya con esto daremos inicio a la etapa de anális.

2. Análisis

Lo siguiente será hacer un resumen rápido acerca de la composición estadística de las variables:
summary(dataset)
##  Avg..Session.Length  Time.on.App     Time.on.Website Length.of.Membership
##  Min.   :29.53       Min.   : 8.508   Min.   :33.91   Min.   :0.2699      
##  1st Qu.:32.34       1st Qu.:11.388   1st Qu.:36.35   1st Qu.:2.9304      
##  Median :33.08       Median :11.983   Median :37.07   Median :3.5340      
##  Mean   :33.05       Mean   :12.052   Mean   :37.06   Mean   :3.5335      
##  3rd Qu.:33.71       3rd Qu.:12.754   3rd Qu.:37.72   3rd Qu.:4.1265      
##  Max.   :36.14       Max.   :15.127   Max.   :40.01   Max.   :6.9227      
##  Yearly.Amount.Spent
##  Min.   :256.7      
##  1st Qu.:445.0      
##  Median :498.9      
##  Mean   :499.3      
##  3rd Qu.:549.3      
##  Max.   :765.5
A grosso modo, el comportamiento de las variables parecen obedecer una distribución normal. Eso lo podemos saber por el simple hecho que la media y mediana están bastante cercanas. Esto a lo largo de las 5 variables.
Lo siguiente a realizar será un pequeño análisis por variables para confirmar lo anterior.

2.1. Duración promedio por sesión

#Histograma - Avg..Session.Length
hist(dataset$Avg..Session.Length,
     col = "orange2",
     xlab = "Tiempo (minutos)",
     ylab = "Frecuencia",
     main = "Duración promedio por sesión")

La duración promedio de los usuarios es ronda por los 30 minutos. Se concentra más ahí por los 33 minutos y pico.

2.2. Tiempo en el App

#Histograma - Time.on.App
hist(dataset$Time.on.App,
     col = "green2",
     xlab = "Tiempo (minutos)",
     ylab = "Frecuencia",
     main = "Tiempo promedio en el App")

##### La duración promedio de navegación vía App ronda entre los 12 y 13 minutos. Vemos que, a comparación de las sesiones, estas son más cortas –poco más del doble –, por lo que se puede decir que los usuarios aprovecharían a utilizarla únicamente si algo les llamó la atención. Es decir que son búsquedas efímeras que pudieron ser: para matar el tiempo o bien porque vieron algún anuncio que los redireccionó al software.

Será interesante ver lo que es su complementaria: la Web.

2.3. Tiempo en el Sitio Web

#Histograma - Time.on.Website
hist(dataset$Time.on.Website,
     col = "yellow2",
     xlab = "Tiempo (minutos)",
     ylab = "Frecuencia",
     main = "Tiempo promedio en el Sitio Web")

A diferencia del anterior, vemos que el tiempo promedio de navegación (~37 minutos) es incluso más alto que el de las sesiones promedio, llegando incluso hasta los 40 minutos. De esto se puede inferir que son búsquedas más planificadas, o bien que los usuarios se sienten más cómodos al navegar (posiblemente) desde un ordenador. Y la verdad es que ¿quién prefiere hacerlo desde un App teniendo la pantalla masiva de la laptop/PC o Mac? Yo la verdad no.

2.4. Longevidad de la membresía

#Histograma - Length.of.Membership
hist(dataset$Length.of.Membership,
     col = "pink2",
     xlab = "Tiempo (años)",
     ylab = "Frecuencia",
     main = "Longevidad de la membresía")

##### Actualmente la mayor concentración de membresías oscilan entre los 3 y 4 años de longevidad. De igual manera se observa que el comportamiento del mismo es normal, por lo que existen membresías tanto más antiguas (7 años) como más recientes (algunos meses).

2.5. Consumo promedio anual

#Histograma - Yearly.Amount.Spent
hist(dataset$Yearly.Amount.Spent,
     col = "red2",
     xlab = "Gasto (en USD)",
     ylab = "Frecuencia",
     main = "Consumo promedio anual")

sd(dataset$Yearly.Amount.Spent)
## [1] 79.31478
Como se puede observar, el ticket promedio anual del e-commerce oscila entre los USD500, con una desviación estándar de +-USD80. Así mismo obedece un comportamiento normal.

2.6.Boxplot

#Normalización de los datos
library(scales)
base.escalada = scale(dataset[,], center = T, scale = T)
boxplot(base.escalada)

##### A través de una rescalación de las variables nos percatamos que el comportamiento es bastante similar entre ellas: cuartiles y mediana muy parecidos –difiere levemente el uso del App (segunda caja)–. Lo que los diferencia visualmente son los outliers que exceden mucho en las dos últimas cajas. Será interesante ver su comportamiento en el análisis por correlación.

2.7. Análisis de correlación

library(corrplot)
## corrplot 0.84 loaded
plot(dataset)

numeric.var= cor(dataset)
corrplot(numeric.var, method="number", type="upper")

##### Es interesante observar que, a través de los elementos visuales, las variables que guardan mayor relación con el consumo promedio anual es prácticamente la longevidad de la membresía en un alto índice, seguido por el tiempo de navegación en el App.

3. Variable de clasificación

#Creación de la variable Categoria.Cliente
dataset$Categoria.Cliente = ifelse(dataset$Yearly.Amount.Spent >= 600,"Oro",ifelse(dataset$Yearly.Amount.Spent >= 400,"Platino","Bronce"))
dataset
##     Avg..Session.Length Time.on.App Time.on.Website Length.of.Membership
## 1              34.49727   12.655651        39.57767            4.0826206
## 2              31.92627   11.109461        37.26896            2.6640342
## 3              33.00091   11.330278        37.11060            4.1045432
## 4              34.30556   13.717514        36.72128            3.1201788
## 5              33.33067   12.795189        37.53665            4.4463083
## 6              33.87104   12.026925        34.47688            5.4935072
## 7              32.02160   11.366348        36.68378            4.6850172
## 8              32.73914   12.351959        37.37336            4.4342734
## 9              33.98777   13.386235        37.53450            3.2734336
## 10             31.93655   11.814128        37.14517            3.2028061
## 11             33.99257   13.338975        37.22581            2.4826078
## 12             33.87936   11.584783        37.08793            3.7132092
## 13             29.53243   10.961298        37.42022            4.0464232
## 14             33.19033   12.959226        36.14467            3.9185418
## 15             32.38798   13.148726        36.61996            2.4945436
## 16             30.73772   12.636606        36.21376            3.3578468
## 17             32.12539   11.733862        34.89409            3.1361327
## 18             32.33890   12.013195        38.38514            2.4208062
## 19             32.18781   14.715388        38.24411            1.5165756
## 20             32.61786   13.989593        37.19050            4.0645486
## 21             32.91279   11.365492        37.60779            4.5999374
## 22             33.50309   12.877984        37.44102            1.5591519
## 23             31.53160   13.378563        38.73401            2.2451478
## 24             32.90325   11.657576        36.77260            3.9193023
## 25             34.50755   12.893670        37.63576            5.7051540
## 26             33.02933   11.765813        37.73852            2.7217360
## 27             33.54123   12.783892        36.43065            4.6481993
## 28             32.33599   13.007819        37.85178            2.9963645
## 29             33.11021   11.982045        35.29309            3.9234887
## 30             33.10544   11.965020        37.27781            4.7425775
## 31             33.24190   12.305418        36.16365            3.0623681
## 32             33.46106   10.869164        35.62244            3.4714135
## 33             32.17550   13.387492        35.69417            4.3430629
## 34             32.72836   13.104507        38.87804            2.8200972
## 35             32.82031   11.634893        35.36863            4.1245853
## 36             33.61604   11.936386        38.76864            3.6492862
## 37             31.72165   11.755024        36.76572            1.8473704
## 38             32.86533   11.984418        37.04436            3.4523886
## 39             32.74937    9.954976        37.38831            4.6504913
## 40             32.56723   12.489013        36.37148            4.2224362
## 41             32.07055   11.733106        37.53429            4.6712755
## 42             33.01955   10.634561        37.49669            4.6461200
## 43             33.79204   12.507525        37.14286            4.2144951
## 44             32.89398   11.529878        36.88809            4.6432585
## 45             32.04449   13.414935        36.11244            2.2586864
## 46             34.55577   12.170525        39.13110            3.6631055
## 47             34.56456   13.146551        37.33545            3.8768752
## 48             32.72678   12.988510        36.46200            4.1132261
## 49             33.11722   11.864126        36.58273            3.2025312
## 50             31.66105   11.398064        36.59446            3.1983993
## 51             33.25634   13.858062        37.78026            5.9767681
## 52             33.90022   10.956791        37.26688            2.9526690
## 53             34.18777   10.320116        37.45341            2.0948917
## 54             33.76207    9.984514        35.93345            3.8554717
## 55             34.39016   12.645195        38.46832            2.8745969
## 56             33.92530   11.588655        35.25224            3.3920505
## 57             32.68823   13.761533        39.25293            2.9957612
## 58             34.30187   10.568295        36.17313            3.3152248
## 59             32.84393   11.832286        36.81401            3.4719191
## 60             33.75499   12.064157        37.27122            3.9705556
## 61             33.87978   12.495592        38.05261            4.6393203
## 62             33.07654    9.607315        36.49399            5.0812101
## 63             32.22730   13.728627        37.99703            4.8026306
## 64             32.78977   11.670066        37.40875            3.4146884
## 65             32.77261   13.276313        36.60078            3.4622988
## 66             34.37426   15.126994        37.15762            5.3775936
## 67             33.07872   12.695790        35.35844            4.0017863
## 68             32.80522   11.835476        36.37507            3.4395906
## 69             32.43076   11.306232        37.68040            2.7795207
## 70             32.17910   11.187539        40.00518            3.5526498
## 71             33.15418   11.887494        36.26500            2.6022871
## 72             34.33590   12.228935        36.15719            4.6943223
## 73             32.38625   10.674653        38.00658            3.4015223
## 74             32.80870   12.817113        37.03154            3.8515788
## 75             33.87974   13.587806        38.26035            3.2581129
## 76             32.04984   12.238057        38.73086            3.1205689
## 77             33.55521   11.551821        36.62883            2.8379432
## 78             33.14208   11.433380        35.89243            4.4702826
## 79             32.59718   10.889567        38.21257            4.4420543
## 80             33.16714   11.928842        36.91463            3.1649440
## 81             31.51474   12.595671        39.60038            3.7517346
## 82             34.59402   10.947259        35.88399            3.1597544
## 83             33.50137   13.898082        37.05891            4.1305628
## 84             32.40237   10.875560        37.78114            1.9140899
## 85             34.65549   10.338073        36.15726            4.3966519
## 86             31.80930   11.634668        36.18254            5.1133195
## 87             33.87778   12.517666        37.15192            2.6699416
## 88             34.44787   10.607724        36.81910            3.3664637
## 89             31.95630   12.828893        36.95162            4.5712130
## 90             32.60558   12.068816        36.10500            3.9174511
## 91             32.49145   12.530357        37.87522            2.4761391
## 92             33.61602   13.516284        36.77312            4.1255844
## 93             33.47160   11.662263        36.05024            3.9972554
## 94             33.71065   13.664748        37.72439            1.3626741
## 95             32.19772   11.830231        36.63386            4.1933246
## 96             32.46121   13.291143        38.63363            3.8710034
## 97             33.79039   11.942341        38.06341            4.0818027
## 98             34.18382   13.349913        37.82739            4.2520061
## 99             32.28867   12.020112        39.07440            3.9117087
## 100            33.82635   12.084092        35.89036            3.0216718
## 101            32.49839   13.410759        35.99049            3.1846187
## 102            31.88541   11.281931        37.38532            2.8772249
## 103            32.42570   11.448902        37.58019            2.5869680
## 104            33.43783   12.595420        36.26203            2.9696402
## 105            31.38959   10.994224        38.07445            3.4288599
## 106            33.46870   13.085506        35.84583            2.9269402
## 107            32.29176   12.190474        36.15246            3.7818230
## 108            32.06377   10.719150        37.71251            3.0047425
## 109            33.15570   12.931550        38.16644            3.8544739
## 110            33.35687   13.452129        38.50301            3.3188223
## 111            31.85307   12.149375        37.32533            3.3618146
## 112            32.01230   12.178331        37.71599            3.7225612
## 113            32.38845   11.010482        38.41504            3.5435471
## 114            32.65318   11.602532        37.30969            2.7894615
## 115            32.93134   12.732212        35.60082            5.4859767
## 116            33.23561   11.223369        37.69230            2.5941897
## 117            33.92579   12.011022        36.70105            2.7534242
## 118            33.05926   11.725910        35.99910            5.0048206
## 119            32.40173   12.089310        38.30991            3.8733376
## 120            33.88994   13.068639        37.54052            3.7987253
## 121            34.56938   12.854990        35.00748            3.2927977
## 122            33.70161   11.564022        37.67321            4.7161050
## 123            33.26833   11.113330        37.38795            4.0187266
## 124            31.35848   12.809883        36.54967            3.6377013
## 125            33.01479   11.761172        37.57016            3.8341697
## 126            31.57613   12.579894        37.09326            4.5319866
## 127            32.65727   11.957923        36.63465            4.1060552
## 128            34.70932   10.651794        37.14601            3.2182654
## 129            34.53666   12.752077        36.71414            3.2836635
## 130            32.77172   11.540832        37.52642            2.9240207
## 131            33.70040   11.924395        37.24503            3.9052503
## 132            32.43977   12.424130        38.94883            4.9203184
## 133            34.31217   11.810587        37.41413            2.4735961
## 134            32.45518   12.759169        36.59911            4.1312766
## 135            33.54098   11.851891        37.42455            1.7677307
## 136            33.35840   12.703688        36.10091            2.7241082
## 137            32.68613   12.215252        36.59436            3.8971159
## 138            34.55829   11.281445        36.49441            2.4916715
## 139            33.54775   10.735363        37.45837            3.8634254
## 140            31.95490   10.963132        37.32728            3.5786339
## 141            31.06622   11.735095        36.59937            3.9588923
## 142            31.85125   12.418962        35.97765            3.2517418
## 143            32.60928   10.537308        35.73055            3.9143847
## 144            32.11512   11.919242        39.29404            1.4435151
## 145            33.92462   11.911416        38.27470            2.9100379
## 146            33.47719   12.488067        36.51838            3.3455710
## 147            32.11640   12.380695        37.23200            3.0895278
## 148            32.25590   10.480507        37.33867            4.5141224
## 149            32.69239   12.296518        36.95156            1.8258847
## 150            32.38473   10.861604        36.58444            3.9936565
## 151            34.33873   10.716355        38.30720            2.6521583
## 152            32.88710   12.387184        37.43116            6.4012288
## 153            32.51022   10.984836        37.39650            5.3912751
## 154            31.94540   12.965761        36.96639            6.0766536
## 155            36.13966   12.050267        36.95964            3.8648607
## 156            32.44952   13.457725        37.23881            2.9414108
## 157            32.29464   12.443048        37.32785            5.0848613
## 158            34.60331   12.207298        33.91385            6.9226893
## 159            33.59852   11.586320        39.09463            3.6043986
## 160            34.56868   11.378087        38.30447            3.7849321
## 161            32.83810   12.364342        38.03911            3.3091823
## 162            33.50371   12.399436        35.01281            0.9686221
## 163            33.30188   12.542481        38.31136            3.7685620
## 164            30.87948   13.280432        36.93616            3.5851606
## 165            33.15425   11.795887        37.65862            4.5203534
## 166            32.04780   12.718039        37.66111            3.6758488
## 167            33.63080   12.039648        38.92409            2.8730075
## 168            34.04664   12.474455        35.03786            4.0557760
## 169            33.64418   13.160020        36.40775            3.0151753
## 170            32.65462   11.052324        37.63301            4.7171025
## 171            33.42875   10.636761        37.57884            2.9263964
## 172            31.86483   13.443406        36.87832            2.3610869
## 173            34.48239   13.283033        35.90730            4.9687427
## 174            32.52977   11.747732        36.93988            0.8015157
## 175            33.43223   10.859609        38.83567            3.6692256
## 176            33.30857   11.691686        37.48091            1.7157772
## 177            32.33264   11.548761        38.57652            4.7735030
## 178            34.71345   11.724002        36.81386            4.0878373
## 179            32.63588   12.178573        35.67426            4.1317550
## 180            33.07570   12.319845        37.81916            3.4427992
## 181            32.23015   11.084361        37.95968            4.7240274
## 182            34.14286   13.177775        38.85604            3.2309738
## 183            32.49720   12.832803        37.67924            2.9722714
## 184            33.12240   11.509048        37.25306            3.1823297
## 185            33.08853   11.857663        36.08693            4.8063496
## 186            32.53380   12.293366        37.06462            3.6203650
## 187            32.48426   10.933252        36.54551            3.2613247
## 188            32.54346   13.332839        37.96439            3.5974600
## 189            32.28312   10.902556        36.09424            4.7892016
## 190            32.20080   12.276982        38.23261            3.3164647
## 191            34.71332   12.038808        37.63530            4.6324609
## 192            32.71251   11.724474        37.15315            3.3084430
## 193            33.69490   11.202670        35.49396            4.0159866
## 194            31.57020   13.378063        36.33780            4.3693668
## 195            33.45948   11.388613        37.90914            2.5666398
## 196            31.82100   10.771074        37.27864            3.5190324
## 197            32.73322   11.818572        37.10203            1.5038544
## 198            32.40715   13.808799        37.42677            5.0399553
## 199            33.50609   11.659833        37.28139            4.4787126
## 200            30.83643   13.100110        35.90772            3.3616130
## 201            34.87849   13.067896        36.67822            1.9207155
## 202            34.00721   12.494323        36.04546            4.3307145
## 203            31.52575   11.340036        37.03951            3.8112482
## 204            31.04722   11.199661        38.68871            3.0887640
## 205            34.59578   11.332488        35.45986            4.5416953
## 206            34.96761   13.919494        37.95201            5.0666969
## 207            32.29525   11.031358        38.25298            3.1074687
## 208            33.32424   11.084584        36.77602            4.7469897
## 209            32.90345   10.542645        35.53386            3.0918269
## 210            32.55949   11.797796        37.77737            3.1956258
## 211            31.76562   12.442617        38.13171            3.8502796
## 212            34.08165   12.104542        36.05965            3.9745225
## 213            33.30443   12.378490        38.76430            3.8438489
## 214            34.33075   13.722454        35.77312            2.9090085
## 215            32.07895   12.725909        36.54466            1.1390935
## 216            33.60580   13.685119        34.89198            2.6852848
## 217            32.74515   10.012583        38.35496            3.1089114
## 218            32.12236   11.435534        36.22356            4.8528424
## 219            32.53083   12.354607        37.12235            2.3075524
## 220            31.73664   10.748534        35.73871            4.8355287
## 221            34.11757   11.591872        37.74362            3.6785894
## 222            33.63662   11.236507        37.67502            5.2547089
## 223            34.33486   11.109456        38.58585            3.8928915
## 224            34.81498   12.114945        36.28872            4.3894552
## 225            34.64267   11.866481        37.71777            4.0033250
## 226            32.83694   10.256549        36.14391            0.7895199
## 227            32.29965   12.168596        37.07362            4.4033698
## 228            31.94802   13.085357        37.60565            2.6485968
## 229            32.72732   13.013376        36.65128            2.3678482
## 230            33.94624   10.983977        37.95149            3.0507130
## 231            32.35148   13.105159        35.57484            3.6414972
## 232            34.17375   12.144749        37.25803            3.3973631
## 233            32.97518   13.909916        37.79224            4.2976865
## 234            32.00475   11.395209        37.33281            3.8033650
## 235            34.19706   13.033566        37.07680            2.6334200
## 236            33.17720   11.622777        35.96890            3.6340937
## 237            32.69324   12.600750        37.37012            3.4670141
## 238            31.62536   13.187911        37.06709            1.4943109
## 239            31.26065   13.266760        36.97120            2.2672511
## 240            31.72077   11.752343        38.57361            5.0239342
## 241            32.92261   11.568116        36.90938            2.4717507
## 242            32.68625   12.638572        36.09722            4.2977375
## 243            34.05095   11.388645        39.08156            2.4369589
## 244            32.45455   11.822983        36.94613            3.6569839
## 245            31.28345   12.725677        35.96567            5.0002434
## 246            32.98003   11.201160        37.68934            2.4128310
## 247            31.90963   11.347264        36.32365            5.3143541
## 248            34.40241   14.220979        37.52320            4.0777751
## 249            32.95976   11.546276        36.94795            3.2750707
## 250            33.78016   11.917636        36.84473            3.6349960
## 251            32.67294   12.276057        37.19279            3.9824715
## 252            32.72852   10.131712        34.84561            3.2877018
## 253            33.40992   12.026942        36.13389            2.3133499
## 254            31.72420   13.172287        36.19975            3.5578137
## 255            32.71112   12.326291        36.67388            3.3502793
## 256            33.13666   13.891313        39.22071            2.9070949
## 257            34.37939   12.930929        36.36025            3.7927120
## 258            35.53090   11.379257        36.63610            4.0294538
## 259            33.24727   14.069382        38.99332            4.9784758
## 260            32.09611   10.804891        37.37276            2.6995621
## 261            35.03928   14.426491        37.37418            3.9306153
## 262            32.55053   13.041245        36.65521            3.4562338
## 263            32.58249   11.739744        36.85481            2.1820170
## 264            33.29698   12.491059        38.23894            2.7095266
## 265            33.10834   12.892375        36.52739            4.5941169
## 266            33.90272   11.668867        37.34127            4.2569833
## 267            34.55528   11.777772        37.97983            3.7842731
## 268            33.73265   12.138794        36.85388            1.6234196
## 269            31.60051   12.222967        36.82275            3.4145062
## 270            34.31893   13.402332        37.29204            3.6060869
## 271            34.00649   12.956277        38.65509            3.2757337
## 272            33.54048   12.884125        36.22604            5.0072720
## 273            34.43643   13.325469        36.76860            3.3712581
## 274            33.55170   12.158585        36.57513            5.4539695
## 275            31.81862   11.226546        35.66994            3.7558694
## 276            32.36312   12.461135        37.74561            4.6642585
## 277            33.19157    9.846125        36.87631            3.8066709
## 278            32.19250   13.325412        36.89729            5.0499275
## 279            32.60790   13.677246        37.74470            2.8719475
## 280            32.26200   11.644970        37.02688            3.2367328
## 281            32.27185   13.485009        37.55088            3.0863373
## 282            33.79512   11.620997        38.41947            4.5596991
## 283            31.65481   13.014459        37.78904            3.0102098
## 284            33.07773   11.466984        35.67573            1.8092296
## 285            31.31235   11.684904        38.71708            3.5942951
## 286            32.87274   12.093966        36.62077            3.0491957
## 287            33.70815   14.325655        35.72183            3.6343402
## 288            33.90857   12.914847        39.06886            1.4823596
## 289            32.31291    9.824402        35.74278            2.9213501
## 290            34.39433   12.807752        38.55103            1.8100799
## 291            32.42330   13.058278        37.26388            3.3731047
## 292            33.53940   10.534553        37.03479            2.2147975
## 293            33.37402   11.143433        35.94640            5.4544633
## 294            33.79476   10.982806        34.81063            3.2018017
## 295            33.77090   11.153966        37.24033            4.7294845
## 296            31.30919   11.947175        36.19083            3.2055298
## 297            33.61256   11.470565        37.06169            3.8025114
## 298            33.39826   11.037850        38.61733            4.1163405
## 299            33.62259   11.167357        35.62659            5.4625008
## 300            30.49254   11.562936        35.97656            1.4816166
## 301            31.90486   12.227728        36.98591            3.7714201
## 302            33.02642   13.186813        38.06693            2.8982996
## 303            32.97519   13.394452        37.80698            3.5690465
## 304            30.81620   11.851399        36.92504            1.0845853
## 305            33.91402   12.266504        36.57503            3.0234744
## 306            33.30267   13.459222        36.33952            5.5663849
## 307            31.91208   11.792972        36.25782            2.3951681
## 308            32.40856   10.985740        37.36839            3.5048335
## 309            32.64462   12.637557        36.51709            5.2266877
## 310            34.10228    8.508152        35.46240            1.8382107
## 311            33.24851   11.656592        36.54861            3.3634114
## 312            34.72908   11.966898        36.54760            2.9574488
## 313            30.39318   11.802986        36.31576            2.0838142
## 314            33.38411   12.677401        35.62253            3.6808473
## 315            32.87847   13.032535        37.87095            4.6937321
## 316            34.50142   12.447617        37.53453            4.0083522
## 317            33.56647   12.235659        37.27757            2.5320441
## 318            32.84879   10.973162        36.60951            2.8709869
## 319            33.53186   13.665770        36.90022            3.5156883
## 320            33.41907   13.391120        37.19419            4.0699166
## 321            32.49542   12.968326        38.29611            1.2004839
## 322            33.67403   12.968893        37.33311            3.2294509
## 323            33.26463   10.732131        36.14579            4.0865663
## 324            32.76246   10.952353        37.64629            4.0194704
## 325            33.47947   12.608889        37.22939            4.2059039
## 326            33.78521   13.039511        36.31273            2.0181946
## 327            33.21719   10.999684        38.44277            4.2438128
## 328            31.12809   13.278956        37.38718            4.6260753
## 329            33.36952   10.627949        38.04031            3.0029570
## 330            32.83789   13.185181        35.92160            1.8235952
## 331            30.57436   11.351049        37.08885            4.0783080
## 332            32.27459   12.954811        37.10882            3.6899166
## 333            33.14423   11.737041        37.93519            2.1901322
## 334            33.48552   11.887345        35.86245            3.2067567
## 335            31.97648   10.757131        36.59587            1.9770071
## 336            32.13386   11.612651        39.24880            3.3492454
## 337            32.30255   11.979061        38.26906            3.5328616
## 338            31.82798   12.461147        37.42900            2.9747368
## 339            32.01807   10.079463        38.07066            2.6181653
## 340            32.99746   12.589241        37.33224            2.8040137
## 341            31.81643   14.288015        36.77386            2.9644979
## 342            34.46151   11.917116        37.76669            4.3508878
## 343            32.34280   11.409645        35.77778            3.8724320
## 344            32.30275   12.815393        37.95781            4.6154263
## 345            33.06644   11.673229        37.84066            2.7272095
## 346            33.89464   10.610537        37.97739            3.5371239
## 347            32.76566   12.506548        35.82347            3.1265095
## 348            33.76981   11.304462        37.83397            5.1378167
## 349            31.81248   10.886921        34.89783            3.1286389
## 350            32.00850   12.095889        36.37751            3.1789524
## 351            33.30434   12.692661        37.33359            3.8273759
## 352            32.18984   11.386776        38.19748            4.8083204
## 353            34.93561   10.728419        36.88119            4.0485101
## 354            33.55165   11.936895        35.90025            4.5433324
## 355            32.38697   12.717995        35.12882            3.4810621
## 356            33.34451   10.969803        35.97458            2.6276250
## 357            33.67276   13.420546        37.76369            4.7943123
## 358            34.00207   11.854682        37.49189            2.7618619
## 359            32.65540   11.918860        35.71627            2.1596760
## 360            32.05426   13.149670        37.65040            4.1956144
## 361            33.22877   12.685394        36.04899            2.1394030
## 362            32.07759   10.347877        39.04516            3.4345597
## 363            33.98101    9.316289        36.91495            2.8684282
## 364            34.17952   12.581548        35.44426            3.1370690
## 365            32.60274   11.764448        37.92270            3.5258064
## 366            32.03055   12.644202        38.00183            5.0381075
## 367            33.10036   11.832112        36.84149            3.6122392
## 368            32.99060   10.441235        35.93896            2.8950752
## 369            34.38582   12.729720        36.23211            5.7059407
## 370            34.35720    9.477778        37.90601            5.0470226
## 371            33.70511   10.163179        37.76304            4.7789736
## 372            32.40430   11.608998        38.11046            2.9665589
## 373            31.82935   11.268259        36.95697            2.6689198
## 374            31.36621   11.163160        37.08832            3.6203546
## 375            31.44745   10.101632        38.04345            4.2382962
## 376            33.58295   12.761531        36.90819            2.4793398
## 377            32.39742   12.055340        37.68547            3.5069676
## 378            35.03745   11.935935        35.78392            3.3101503
## 379            32.78494   12.451200        36.66579            3.5358025
## 380            33.97172   12.284467        38.29573            1.1304770
## 381            33.38599   12.782172        35.55077            3.2287177
## 382            33.55656   12.960307        37.95195            3.3459223
## 383            33.58737    9.953995        37.34574            3.2156668
## 384            34.18818   13.130022        35.42933            3.7905521
## 385            33.59396   11.520567        36.18913            3.5612153
## 386            33.23627   10.972554        34.57403            2.9316195
## 387            33.20892   13.531913        38.95246            3.0465406
## 388            33.63781   12.039502        34.48718            2.7392005
## 389            33.59049   10.942070        36.17049            2.7839631
## 390            34.19551   12.664193        37.02715            4.3304074
## 391            35.86024   11.730661        36.88215            3.4162100
## 392            33.48193   11.918670        37.31770            3.3363394
## 393            33.25824   11.514949        37.12804            4.6628453
## 394            32.31986   12.418113        36.15534            3.2220808
## 395            32.43084   13.887275        38.38196            3.7729690
## 396            31.44597   12.846499        37.86922            3.4201495
## 397            35.74267   10.889828        35.56544            6.1151989
## 398            34.01262   12.914570        36.04620            3.4880300
## 399            34.14039   11.568527        38.91875            4.0828553
## 400            32.37799   11.971751        37.19937            2.8296996
## 401            33.17233   13.078692        37.32982            5.4054065
## 402            33.24732   11.956426        36.51735            3.4517507
## 403            33.59891   13.252737        37.30596            2.9355773
## 404            33.08530   13.093537        38.31565            4.7503601
## 405            32.27844   12.527472        36.68837            3.5314023
## 406            33.44155   11.235969        37.05262            3.9044794
## 407            32.86530   12.074830        35.56917            2.3990798
## 408            31.52620   12.045332        38.50588            2.8477090
## 409            33.00085   11.230743        36.99529            3.7817036
## 410            32.08838   11.907844        35.18912            4.3497784
## 411            33.26544   13.052210        38.77567            4.5742877
## 412            32.99257   13.004362        36.98504            4.6204164
## 413            33.86319   11.523523        35.93805            3.0130325
## 414            32.59209   10.314718        36.72903            4.7911087
## 415            32.38103   12.433129        37.62691            4.3340014
## 416            31.51712   10.745189        38.79123            1.4288239
## 417            33.45430   11.016756        37.63731            4.1370004
## 418            32.21553   12.216855        36.95396            2.9105308
## 419            31.67392   12.329147        37.07437            3.9824623
## 420            33.71755   10.806966        36.01232            3.7012292
## 421            33.21547   12.135101        37.14209            5.8405059
## 422            31.57414   12.941556        36.72528            4.5603961
## 423            33.89457   13.300299        36.39368            4.4900021
## 424            33.12869   10.398458        36.68339            3.8598180
## 425            34.37033   11.887800        37.86145            3.0466202
## 426            34.08026   11.591440        36.45690            4.6528544
## 427            31.42523   13.271475        37.23985            4.0221029
## 428            33.62531   12.988221        39.67259            3.9694178
## 429            31.86274   14.039867        37.02227            3.7382252
## 430            33.29259   11.906508        38.42287            3.3766875
## 431            33.74923   11.137140        38.40137            4.5955227
## 432            34.14497   12.902665        36.61120            2.2239935
## 433            31.12397   12.386516        35.63211            4.2884868
## 434            34.27825   11.822722        36.30855            2.1173825
## 435            33.66662   10.985764        36.35250            0.9364976
## 436            32.25997   14.132893        37.02348            3.7620704
## 437            35.43317   11.912210        36.08964            4.0009636
## 438            31.96732   11.481587        39.24096            3.5325172
## 439            32.14906   10.047315        37.18145            3.5350884
## 440            33.91884   12.428737        37.30536            4.1582147
## 441            33.20062   11.965980        36.83154            3.5490361
## 442            32.53677   11.121366        36.97937            4.1292547
## 443            34.08366    8.668350        35.90676            2.2524460
## 444            33.02502   12.504220        37.64584            4.0513825
## 445            31.26810   12.132509        35.45680            3.0720761
## 446            32.21292   11.732991        35.63395            4.3318630
## 447            33.49951   11.946591        36.48633            3.9378626
## 448            32.90485   12.556108        37.80551            0.2699011
## 449            32.20465   12.480702        37.68029            3.2794663
## 450            32.67515   12.594194        37.68388            2.5717778
## 451            32.99839   10.946842        37.64781            3.8260306
## 452            33.94312   11.484199        36.83937            2.4024538
## 453            33.55211   11.120871        36.80838            4.0278138
## 454            33.67683   10.971392        37.72237            3.6293399
## 455            32.64195   11.588949        36.32214            3.1896099
## 456            33.42121   10.706642        35.76615            3.3939750
## 457            32.76708   11.076259        34.77975            2.5749485
## 458            33.11995   12.953263        37.03428            3.4720214
## 459            35.37188   10.572467        36.86218            4.1983491
## 460            33.97608   11.658037        37.42528            2.0863481
## 461            34.03416   13.592513        36.83866            3.6059339
## 462            32.77049   11.371767        35.26150            4.0343861
## 463            33.50381   11.233415        37.21115            2.3205502
## 464            31.87455   10.290351        36.92976            3.4910933
## 465            32.53324   14.121784        38.40633            5.3200939
## 466            34.85131   12.415542        37.67232            3.1305385
## 467            34.21146   10.770249        34.64980            4.9852050
## 468            33.45962   12.664391        36.36684            1.7269620
## 469            34.20054   12.667809        37.48705            3.7016223
## 470            31.16951   13.970181        36.67395            1.7851739
## 471            32.51820   11.509253        36.59929            3.0226758
## 472            34.52302   11.405770        36.37827            4.0412450
## 473            33.66599   12.263718        38.86023            3.1395269
## 474            31.60984   12.710701        36.16646            2.5628188
## 475            33.70089   13.471578        37.07164            2.3790765
## 476            33.81173   11.186809        36.29889            4.3019965
## 477            34.33668   11.246813        38.68258            2.0947617
## 478            31.06133   12.357638        36.16604            4.0893308
## 479            33.06977   11.764326        36.87503            3.5160510
## 480            34.60624   11.761884        38.12652            1.8208106
## 481            34.23824   11.550300        35.76933            4.1831437
## 482            32.04781   12.482670        35.53602            3.3939028
## 483            30.97168   11.731364        36.07455            4.4263641
## 484            33.60685   12.214074        37.19843            2.9052384
## 485            33.44813   11.903757        36.87454            2.7827578
## 486            33.36938   12.222484        36.35523            3.4470178
## 487            33.45230   12.005916        36.53410            4.7122336
## 488            32.90469   11.913745        36.05865            1.2281124
## 489            35.63085   12.125402        38.18776            4.0190514
## 490            32.24635   11.305551        37.13313            1.7073897
## 491            34.69559   11.608997        37.68488            3.1630919
## 492            34.34392   11.693058        36.81293            3.4470929
## 493            33.68094   11.201570        37.83545            2.2088137
## 494            32.06091   12.625433        35.53914            5.4123578
## 495            33.43110   13.350632        37.96597            2.7688519
## 496            33.23766   13.566160        36.41798            3.7465730
## 497            34.70253   11.695736        37.19027            3.5765259
## 498            32.64678   11.499409        38.33258            4.9582645
## 499            33.32250   12.391423        36.84009            2.3364847
## 500            33.71598   12.418808        35.77102            2.7351596
##     Yearly.Amount.Spent Categoria.Cliente
## 1              587.9511           Platino
## 2              392.2049            Bronce
## 3              487.5475           Platino
## 4              581.8523           Platino
## 5              599.4061           Platino
## 6              637.1024               Oro
## 7              521.5722           Platino
## 8              549.9041           Platino
## 9              570.2004           Platino
## 10             427.1994           Platino
## 11             492.6060           Platino
## 12             522.3374           Platino
## 13             408.6404           Platino
## 14             573.4159           Platino
## 15             470.4527           Platino
## 16             461.7807           Platino
## 17             457.8477           Platino
## 18             407.7045           Platino
## 19             452.3157           Platino
## 20             605.0610               Oro
## 21             534.7057           Platino
## 22             419.9388           Platino
## 23             436.5156           Platino
## 24             519.3410           Platino
## 25             700.9171               Oro
## 26             423.1800           Platino
## 27             619.8956               Oro
## 28             486.8389           Platino
## 29             529.5377           Platino
## 30             554.7221           Platino
## 31             497.5867           Platino
## 32             447.6879           Platino
## 33             588.7126           Platino
## 34             491.0732           Platino
## 35             507.4418           Platino
## 36             521.8836           Platino
## 37             347.7769            Bronce
## 38             490.7386           Platino
## 39             478.1703           Platino
## 40             537.8462           Platino
## 41             532.7518           Platino
## 42             501.8744           Platino
## 43             591.1972           Platino
## 44             547.2443           Platino
## 45             448.2298           Platino
## 46             549.8606           Platino
## 47             593.9150           Platino
## 48             563.6729           Platino
## 49             479.7319           Platino
## 50             416.3584           Platino
## 51             725.5848               Oro
## 52             442.6673           Platino
## 53             384.6266            Bronce
## 54             451.4574           Platino
## 55             522.4041           Platino
## 56             483.6733           Platino
## 57             520.8988           Platino
## 58             453.1695           Platino
## 59             496.6507           Platino
## 60             547.3651           Platino
## 61             616.8515               Oro
## 62             507.2126           Platino
## 63             613.5993               Oro
## 64             483.1597           Platino
## 65             540.2634           Platino
## 66             765.5185               Oro
## 67             553.6015           Platino
## 68             469.3109           Platino
## 69             408.6202           Platino
## 70             451.5757           Platino
## 71             444.9666           Platino
## 72             595.8228           Platino
## 73             418.1501           Platino
## 74             534.7772           Platino
## 75             578.2416           Platino
## 76             478.7194           Platino
## 77             444.2859           Platino
## 78             544.7799           Platino
## 79             488.7861           Platino
## 80             475.7591           Platino
## 81             489.8125           Platino
## 82             462.8976           Platino
## 83             596.4302           Platino
## 84             338.3199            Bronce
## 85             533.5149           Platino
## 86             536.7719           Platino
## 87             487.3793           Platino
## 88             473.7290           Platino
## 89             547.1259           Platino
## 90             505.1133           Platino
## 91             449.0703           Platino
## 92             611.0000               Oro
## 93             515.8288           Platino
## 94             439.0748           Platino
## 95             514.0890           Platino
## 96             543.3402           Platino
## 97             521.1430           Platino
## 98             614.7153               Oro
## 99             507.3901           Platino
## 100            495.2994           Platino
## 101            518.0646           Platino
## 102            390.1033            Bronce
## 103            420.7377           Platino
## 104            492.1051           Platino
## 105            410.0696           Platino
## 106            497.5137           Platino
## 107            494.5519           Platino
## 108            378.3309            Bronce
## 109            570.4517           Platino
## 110            549.0082           Platino
## 111            459.2851           Platino
## 112            492.9451           Platino
## 113            424.7626           Platino
## 114            422.4268           Platino
## 115            642.1016               Oro
## 116            413.3718           Platino
## 117            479.2311           Platino
## 118            593.0772           Platino
## 119            506.5473           Platino
## 120            571.3075           Platino
## 121            576.3112           Platino
## 122            576.8025           Platino
## 123            514.2395           Platino
## 124            495.1760           Platino
## 125            514.3366           Platino
## 126            541.2266           Platino
## 127            516.8316           Platino
## 128            468.4457           Platino
## 129            548.2803           Platino
## 130            431.6177           Platino
## 131            552.9403           Platino
## 132            573.3062           Platino
## 133            452.6273           Platino
## 134            542.7116           Platino
## 135            407.8040           Platino
## 136            482.3536           Platino
## 137            529.2301           Platino
## 138            433.0488           Platino
## 139            476.1914           Platino
## 140            439.9979           Platino
## 141            448.9333           Platino
## 142            472.9922           Platino
## 143            463.9235           Platino
## 144            350.0582            Bronce
## 145            460.0613           Platino
## 146            505.7711           Platino
## 147            463.4850           Platino
## 148            479.7319           Platino
## 149            424.1855           Platino
## 150            465.8893           Platino
## 151            426.7752           Platino
## 152            684.1634               Oro
## 153            555.8926           Platino
## 154            657.0199               Oro
## 155            595.8038           Platino
## 156            503.9784           Platino
## 157            586.1559           Platino
## 158            744.2219               Oro
## 159            512.8254           Platino
## 160            528.2238           Platino
## 161            468.9135           Platino
## 162            357.5914            Bronce
## 163            536.4231           Platino
## 164            490.2066           Platino
## 165            550.0476           Platino
## 166            513.4506           Platino
## 167            497.8119           Platino
## 168            578.9863           Platino
## 169            506.5364           Platino
## 170            501.7492           Platino
## 171            421.9668           Platino
## 172            439.8913           Platino
## 173            666.1256               Oro
## 174            298.7620            Bronce
## 175            465.1766           Platino
## 176            373.8857            Bronce
## 177            532.7175           Platino
## 178            554.9008           Platino
## 179            537.7732           Platino
## 180            501.1002           Platino
## 181            517.1651           Platino
## 182            557.5293           Platino
## 183            493.7192           Platino
## 184            452.1226           Platino
## 185            577.2735           Platino
## 186            485.9231           Platino
## 187            425.7451           Platino
## 188            537.2151           Platino
## 189            524.6380           Platino
## 190            478.8854           Platino
## 191            612.3852               Oro
## 192            476.7667           Platino
## 193            505.1196           Platino
## 194            545.9455           Platino
## 195            434.0217           Platino
## 196            424.6753           Platino
## 197            352.5501            Bronce
## 198            662.9611               Oro
## 199            560.5602           Platino
## 200            467.5019           Platino
## 201            504.8704           Platino
## 202            590.5627           Platino
## 203            443.9656           Platino
## 204            392.4974            Bronce
## 205            568.7176           Platino
## 206            712.3963               Oro
## 207            413.2960           Platino
## 208            562.0820           Platino
## 209            412.0129           Platino
## 210            468.6685           Platino
## 211            496.5541           Platino
## 212            548.5185           Platino
## 213            536.1309           Platino
## 214            558.4273           Platino
## 215            357.8637            Bronce
## 216            529.0567           Platino
## 217            387.3571            Bronce
## 218            528.9336           Platino
## 219            420.9162           Platino
## 220            496.9334           Platino
## 221            519.3730           Platino
## 222            591.4377           Platino
## 223            502.4098           Platino
## 224            604.3348               Oro
## 225            555.0684           Platino
## 226            256.6706            Bronce
## 227            547.1110           Platino
## 228            461.9209           Platino
## 229            458.3769           Platino
## 230            436.2835           Platino
## 231            532.9352           Platino
## 232            512.5525           Platino
## 233            630.4228               Oro
## 234            463.7460           Platino
## 235            493.1802           Platino
## 236            501.2092           Platino
## 237            501.9283           Platino
## 238            376.3369            Bronce
## 239            421.3266           Platino
## 240            538.7749           Platino
## 241            398.1635            Bronce
## 242            571.4710           Platino
## 243            451.6286           Platino
## 244            490.6004           Platino
## 245            591.7811           Platino
## 246            409.0705           Platino
## 247            563.4460           Platino
## 248            647.6195               Oro
## 249            448.3404           Platino
## 250            518.7865           Platino
## 251            523.6339           Platino
## 252            393.8574            Bronce
## 253            426.1545           Platino
## 254            503.3879           Platino
## 255            482.6025           Platino
## 256            524.7976           Platino
## 257            574.6548           Platino
## 258            574.7472           Platino
## 259            660.4252               Oro
## 260            375.3985            Bronce
## 261            640.1877               Oro
## 262            514.0098           Platino
## 263            376.4968            Bronce
## 264            484.5198           Platino
## 265            614.7296               Oro
## 266            567.4750           Platino
## 267            554.0031           Platino
## 268            399.9839            Bronce
## 269            479.1729           Platino
## 270            585.9318           Platino
## 271            540.9957           Platino
## 272            628.0478               Oro
## 273            582.4919           Platino
## 274            640.7862               Oro
## 275            446.4187           Platino
## 276            570.6301           Platino
## 277            423.3083           Platino
## 278            616.6603               Oro
## 279            530.3625           Platino
## 280            442.3631           Platino
## 281            511.9799           Platino
## 282            560.4438           Platino
## 283            475.2634           Platino
## 284            374.2697            Bronce
## 285            463.5914           Platino
## 286            471.6029           Platino
## 287            626.0187               Oro
## 288            432.4721           Platino
## 289            356.6156            Bronce
## 290            467.4278           Platino
## 291            503.2174           Platino
## 292            378.4736            Bronce
## 293            584.2183           Platino
## 294            451.7279           Platino
## 295            557.6341           Platino
## 296            432.7207           Platino
## 297            506.4239           Platino
## 298            510.1598           Platino
## 299            587.5748           Platino
## 300            282.4712            Bronce
## 301            473.9499           Platino
## 302            489.9081           Platino
## 303            541.9722           Platino
## 304            266.0863            Bronce
## 305            494.6872           Platino
## 306            689.7876               Oro
## 307            387.5347            Bronce
## 308            441.8966           Platino
## 309            604.8413               Oro
## 310            302.1895            Bronce
## 311            479.6148           Platino
## 312            506.1323           Platino
## 313            319.9289            Bronce
## 314            528.3092           Platino
## 315            610.1280               Oro
## 316            584.1059           Platino
## 317            466.4212           Platino
## 318            404.8245           Platino
## 319            564.7910           Platino
## 320            596.5167           Platino
## 321            368.6548            Bronce
## 322            542.4125           Platino
## 323            478.2621           Platino
## 324            473.3605           Platino
## 325            559.1990           Platino
## 326            447.1876           Platino
## 327            505.2301           Platino
## 328            557.2527           Platino
## 329            422.3687           Platino
## 330            445.0622           Platino
## 331            442.0644           Platino
## 332            533.0401           Platino
## 333            424.2028           Platino
## 334            498.6356           Platino
## 335            330.5944            Bronce
## 336            443.4419           Platino
## 337            478.6009           Platino
## 338            440.0027           Platino
## 339            357.7831            Bronce
## 340            476.1392           Platino
## 341            501.1225           Platino
## 342            592.6885           Platino
## 343            486.0834           Platino
## 344            576.0252           Platino
## 345            442.7229           Platino
## 346            461.7910           Platino
## 347            488.3875           Platino
## 348            593.1564           Platino
## 349            392.8103            Bronce
## 350            443.1972           Platino
## 351            535.4808           Platino
## 352            533.3966           Platino
## 353            532.1274           Platino
## 354            558.9481           Platino
## 355            508.7719           Platino
## 356            403.7669           Platino
## 357            640.5841               Oro
## 358            461.6283           Platino
## 359            382.4161            Bronce
## 360            561.8747           Platino
## 361            444.5761           Platino
## 362            401.0331           Platino
## 363            384.3261            Bronce
## 364            527.7830           Platino
## 365            482.1450           Platino
## 366            594.2745           Platino
## 367            502.0925           Platino
## 368            407.6572           Platino
## 369            708.9352               Oro
## 370            531.9616           Platino
## 371            521.2408           Platino
## 372            447.3690           Platino
## 373            385.1523            Bronce
## 374            430.5889           Platino
## 375            418.6027           Platino
## 376            478.9514           Platino
## 377            483.7965           Platino
## 378            538.9420           Platino
## 379            486.1638           Platino
## 380            385.0950            Bronce
## 381            527.7838           Platino
## 382            547.1907           Platino
## 383            410.6029           Platino
## 384            583.9778           Platino
## 385            474.5323           Platino
## 386            414.9351           Platino
## 387            550.8134           Platino
## 388            458.7811           Platino
## 389            407.5422           Platino
## 390            581.3089           Platino
## 391            546.5567           Platino
## 392            503.1751           Platino
## 393            549.1316           Platino
## 394            482.8310           Platino
## 395            557.6083           Platino
## 396            484.8770           Platino
## 397            669.9871               Oro
## 398            547.7100           Platino
## 399            537.8253           Platino
## 400            408.2169           Platino
## 401            663.0748               Oro
## 402            506.3759           Platino
## 403            528.4193           Platino
## 404            632.1236               Oro
## 405            488.2703           Platino
## 406            508.7357           Platino
## 407            411.1870           Platino
## 408            409.0945           Platino
## 409            467.8009           Platino
## 410            512.1659           Platino
## 411            608.2718               Oro
## 412            589.0265           Platino
## 413            444.0538           Platino
## 414            493.1813           Platino
## 415            532.7248           Platino
## 416            275.9184            Bronce
## 417            511.0388           Platino
## 418            438.4177           Platino
## 419            475.7251           Platino
## 420            483.5432           Platino
## 421            663.8037               Oro
## 422            544.4093           Platino
## 423            630.1567               Oro
## 424            461.1122           Platino
## 425            491.9115           Platino
## 426            574.4157           Platino
## 427            530.7667           Platino
## 428            581.7988           Platino
## 429            556.2981           Platino
## 430            502.1328           Platino
## 431            556.1864           Platino
## 432            475.0716           Platino
## 433            486.9471           Platino
## 434            434.1442           Platino
## 435            304.1356            Bronce
## 436            571.2160           Platino
## 437            583.0796           Platino
## 438            445.7498           Platino
## 439            392.9923            Bronce
## 440            565.9944           Platino
## 441            499.1402           Platino
## 442            510.5394           Platino
## 443            308.5277            Bronce
## 444            561.5165           Platino
## 445            423.4705           Platino
## 446            513.1531           Platino
## 447            529.1945           Platino
## 448            314.4385            Bronce
## 449            478.5843           Platino
## 450            444.5822           Platino
## 451            475.0154           Platino
## 452            436.7206           Platino
## 453            521.1953           Platino
## 454            478.1831           Platino
## 455            432.4812           Platino
## 456            438.3037           Platino
## 457            388.9405            Bronce
## 458            534.7715           Platino
## 459            537.9158           Platino
## 460            407.8764           Platino
## 461            618.8460               Oro
## 462            502.7711           Platino
## 463            397.4206            Bronce
## 464            392.2852            Bronce
## 465            689.2357               Oro
## 466            543.1326           Platino
## 467            577.7360           Platino
## 468            436.5807           Platino
## 469            553.9947           Platino
## 470            427.3565           Platino
## 471            424.7288           Platino
## 472            541.0498           Platino
## 473            469.3831           Platino
## 474            444.5455           Platino
## 475            492.5568           Platino
## 476            535.3216           Platino
## 477            408.9583           Platino
## 478            487.5555           Platino
## 479            487.6462           Platino
## 480            402.1671           Platino
## 481            551.0230           Platino
## 482            497.3896           Platino
## 483            494.6386           Platino
## 484            479.2474           Platino
## 485            462.6565           Platino
## 486            515.5025           Platino
## 487            576.4776           Platino
## 488            357.8580            Bronce
## 489            597.7399           Platino
## 490            327.3780            Bronce
## 491            510.4014           Platino
## 492            510.5015           Platino
## 493            403.8195           Platino
## 494            627.6033               Oro
## 495            510.6618           Platino
## 496            573.8474           Platino
## 497            529.0490           Platino
## 498            551.6201           Platino
## 499            456.4695           Platino
## 500            497.7786           Platino
En base a la facturación anual, se clasificaron los clientes en tres categorías distintas:
1. Oro. Aquellos que su facturación es USD600,000 o superior;
2. Platino. Aquellos que su facturación es USD400,000 o superior;
3. Bronce. Aquellos que su facturación es inferior a los USD400,000.

4. Modelos de clasificación

#Conversión de categorías a números para SVM
dataset$Categoria.Cliente.Num[dataset$Categoria.Cliente == "Oro" ] = 1
dataset$Categoria.Cliente.Num[dataset$Categoria.Cliente == "Platino" ] = 2
dataset$Categoria.Cliente.Num[dataset$Categoria.Cliente == "Bronce" ] = 3
#Data split
library(caret)
## Loading required package: lattice
## Loading required package: ggplot2
trainIndex = createDataPartition(dataset$Yearly.Amount.Spent, p=0.7, list=FALSE)
trainSet = dataset[trainIndex, ]
testSet = dataset[-trainIndex, ]

4.1. LDA

4.1.1 Membresía

library(e1071)
library(MASS)
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
#Modelo por LDA
lda.1=lda(formula = Categoria.Cliente ~ Length.of.Membership, data = trainSet)

#Predicción
prediccionesLDA.1 = predict(object = lda.1,
                          newdata = testSet)

cm.411 = confusionMatrix(as.factor(prediccionesLDA.1$class),as.factor(testSet$Categoria.Cliente))
cm.411
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       6   0       1
##    Oro          0   4       4
##    Platino     10   7     116
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8514          
##                  95% CI : (0.7836, 0.9044)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.1694          
##                                           
##                   Kappa : 0.4197          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.37500    0.36364         0.9587
## Specificity                0.99242    0.97080         0.3704
## Pos Pred Value             0.85714    0.50000         0.8722
## Neg Pred Value             0.92908    0.95000         0.6667
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.04054    0.02703         0.7838
## Detection Prevalence       0.04730    0.05405         0.8986
## Balanced Accuracy          0.68371    0.66722         0.6645

4.1.2. App

#Modelo por LDA 
lda.2=lda(formula = Categoria.Cliente ~ Time.on.App, data = trainSet)

#Predicción
prediccionesLDA.2 = predict(object = lda.2,
                          newdata = testSet)

cm.412 = confusionMatrix(as.factor(prediccionesLDA.2$class),as.factor(testSet$Categoria.Cliente))
cm.412
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       2   0       1
##    Oro          0   0       1
##    Platino     14  11     119
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0.0961          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.12500   0.000000        0.98347
## Specificity                0.99242   0.992701        0.07407
## Pos Pred Value             0.66667   0.000000        0.82639
## Neg Pred Value             0.90345   0.925170        0.50000
## Prevalence                 0.10811   0.074324        0.81757
## Detection Rate             0.01351   0.000000        0.80405
## Detection Prevalence       0.02027   0.006757        0.97297
## Balanced Accuracy          0.55871   0.496350        0.52877

4.1.3. Web

#Modelo por LDA 
lda.3=lda(formula = Categoria.Cliente ~ Time.on.Website, data = trainSet)

#Predicción
prediccionesLDA.3 = predict(object = lda.3,
                          newdata = testSet)

cm.413 = confusionMatrix(as.factor(prediccionesLDA.3$class),as.factor(testSet$Categoria.Cliente))
cm.413
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       0   0       0
##    Oro          0   0       0
##    Platino     16  11     121
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                 0.0000    0.00000         1.0000
## Specificity                 1.0000    1.00000         0.0000
## Pos Pred Value                 NaN        NaN         0.8176
## Neg Pred Value              0.8919    0.92568            NaN
## Prevalence                  0.1081    0.07432         0.8176
## Detection Rate              0.0000    0.00000         0.8176
## Detection Prevalence        0.0000    0.00000         1.0000
## Balanced Accuracy           0.5000    0.50000         0.5000

4.1.4. Sesiones promedio

#Modelo por LDA 
lda.4=lda(formula = Categoria.Cliente ~ Avg..Session.Length, data = trainSet)

#Predicción
prediccionesLDA.4 = predict(object = lda.4,
                          newdata = testSet)

cm.414 = confusionMatrix(as.factor(prediccionesLDA.4$class),as.factor(testSet$Categoria.Cliente))
cm.414
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       0   0       0
##    Oro          0   0       0
##    Platino     16  11     121
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                 0.0000    0.00000         1.0000
## Specificity                 1.0000    1.00000         0.0000
## Pos Pred Value                 NaN        NaN         0.8176
## Neg Pred Value              0.8919    0.92568            NaN
## Prevalence                  0.1081    0.07432         0.8176
## Detection Rate              0.0000    0.00000         0.8176
## Detection Prevalence        0.0000    0.00000         1.0000
## Balanced Accuracy           0.5000    0.50000         0.5000

4.1.5. Membresia + App

#Modelo por LDA 
lda.5=lda(formula = Categoria.Cliente ~ Length.of.Membership + Time.on.App, data = trainSet)

#Predicción
prediccionesLDA.5 = predict(object = lda.5,
                          newdata = testSet)

cm.415 = confusionMatrix(as.factor(prediccionesLDA.5$class),as.factor(testSet$Categoria.Cliente))
cm.415
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce      10   0       2
##    Oro          0   8       0
##    Platino      6   3     119
## 
## Overall Statistics
##                                           
##                Accuracy : 0.9257          
##                  95% CI : (0.8709, 0.9623)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.0001496       
##                                           
##                   Kappa : 0.7347          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.62500    0.72727         0.9835
## Specificity                0.98485    1.00000         0.6667
## Pos Pred Value             0.83333    1.00000         0.9297
## Neg Pred Value             0.95588    0.97857         0.9000
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.06757    0.05405         0.8041
## Detection Prevalence       0.08108    0.05405         0.8649
## Balanced Accuracy          0.80492    0.86364         0.8251

4.1.6. Membresia + Website

#Modelo por LDA
lda.6=lda(formula = Categoria.Cliente ~ Length.of.Membership + Time.on.Website, data = trainSet)

#Predicción
prediccionesLDA.6 = predict(object = lda.6,
                          newdata = testSet)

cm.416 = confusionMatrix(as.factor(prediccionesLDA.6$class),as.factor(testSet$Categoria.Cliente))
cm.416
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       6   0       0
##    Oro          0   3       4
##    Platino     10   8     117
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8514          
##                  95% CI : (0.7836, 0.9044)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.1694          
##                                           
##                   Kappa : 0.3966          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.37500    0.27273         0.9669
## Specificity                1.00000    0.97080         0.3333
## Pos Pred Value             1.00000    0.42857         0.8667
## Neg Pred Value             0.92958    0.94326         0.6923
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.04054    0.02027         0.7905
## Detection Prevalence       0.04054    0.04730         0.9122
## Balanced Accuracy          0.68750    0.62177         0.6501

4.1.7.Membresia + Sesiones promedio

#Modelo por LDA 
lda.7=lda(formula = Categoria.Cliente ~ Length.of.Membership + Avg..Session.Length, data = trainSet)

#Predicción
prediccionesLDA.7 = predict(object = lda.7,
                          newdata = testSet)

cm.417 = confusionMatrix(as.factor(prediccionesLDA.7$class),as.factor(testSet$Categoria.Cliente))
cm.417
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       5   0       0
##    Oro          0   4       3
##    Platino     11   7     118
## 
## Overall Statistics
##                                         
##                Accuracy : 0.8581        
##                  95% CI : (0.7913, 0.91)
##     No Information Rate : 0.8176        
##     P-Value [Acc > NIR] : 0.1188        
##                                         
##                   Kappa : 0.4126        
##                                         
##  Mcnemar's Test P-Value : NA            
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.31250    0.36364         0.9752
## Specificity                1.00000    0.97810         0.3333
## Pos Pred Value             1.00000    0.57143         0.8676
## Neg Pred Value             0.92308    0.95035         0.7500
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.03378    0.02703         0.7973
## Detection Prevalence       0.03378    0.04730         0.9189
## Balanced Accuracy          0.65625    0.67087         0.6543

4.1.8. App + Website

#Modelo por LDA 
lda.8=lda(formula = Categoria.Cliente ~ Time.on.App + Time.on.Website, data = trainSet)

#Predicción
prediccionesLDA.8 = predict(object = lda.8,
                          newdata = testSet)

cm.418 = confusionMatrix(as.factor(prediccionesLDA.8$class),as.factor(testSet$Categoria.Cliente))
cm.418
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       2   0       0
##    Oro          0   0       1
##    Platino     14  11     120
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8243          
##                  95% CI : (0.7533, 0.8819)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.4666          
##                                           
##                   Kappa : 0.1084          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.12500   0.000000        0.99174
## Specificity                1.00000   0.992701        0.07407
## Pos Pred Value             1.00000   0.000000        0.82759
## Neg Pred Value             0.90411   0.925170        0.66667
## Prevalence                 0.10811   0.074324        0.81757
## Detection Rate             0.01351   0.000000        0.81081
## Detection Prevalence       0.01351   0.006757        0.97973
## Balanced Accuracy          0.56250   0.496350        0.53290

4.1.9. App + Sesiones promedio

#Modelo por LDA 
lda.9=lda(formula = Categoria.Cliente ~ Time.on.App + Avg..Session.Length, data = trainSet)

#Predicción
prediccionesLDA.9 = predict(object = lda.9,
                          newdata = testSet)

cm.419 = confusionMatrix(as.factor(prediccionesLDA.9$class),as.factor(testSet$Categoria.Cliente))
cm.419
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       3   0       0
##    Oro          0   0       1
##    Platino     13  11     120
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8311          
##                  95% CI : (0.7608, 0.8876)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.3826          
##                                           
##                   Kappa : 0.1631          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.18750   0.000000         0.9917
## Specificity                1.00000   0.992701         0.1111
## Pos Pred Value             1.00000   0.000000         0.8333
## Neg Pred Value             0.91034   0.925170         0.7500
## Prevalence                 0.10811   0.074324         0.8176
## Detection Rate             0.02027   0.000000         0.8108
## Detection Prevalence       0.02027   0.006757         0.9730
## Balanced Accuracy          0.59375   0.496350         0.5514

4.1.10. Website + Sesiones promedio

#Modelo por LDA 
lda.10=lda(formula = Categoria.Cliente ~ Time.on.Website + Avg..Session.Length, data = trainSet)

#Predicción
prediccionesLDA.10 = predict(object = lda.10,
                          newdata = testSet)

cm.4110 = confusionMatrix(as.factor(prediccionesLDA.10$class),as.factor(testSet$Categoria.Cliente))
cm.4110
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       0   0       0
##    Oro          0   0       0
##    Platino     16  11     121
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                 0.0000    0.00000         1.0000
## Specificity                 1.0000    1.00000         0.0000
## Pos Pred Value                 NaN        NaN         0.8176
## Neg Pred Value              0.8919    0.92568            NaN
## Prevalence                  0.1081    0.07432         0.8176
## Detection Rate              0.0000    0.00000         0.8176
## Detection Prevalence        0.0000    0.00000         1.0000
## Balanced Accuracy           0.5000    0.50000         0.5000

4.1.11. Membresía + App + Website

#Modelo por LDA 
lda.11=lda(formula = Categoria.Cliente ~ Length.of.Membership + Time.on.App + Time.on.Website, data = trainSet)

#Predicción
prediccionesLDA.11 = predict(object = lda.11,
                          newdata = testSet)

cm.4111 = confusionMatrix(as.factor(prediccionesLDA.11$class),as.factor(testSet$Categoria.Cliente))
cm.4111
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       9   0       2
##    Oro          0   8       0
##    Platino      7   3     119
## 
## Overall Statistics
##                                           
##                Accuracy : 0.9189          
##                  95% CI : (0.8627, 0.9574)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.000401        
##                                           
##                   Kappa : 0.7055          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.56250    0.72727         0.9835
## Specificity                0.98485    1.00000         0.6296
## Pos Pred Value             0.81818    1.00000         0.9225
## Neg Pred Value             0.94891    0.97857         0.8947
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.06081    0.05405         0.8041
## Detection Prevalence       0.07432    0.05405         0.8716
## Balanced Accuracy          0.77367    0.86364         0.8066

4.1.12. Membresía + App + Sesión promedio

#Modelo por LDA 
lda.12=lda(formula = Categoria.Cliente ~ Length.of.Membership + Time.on.App + Avg..Session.Length, data = trainSet)

#Predicción
prediccionesLDA.12 = predict(object = lda.12,
                          newdata = testSet)

cm.4112 = confusionMatrix(as.factor(prediccionesLDA.12$class),as.factor(testSet$Categoria.Cliente))
cm.4112
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce      12   0       0
##    Oro          0   8       0
##    Platino      4   3     121
## 
## Overall Statistics
##                                          
##                Accuracy : 0.9527         
##                  95% CI : (0.905, 0.9808)
##     No Information Rate : 0.8176         
##     P-Value [Acc > NIR] : 1.057e-06      
##                                          
##                   Kappa : 0.8312         
##                                          
##  Mcnemar's Test P-Value : NA             
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.75000    0.72727         1.0000
## Specificity                1.00000    1.00000         0.7407
## Pos Pred Value             1.00000    1.00000         0.9453
## Neg Pred Value             0.97059    0.97857         1.0000
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.08108    0.05405         0.8176
## Detection Prevalence       0.08108    0.05405         0.8649
## Balanced Accuracy          0.87500    0.86364         0.8704

4.1.13. Membresía + Website + Sesión promedio

#Modelo por LDA 
lda.13=lda(formula = Categoria.Cliente ~ Length.of.Membership + Time.on.Website + Avg..Session.Length, data = trainSet)

#Predicción
prediccionesLDA.13 = predict(object = lda.13,
                          newdata = testSet)

cm.4113 = confusionMatrix(as.factor(prediccionesLDA.13$class),as.factor(testSet$Categoria.Cliente))
cm.4113
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       5   0       1
##    Oro          0   4       4
##    Platino     11   7     116
## 
## Overall Statistics
##                                          
##                Accuracy : 0.8446         
##                  95% CI : (0.776, 0.8989)
##     No Information Rate : 0.8176         
##     P-Value [Acc > NIR] : 0.2312         
##                                          
##                   Kappa : 0.3818         
##                                          
##  Mcnemar's Test P-Value : NA             
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.31250    0.36364         0.9587
## Specificity                0.99242    0.97080         0.3333
## Pos Pred Value             0.83333    0.50000         0.8657
## Neg Pred Value             0.92254    0.95000         0.6429
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.03378    0.02703         0.7838
## Detection Prevalence       0.04054    0.05405         0.9054
## Balanced Accuracy          0.65246    0.66722         0.6460

4.1.14. App + Website + Sesión promedio

#Modelo por LDA 
lda.14=lda(formula = Categoria.Cliente ~ Time.on.App + Time.on.Website + Avg..Session.Length, data = trainSet)

#Predicción
prediccionesLDA.14 = predict(object = lda.14,
                          newdata = testSet)

cm.4114 = confusionMatrix(as.factor(prediccionesLDA.14$class),as.factor(testSet$Categoria.Cliente))
cm.4114
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       2   0       0
##    Oro          0   0       1
##    Platino     14  11     120
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8243          
##                  95% CI : (0.7533, 0.8819)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.4666          
##                                           
##                   Kappa : 0.1084          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.12500   0.000000        0.99174
## Specificity                1.00000   0.992701        0.07407
## Pos Pred Value             1.00000   0.000000        0.82759
## Neg Pred Value             0.90411   0.925170        0.66667
## Prevalence                 0.10811   0.074324        0.81757
## Detection Rate             0.01351   0.000000        0.81081
## Detection Prevalence       0.01351   0.006757        0.97973
## Balanced Accuracy          0.56250   0.496350        0.53290

4.1.15. Membresía + App + Website + Sesión promedio

#Modelo por LDA 
lda.15=lda(formula = Categoria.Cliente ~ Length.of.Membership + Time.on.App + Time.on.Website + Avg..Session.Length, data = trainSet)

#Predicción
prediccionesLDA.15 = predict(object = lda.15,
                          newdata = testSet)

cm.4115 = confusionMatrix(as.factor(prediccionesLDA.15$class),as.factor(testSet$Categoria.Cliente))
cm.4115
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce      12   0       1
##    Oro          0   8       0
##    Platino      4   3     120
## 
## Overall Statistics
##                                           
##                Accuracy : 0.9459          
##                  95% CI : (0.8963, 0.9764)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 4.331e-06       
##                                           
##                   Kappa : 0.8103          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.75000    0.72727         0.9917
## Specificity                0.99242    1.00000         0.7407
## Pos Pred Value             0.92308    1.00000         0.9449
## Neg Pred Value             0.97037    0.97857         0.9524
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.08108    0.05405         0.8108
## Detection Prevalence       0.08784    0.05405         0.8581
## Balanced Accuracy          0.87121    0.86364         0.8662
Hallazgos. Mediante esta primera evaluación por medio de LDA se observó un pobre rendimiento en modelos de una sola variable. Por ende en los algoritmos siguientes estas evaluaciones serán obviadas.
Las combinaciones con mejor rendimiento son aquellas donde participan las variables tiempo en App y longevidad de la membresía.
Así mismo, la variable “tiempo en Website” no aporta mucho en la mayoría de los casos. Este comportamiento ya lo habíamos visto desde el análisis por correlación (índice 0).
Pese a ello, cabe la pena destacar que gracias a su inclusión en el conglomerado general se logró el rendimiento más alto en este algoritmo.

4.2 SVM

4.2.1. Membresía + App

#SVM
svm.1 = svm(formula = Categoria.Cliente.Num ~ Length.of.Membership + Time.on.App,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.1 = predict(object = svm.1,
                          newdata = testSet)

prediccionesSVMMF.1 = round(prediccionesSVMMF.1)
#Matriz de confusión
cm.421 = confusionMatrix(as.factor(prediccionesSVMMF.1), as.factor(testSet$Categoria.Cliente.Num))
cm.421
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   5   2   0
##          2   6 117  14
##          3   0   2   2
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8378          
##                  95% CI : (0.7684, 0.8933)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.3031          
##                                           
##                   Kappa : 0.3151          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.45455   0.9669  0.12500
## Specificity           0.98540   0.2593  0.98485
## Pos Pred Value        0.71429   0.8540  0.50000
## Neg Pred Value        0.95745   0.6364  0.90278
## Prevalence            0.07432   0.8176  0.10811
## Detection Rate        0.03378   0.7905  0.01351
## Detection Prevalence  0.04730   0.9257  0.02703
## Balanced Accuracy     0.71997   0.6131  0.55492

4.2.2. Membresía + Website

#SVM
svm.2 = svm(formula = Categoria.Cliente.Num ~ Length.of.Membership + Time.on.Website,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.2 = predict(object = svm.2,
                          newdata = testSet)

prediccionesSVMMF.2 = round(prediccionesSVMMF.2)
#Matriz de confusión
cm.422 = confusionMatrix(as.factor(prediccionesSVMMF.2), as.factor(testSet$Categoria.Cliente.Num))
cm.422
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   1   2   0
##          2  10 119  14
##          3   0   0   2
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8243          
##                  95% CI : (0.7533, 0.8819)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.4666          
##                                           
##                   Kappa : 0.1517          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity          0.090909   0.9835  0.12500
## Specificity          0.985401   0.1111  1.00000
## Pos Pred Value       0.333333   0.8322  1.00000
## Neg Pred Value       0.931034   0.6000  0.90411
## Prevalence           0.074324   0.8176  0.10811
## Detection Rate       0.006757   0.8041  0.01351
## Detection Prevalence 0.020270   0.9662  0.01351
## Balanced Accuracy    0.538155   0.5473  0.56250

4.2.3. Membresía + Sesión promedio

#SVM
svm.3 = svm(formula = Categoria.Cliente.Num ~ Length.of.Membership + Avg..Session.Length,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.3 = predict(object = svm.3,
                          newdata = testSet)

prediccionesSVMMF.3 = round(prediccionesSVMMF.3)
#Matriz de confusión
cm.423 = confusionMatrix(as.factor(prediccionesSVMMF.3), as.factor(testSet$Categoria.Cliente.Num))
cm.423
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   3   2   0
##          2   8 119  15
##          3   0   0   1
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8311          
##                  95% CI : (0.7608, 0.8876)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.3826          
##                                           
##                   Kappa : 0.2045          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.27273   0.9835 0.062500
## Specificity           0.98540   0.1481 1.000000
## Pos Pred Value        0.60000   0.8380 1.000000
## Neg Pred Value        0.94406   0.6667 0.897959
## Prevalence            0.07432   0.8176 0.108108
## Detection Rate        0.02027   0.8041 0.006757
## Detection Prevalence  0.03378   0.9595 0.006757
## Balanced Accuracy     0.62906   0.5658 0.531250

4.2.4. App + Website

#SVM
svm.4 = svm(formula = Categoria.Cliente.Num ~ Time.on.App + Time.on.Website,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.4 = predict(object = svm.4,
                          newdata = testSet)

prediccionesSVMMF.4 = round(prediccionesSVMMF.4)
#Matriz de confusión
cm.424 = confusionMatrix(as.factor(prediccionesSVMMF.4), as.factor(testSet$Categoria.Cliente.Num))
## Warning in confusionMatrix.default(as.factor(prediccionesSVMMF.4),
## as.factor(testSet$Categoria.Cliente.Num)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.424
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   0   0   0
##          2  11 121  16
##          3   0   0   0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.00000   1.0000   0.0000
## Specificity           1.00000   0.0000   1.0000
## Pos Pred Value            NaN   0.8176      NaN
## Neg Pred Value        0.92568      NaN   0.8919
## Prevalence            0.07432   0.8176   0.1081
## Detection Rate        0.00000   0.8176   0.0000
## Detection Prevalence  0.00000   1.0000   0.0000
## Balanced Accuracy     0.50000   0.5000   0.5000

4.2.5. App + Sesión promedio

#SVM
svm.5 = svm(formula = Categoria.Cliente.Num ~ Time.on.App + Avg..Session.Length,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.5 = predict(object = svm.5,
                          newdata = testSet)

prediccionesSVMMF.5 = round(prediccionesSVMMF.5)
#Matriz de confusión
cm.425 = confusionMatrix(as.factor(prediccionesSVMMF.5), as.factor(testSet$Categoria.Cliente.Num))
## Warning in levels(reference) != levels(data): longitud de objeto mayor no es
## múltiplo de la longitud de uno menor
## Warning in confusionMatrix.default(as.factor(prediccionesSVMMF.5),
## as.factor(testSet$Categoria.Cliente.Num)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.425
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   1   3   0
##          2  10 118  16
##          3   0   0   0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8041          
##                  95% CI : (0.7309, 0.8647)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.7082          
##                                           
##                   Kappa : 0.0325          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity          0.090909  0.97521   0.0000
## Specificity          0.978102  0.03704   1.0000
## Pos Pred Value       0.250000  0.81944      NaN
## Neg Pred Value       0.930556  0.25000   0.8919
## Prevalence           0.074324  0.81757   0.1081
## Detection Rate       0.006757  0.79730   0.0000
## Detection Prevalence 0.027027  0.97297   0.0000
## Balanced Accuracy    0.534506  0.50612   0.5000

4.2.6. Website + Sesión promedio

#SVM
svm.6 = svm(formula = Categoria.Cliente.Num ~ Time.on.Website + Avg..Session.Length,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.6 = predict(object = svm.6,
                          newdata = testSet)

prediccionesSVMMF.6 = round(prediccionesSVMMF.6)
#Matriz de confusión
cm.426 = confusionMatrix(as.factor(prediccionesSVMMF.6), as.factor(testSet$Categoria.Cliente.Num))
## Warning in confusionMatrix.default(as.factor(prediccionesSVMMF.6),
## as.factor(testSet$Categoria.Cliente.Num)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.426
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   0   0   0
##          2  11 121  16
##          3   0   0   0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.00000   1.0000   0.0000
## Specificity           1.00000   0.0000   1.0000
## Pos Pred Value            NaN   0.8176      NaN
## Neg Pred Value        0.92568      NaN   0.8919
## Prevalence            0.07432   0.8176   0.1081
## Detection Rate        0.00000   0.8176   0.0000
## Detection Prevalence  0.00000   1.0000   0.0000
## Balanced Accuracy     0.50000   0.5000   0.5000

4.2.7. Membresía + App + Website

#SVM
svm.7 = svm(formula = Categoria.Cliente.Num ~ Length.of.Membership + Time.on.App + Time.on.Website,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.7 = predict(object = svm.7,
                          newdata = testSet)

prediccionesSVMMF.7 = round(prediccionesSVMMF.7)
#Matriz de confusión
cm.427 = confusionMatrix(as.factor(prediccionesSVMMF.7), as.factor(testSet$Categoria.Cliente.Num))
## Warning in confusionMatrix.default(as.factor(prediccionesSVMMF.7),
## as.factor(testSet$Categoria.Cliente.Num)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.427
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   0   0   0
##          2  11 121  16
##          3   0   0   0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.00000   1.0000   0.0000
## Specificity           1.00000   0.0000   1.0000
## Pos Pred Value            NaN   0.8176      NaN
## Neg Pred Value        0.92568      NaN   0.8919
## Prevalence            0.07432   0.8176   0.1081
## Detection Rate        0.00000   0.8176   0.0000
## Detection Prevalence  0.00000   1.0000   0.0000
## Balanced Accuracy     0.50000   0.5000   0.5000

4.2.8. Membresía + App + Sesión promedio

#SVM
svm.8 = svm(formula = Categoria.Cliente.Num ~ Length.of.Membership + Time.on.App + Avg..Session.Length,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.8 = predict(object = svm.8,
                          newdata = testSet)

prediccionesSVMMF.8 = round(prediccionesSVMMF.8)
#Matriz de confusión
cm.428 = confusionMatrix(as.factor(prediccionesSVMMF.8), as.factor(testSet$Categoria.Cliente.Num))
## Warning in levels(reference) != levels(data): longitud de objeto mayor no es
## múltiplo de la longitud de uno menor
## Warning in confusionMatrix.default(as.factor(prediccionesSVMMF.8),
## as.factor(testSet$Categoria.Cliente.Num)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.428
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   2   1   0
##          2   9 120  16
##          3   0   0   0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8243          
##                  95% CI : (0.7533, 0.8819)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.4666          
##                                           
##                   Kappa : 0.1105          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.18182  0.99174   0.0000
## Specificity           0.99270  0.07407   1.0000
## Pos Pred Value        0.66667  0.82759      NaN
## Neg Pred Value        0.93793  0.66667   0.8919
## Prevalence            0.07432  0.81757   0.1081
## Detection Rate        0.01351  0.81081   0.0000
## Detection Prevalence  0.02027  0.97973   0.0000
## Balanced Accuracy     0.58726  0.53290   0.5000

4.2.9. Membresía + Website + Sesión promedio

#SVM
svm.9 = svm(formula = Categoria.Cliente.Num ~ Length.of.Membership + Time.on.Website + Avg..Session.Length,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.9 = predict(object = svm.9,
                          newdata = testSet)

prediccionesSVMMF.9 = round(prediccionesSVMMF.9)
#Matriz de confusión
cm.429 = confusionMatrix(as.factor(prediccionesSVMMF.9), as.factor(testSet$Categoria.Cliente.Num))
## Warning in confusionMatrix.default(as.factor(prediccionesSVMMF.9),
## as.factor(testSet$Categoria.Cliente.Num)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.429
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   0   0   0
##          2  11 121  16
##          3   0   0   0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.00000   1.0000   0.0000
## Specificity           1.00000   0.0000   1.0000
## Pos Pred Value            NaN   0.8176      NaN
## Neg Pred Value        0.92568      NaN   0.8919
## Prevalence            0.07432   0.8176   0.1081
## Detection Rate        0.00000   0.8176   0.0000
## Detection Prevalence  0.00000   1.0000   0.0000
## Balanced Accuracy     0.50000   0.5000   0.5000

4.2.10. App + Website + Sesión promedio

#SVM
svm.10 = svm(formula = Categoria.Cliente.Num ~ Time.on.App + Time.on.Website + Avg..Session.Length,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.10 = predict(object = svm.10,
                          newdata = testSet)

prediccionesSVMMF.10 = round(prediccionesSVMMF.10)
#Matriz de confusión
cm.4210 = confusionMatrix(as.factor(prediccionesSVMMF.10), as.factor(testSet$Categoria.Cliente.Num))
## Warning in confusionMatrix.default(as.factor(prediccionesSVMMF.10),
## as.factor(testSet$Categoria.Cliente.Num)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.4210
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   0   0   0
##          2  11 121  16
##          3   0   0   0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.00000   1.0000   0.0000
## Specificity           1.00000   0.0000   1.0000
## Pos Pred Value            NaN   0.8176      NaN
## Neg Pred Value        0.92568      NaN   0.8919
## Prevalence            0.07432   0.8176   0.1081
## Detection Rate        0.00000   0.8176   0.0000
## Detection Prevalence  0.00000   1.0000   0.0000
## Balanced Accuracy     0.50000   0.5000   0.5000

4.2.11. Membresía + App + Website + Sesión promedio

#SVM
svm.11 = svm(formula = Categoria.Cliente.Num ~ Length.of.Membership + Time.on.App + Time.on.Website + Avg..Session.Length,
              data = trainSet,
              kernel = "radial",
              gamma = 5)

#Predicción
prediccionesSVMMF.11 = predict(object = svm.11,
                          newdata = testSet)

prediccionesSVMMF.11 = round(prediccionesSVMMF.11)
#Matriz de confusión
cm.4211 = confusionMatrix(as.factor(prediccionesSVMMF.11), as.factor(testSet$Categoria.Cliente.Num))
## Warning in confusionMatrix.default(as.factor(prediccionesSVMMF.11),
## as.factor(testSet$Categoria.Cliente.Num)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.4211
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   1   2   3
##          1   0   0   0
##          2  11 121  16
##          3   0   0   0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: 1 Class: 2 Class: 3
## Sensitivity           0.00000   1.0000   0.0000
## Specificity           1.00000   0.0000   1.0000
## Pos Pred Value            NaN   0.8176      NaN
## Neg Pred Value        0.92568      NaN   0.8919
## Prevalence            0.07432   0.8176   0.1081
## Detection Rate        0.00000   0.8176   0.0000
## Detection Prevalence  0.00000   1.0000   0.0000
## Balanced Accuracy     0.50000   0.5000   0.5000
Hallazgos. Existen algunas diferencias y similitudes respecto al LDA. La diferencia más resaltante es que la combinación de las 4 variables no generó el mejor modelo (como en el caso anterior).
Por otro lado, al igual que en LDA, los modelos con mejor rendimiento fueron aquellos donde se encontraba presente tiempo en app y membresía.
En cuanto al performance, este no fue superior al obtenido mediante LDA, por lo que dicho algoritmo sigue siendo el mejor modelo al momento.

4.3 KNN

#Cross Validation
trControl = trainControl(method = "repeatedcv", 
                      number = 10,
                      repeats = 3)

4.3.1. Membresía + App

library(pROC)
## Type 'citation("pROC")' for a citation.
## 
## Attaching package: 'pROC'
## The following objects are masked from 'package:stats':
## 
##     cov, smooth, var
#KNN
KNN.1 = train(as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.App,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.1 = predict(object = KNN.1,
        newdata = testSet)
#Matriz de Confusión
cm.431 = confusionMatrix(prediccionKNN.1, as.factor(testSet$Categoria.Cliente))
cm.431
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       4   0       1
##    Oro          0   5       1
##    Platino     12   6     119
## 
## Overall Statistics
##                                          
##                Accuracy : 0.8649         
##                  95% CI : (0.799, 0.9155)
##     No Information Rate : 0.8176         
##     P-Value [Acc > NIR] : 0.07959        
##                                          
##                   Kappa : 0.4287         
##                                          
##  Mcnemar's Test P-Value : NA             
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.25000    0.45455         0.9835
## Specificity                0.99242    0.99270         0.3333
## Pos Pred Value             0.80000    0.83333         0.8686
## Neg Pred Value             0.91608    0.95775         0.8182
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.02703    0.03378         0.8041
## Detection Prevalence       0.03378    0.04054         0.9257
## Balanced Accuracy          0.62121    0.72362         0.6584

4.3.2. Membresía + Website

#KNN
KNN.2 = train(as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.Website,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.2 = predict(object = KNN.2,
        newdata = testSet)
#Matriz de Confusión
cm.432 = confusionMatrix(prediccionKNN.2, as.factor(testSet$Categoria.Cliente))
cm.432
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       2   0       0
##    Oro          0   2       1
##    Platino     14   9     120
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8378          
##                  95% CI : (0.7684, 0.8933)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.3031          
##                                           
##                   Kappa : 0.2169          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.12500    0.18182         0.9917
## Specificity                1.00000    0.99270         0.1481
## Pos Pred Value             1.00000    0.66667         0.8392
## Neg Pred Value             0.90411    0.93793         0.8000
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.01351    0.01351         0.8108
## Detection Prevalence       0.01351    0.02027         0.9662
## Balanced Accuracy          0.56250    0.58726         0.5699

4.3.3. Membresía + Sesión promedio

#KNN
KNN.3 = train(as.factor(Categoria.Cliente) ~ Length.of.Membership + Avg..Session.Length,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.3 = predict(object = KNN.3,
        newdata = testSet)
#Matriz de Confusión
cm.433 = confusionMatrix(prediccionKNN.3, as.factor(testSet$Categoria.Cliente))
cm.433
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       4   0       0
##    Oro          0   3       3
##    Platino     12   8     118
## 
## Overall Statistics
##                                          
##                Accuracy : 0.8446         
##                  95% CI : (0.776, 0.8989)
##     No Information Rate : 0.8176         
##     P-Value [Acc > NIR] : 0.2312         
##                                          
##                   Kappa : 0.3294         
##                                          
##  Mcnemar's Test P-Value : NA             
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.25000    0.27273         0.9752
## Specificity                1.00000    0.97810         0.2593
## Pos Pred Value             1.00000    0.50000         0.8551
## Neg Pred Value             0.91667    0.94366         0.7000
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.02703    0.02027         0.7973
## Detection Prevalence       0.02703    0.04054         0.9324
## Balanced Accuracy          0.62500    0.62541         0.6172

4.3.4. App + Website

#KNN
KNN.4 = train(as.factor(Categoria.Cliente) ~ Time.on.App + Time.on.Website,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.4 = predict(object = KNN.4,
        newdata = testSet)
#Matriz de Confusión
cm.434 = confusionMatrix(prediccionKNN.4, as.factor(testSet$Categoria.Cliente))
cm.434
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       0   0       0
##    Oro          0   0       0
##    Platino     16  11     121
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                 0.0000    0.00000         1.0000
## Specificity                 1.0000    1.00000         0.0000
## Pos Pred Value                 NaN        NaN         0.8176
## Neg Pred Value              0.8919    0.92568            NaN
## Prevalence                  0.1081    0.07432         0.8176
## Detection Rate              0.0000    0.00000         0.8176
## Detection Prevalence        0.0000    0.00000         1.0000
## Balanced Accuracy           0.5000    0.50000         0.5000

4.3.5. App + Sesión promedio

#KNN
KNN.5 = train(as.factor(Categoria.Cliente) ~ Time.on.App + Avg..Session.Length,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.5 = predict(object = KNN.5,
        newdata = testSet)
#Matriz de Confusión
cm.435 = confusionMatrix(prediccionKNN.5, as.factor(testSet$Categoria.Cliente))
cm.435
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       3   0       1
##    Oro          0   0       1
##    Platino     13  11     119
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8243          
##                  95% CI : (0.7533, 0.8819)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.4666          
##                                           
##                   Kappa : 0.1498          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.18750   0.000000         0.9835
## Specificity                0.99242   0.992701         0.1111
## Pos Pred Value             0.75000   0.000000         0.8322
## Neg Pred Value             0.90972   0.925170         0.6000
## Prevalence                 0.10811   0.074324         0.8176
## Detection Rate             0.02027   0.000000         0.8041
## Detection Prevalence       0.02703   0.006757         0.9662
## Balanced Accuracy          0.58996   0.496350         0.5473

4.3.6. Website + Sesión promedio

#KNN
KNN.6 = train(as.factor(Categoria.Cliente) ~ Time.on.Website + Avg..Session.Length,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.6 = predict(object = KNN.6,
        newdata = testSet)
#Matriz de Confusión
cm.436 = confusionMatrix(prediccionKNN.6, as.factor(testSet$Categoria.Cliente))
cm.436
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       0   0       0
##    Oro          0   0       0
##    Platino     16  11     121
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                 0.0000    0.00000         1.0000
## Specificity                 1.0000    1.00000         0.0000
## Pos Pred Value                 NaN        NaN         0.8176
## Neg Pred Value              0.8919    0.92568            NaN
## Prevalence                  0.1081    0.07432         0.8176
## Detection Rate              0.0000    0.00000         0.8176
## Detection Prevalence        0.0000    0.00000         1.0000
## Balanced Accuracy           0.5000    0.50000         0.5000

4.3.7. Membresía + App + Website

#KNN
KNN.7 = train(as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.App + Time.on.Website,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.7 = predict(object = KNN.7,
        newdata = testSet)
#Matriz de Confusión
cm.437 = confusionMatrix(prediccionKNN.7, as.factor(testSet$Categoria.Cliente))
cm.437
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       5   0       0
##    Oro          0   5       1
##    Platino     11   6     120
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8784          
##                  95% CI : (0.8146, 0.9263)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.03066         
##                                           
##                   Kappa : 0.4858          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.31250    0.45455         0.9917
## Specificity                1.00000    0.99270         0.3704
## Pos Pred Value             1.00000    0.83333         0.8759
## Neg Pred Value             0.92308    0.95775         0.9091
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.03378    0.03378         0.8108
## Detection Prevalence       0.03378    0.04054         0.9257
## Balanced Accuracy          0.65625    0.72362         0.6811

4.3.8. Membresía + App + Sesión promedio

#KNN
KNN.8 = train(as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.App + Avg..Session.Length,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.8 = predict(object = KNN.8,
        newdata = testSet)
#Matriz de Confusión
cm.438 = confusionMatrix(prediccionKNN.8, as.factor(testSet$Categoria.Cliente))
cm.438
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce      11   0       1
##    Oro          0   7       1
##    Platino      5   4     119
## 
## Overall Statistics
##                                           
##                Accuracy : 0.9257          
##                  95% CI : (0.8709, 0.9623)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.0001496       
##                                           
##                   Kappa : 0.7347          
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.68750    0.63636         0.9835
## Specificity                0.99242    0.99270         0.6667
## Pos Pred Value             0.91667    0.87500         0.9297
## Neg Pred Value             0.96324    0.97143         0.9000
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.07432    0.04730         0.8041
## Detection Prevalence       0.08108    0.05405         0.8649
## Balanced Accuracy          0.83996    0.81453         0.8251

4.3.9. Membresía + Website + Sesión promedio

#KNN
KNN.9 = train(as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.Website + Avg..Session.Length,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.9 = predict(object = KNN.9,
        newdata = testSet)
#Matriz de Confusión
cm.439 = confusionMatrix(prediccionKNN.9, as.factor(testSet$Categoria.Cliente))
cm.439
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       4   0       0
##    Oro          0   2       2
##    Platino     12   9     119
## 
## Overall Statistics
##                                          
##                Accuracy : 0.8446         
##                  95% CI : (0.776, 0.8989)
##     No Information Rate : 0.8176         
##     P-Value [Acc > NIR] : 0.2312         
##                                          
##                   Kappa : 0.299          
##                                          
##  Mcnemar's Test P-Value : NA             
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.25000    0.18182         0.9835
## Specificity                1.00000    0.98540         0.2222
## Pos Pred Value             1.00000    0.50000         0.8500
## Neg Pred Value             0.91667    0.93750         0.7500
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.02703    0.01351         0.8041
## Detection Prevalence       0.02703    0.02703         0.9459
## Balanced Accuracy          0.62500    0.58361         0.6028

4.3.10. App + Website + Sesión promedio

#KNN
KNN.10 = train(as.factor(Categoria.Cliente) ~ Time.on.App + Time.on.Website + Avg..Session.Length,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.10 = predict(object = KNN.10,
        newdata = testSet)
#Matriz de Confusión
cm.4310 = confusionMatrix(prediccionKNN.10, as.factor(testSet$Categoria.Cliente))
cm.4310
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       0   0       0
##    Oro          0   0       0
##    Platino     16  11     121
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8176          
##                  95% CI : (0.7458, 0.8762)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.5512          
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                 0.0000    0.00000         1.0000
## Specificity                 1.0000    1.00000         0.0000
## Pos Pred Value                 NaN        NaN         0.8176
## Neg Pred Value              0.8919    0.92568            NaN
## Prevalence                  0.1081    0.07432         0.8176
## Detection Rate              0.0000    0.00000         0.8176
## Detection Prevalence        0.0000    0.00000         1.0000
## Balanced Accuracy           0.5000    0.50000         0.5000

4.3.11. Membresía + App + Website + Sesión promedio

#KNN
KNN.11 = train(as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.App + Time.on.Website + Avg..Session.Length,
              data = trainSet,
              method = 'knn',
              tuneLength = 20, 
              trControl = trControl,
              preProc = c("center", "scale"))

#Predicción
prediccionKNN.11 = predict(object = KNN.11,
        newdata = testSet)
#Matriz de Confusión
cm.4311 = confusionMatrix(prediccionKNN.11, as.factor(testSet$Categoria.Cliente))
cm.4311
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       5   0       0
##    Oro          0   4       0
##    Platino     11   7     121
## 
## Overall Statistics
##                                           
##                Accuracy : 0.8784          
##                  95% CI : (0.8146, 0.9263)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 0.03066         
##                                           
##                   Kappa : 0.463           
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.31250    0.36364         1.0000
## Specificity                1.00000    1.00000         0.3333
## Pos Pred Value             1.00000    1.00000         0.8705
## Neg Pred Value             0.92308    0.95139         1.0000
## Prevalence                 0.10811    0.07432         0.8176
## Detection Rate             0.03378    0.02703         0.8176
## Detection Prevalence       0.03378    0.02703         0.9392
## Balanced Accuracy          0.65625    0.68182         0.6667
Hallazgos. El rendimiento general de estos modelos estuvo mejor que el obtenido en SVM. Algunos modelos llegan a superar en ocasiones el 95% de accuracy.
Pese a ello, en los intentos realizados ninguno superó el índice máximo obtenido en LDA.

4.4 ANN

Debido al nivel computacional que solicitan las ANN, se tomó la decisión de únicamente evaluar aquellas variables que en ocasiones anteriores han logrado obtener rendimientos encima del 90% bajo los 3 algoritmos anteriores.
library(neuralnet)
## 
## Attaching package: 'neuralnet'
## The following object is masked from 'package:dplyr':
## 
##     compute

4.4.1 Membresía + App

RedNeural.1=neuralnet(formula = as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.App,
                    data = trainSet,
                    hidden=(2:2),
                    linear.output = FALSE)
#Predicciones
prediccionesANN.1 = neuralnet::compute(RedNeural.1, testSet)
ANN.1 = prediccionesANN.1$net.result
ANN.1 = round(prediccionesANN.1$net.result)

ANN.1 = data.frame("ANN.1" = ifelse((ANN.1[ ,1]) %in% 1, "Oro",
                       ifelse((ANN.1[ ,2]) %in% 1,"Platino","Bronce")))
#Matriz de Confusión
cm.441 = confusionMatrix(ANN.1$ANN.1, as.factor(testSet$Categoria.Cliente))
cm.441
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       6   3     116
##    Oro         10   0       4
##    Platino      0   8       1
## 
## Overall Statistics
##                                          
##                Accuracy : 0.0473         
##                  95% CI : (0.0192, 0.095)
##     No Information Rate : 0.8176         
##     P-Value [Acc > NIR] : 1              
##                                          
##                   Kappa : -0.1183        
##                                          
##  Mcnemar's Test P-Value : <2e-16         
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.37500    0.00000       0.008264
## Specificity                0.09848    0.89781       0.703704
## Pos Pred Value             0.04800    0.00000       0.111111
## Neg Pred Value             0.56522    0.91791       0.136691
## Prevalence                 0.10811    0.07432       0.817568
## Detection Rate             0.04054    0.00000       0.006757
## Detection Prevalence       0.84459    0.09459       0.060811
## Balanced Accuracy          0.23674    0.44891       0.355984

4.4.2 Membresía + App + Website

RedNeural.2=neuralnet(formula = as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.App + Time.on.Website,
                    data = trainSet,
                    hidden=(1:2),
                    linear.output = FALSE)
#Predicciones
prediccionesANN.2 = neuralnet::compute(RedNeural.2, testSet)
ANN.2 = prediccionesANN.2$net.result
ANN.2 = round(prediccionesANN.2$net.result)

ANN.2 = data.frame("ANN.2" = ifelse((ANN.2[ ,1]) %in% 1, "Oro",
                       ifelse((ANN.2[ ,2]) %in% 1,"Platino","Bronce")))
#Matriz de Confusión
cm.442 = confusionMatrix(ANN.2$ANN.2, as.factor(testSet$Categoria.Cliente))
## Warning in confusionMatrix.default(ANN.2$ANN.2,
## as.factor(testSet$Categoria.Cliente)): Levels are not in the same order for
## reference and data. Refactoring data to match.
cm.442
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce      16  11     121
##    Oro          0   0       0
##    Platino      0   0       0
## 
## Overall Statistics
##                                           
##                Accuracy : 0.1081          
##                  95% CI : (0.0631, 0.1696)
##     No Information Rate : 0.8176          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0               
##                                           
##  Mcnemar's Test P-Value : NA              
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                 1.0000    0.00000         0.0000
## Specificity                 0.0000    1.00000         1.0000
## Pos Pred Value              0.1081        NaN            NaN
## Neg Pred Value                 NaN    0.92568         0.1824
## Prevalence                  0.1081    0.07432         0.8176
## Detection Rate              0.1081    0.00000         0.0000
## Detection Prevalence        1.0000    0.00000         0.0000
## Balanced Accuracy           0.5000    0.50000         0.5000

4.4.3 Membresía + App + Sesión promedio

RedNeural.3=neuralnet(formula = as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.App + Avg..Session.Length,
                    data = trainSet,
                    hidden=(2:2),
                    linear.output = FALSE)
#Predicciones
prediccionesANN.3 = neuralnet::compute(RedNeural.3, testSet)
ANN.3 = prediccionesANN.3$net.result
ANN.3 = round(prediccionesANN.3$net.result)

ANN.3 = data.frame("ANN.3" = ifelse((ANN.3[ ,1]) %in% 1, "Oro",
                       ifelse((ANN.3[ ,2]) %in% 1,"Platino","Bronce")))
#Matriz de Confusión
cm.443 = confusionMatrix(ANN.3$ANN.3, as.factor(testSet$Categoria.Cliente))
cm.443
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       0   0     118
##    Oro         16   0       1
##    Platino      0  11       2
## 
## Overall Statistics
##                                          
##                Accuracy : 0.0135         
##                  95% CI : (0.0016, 0.048)
##     No Information Rate : 0.8176         
##     P-Value [Acc > NIR] : 1              
##                                          
##                   Kappa : -0.1836        
##                                          
##  Mcnemar's Test P-Value : <2e-16         
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.00000    0.00000        0.01653
## Specificity                0.10606    0.87591        0.59259
## Pos Pred Value             0.00000    0.00000        0.15385
## Neg Pred Value             0.46667    0.91603        0.11852
## Prevalence                 0.10811    0.07432        0.81757
## Detection Rate             0.00000    0.00000        0.01351
## Detection Prevalence       0.79730    0.11486        0.08784
## Balanced Accuracy          0.05303    0.43796        0.30456

4.4.4 Membresía + App + Website + Sesión promedio

RedNeural.4=neuralnet(formula = as.factor(Categoria.Cliente) ~ Length.of.Membership + Time.on.App + Time.on.Website + Avg..Session.Length,
                    data = trainSet,
                    hidden=(1:2),
                    linear.output = FALSE)
#Predicciones
prediccionesANN.4 = neuralnet::compute(RedNeural.4, testSet)
ANN.4 = prediccionesANN.4$net.result
ANN.4 = round(prediccionesANN.4$net.result)

ANN.4 = data.frame("ANN.4" = ifelse((ANN.4[ ,1]) %in% 1, "Oro",
                       ifelse((ANN.4[ ,2]) %in% 1,"Platino","Bronce")))
#Matriz de Confusión
cm.444 = confusionMatrix(ANN.4$ANN.4, as.factor(testSet$Categoria.Cliente))
cm.444
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction Bronce Oro Platino
##    Bronce       0   0     119
##    Oro         16   0       1
##    Platino      0  11       1
## 
## Overall Statistics
##                                          
##                Accuracy : 0.0068         
##                  95% CI : (2e-04, 0.0371)
##     No Information Rate : 0.8176         
##     P-Value [Acc > NIR] : 1              
##                                          
##                   Kappa : -0.1849        
##                                          
##  Mcnemar's Test P-Value : <2e-16         
## 
## Statistics by Class:
## 
##                      Class: Bronce Class: Oro Class: Platino
## Sensitivity                0.00000    0.00000       0.008264
## Specificity                0.09848    0.87591       0.592593
## Pos Pred Value             0.00000    0.00000       0.083333
## Neg Pred Value             0.44828    0.91603       0.117647
## Prevalence                 0.10811    0.07432       0.817568
## Detection Rate             0.00000    0.00000       0.006757
## Detection Prevalence       0.80405    0.11486       0.081081
## Balanced Accuracy          0.04924    0.43796       0.300429
Hallazgos. A diferencia de todos los modelos anteriores, las ANN fueron pésimas para predecir el comportamiento de este modelo. Incluso pareciera ser que conforme se iban agregando más variables, el rendimiento del mismo iba entorpeciéndose.
Por tal motivo se descarta la posibilidad de considerar las ANN como un modelo efectivo.

5. Conclusiones

* Luego de haber realizado 41 combinaciones en 4 diferentes modelos (LDA, SVM, KNN y ANN) se concluye que el algoritmo más efectivo fue el de LDA.
* De 5 iteraciones realizadas, el modelo por LDA más efectivo fue el que incluía las variables: longevidad de la membresía, tiempo en App y Sesiones promedio.
* El accuracy promedio del modelo fue del 95.13%, con un Recall de 81.94% y Specificity del 90.93%.
* En relación al modelo en sí y su aplicación, es bastante efectivo para clasificar a los clientes en Oro, Platino o Bronce en función de las variables anteriores.

6. Recomendaciones

* En base a la etapa de análisis, es altamente recomendable guiarse por las variables que tengan mayor correlación con la variable explicada. Esto con la finalidad de ahorrar tiempo.
* Evitar realizarlo por ANN ya que, debido a la forma de selección de las etiquetas, es bastante desacertado.