Task 1

mydata = read.csv("data/creditrisk.csv")
head(mydata)
##      Loan.Purpose Checking Savings Months.Customer Months.Employed Gender
## 1 Small Appliance        0     739              13              12      M
## 2       Furniture        0    1230              25               0      M
## 3         New Car        0     389              19             119      M
## 4       Furniture      638     347              13              14      M
## 5       Education      963    4754              40              45      M
## 6       Furniture     2827       0              11              13      M
##   Marital.Status Age Housing Years        Job Credit.Risk
## 1         Single  23     Own     3  Unskilled         Low
## 2       Divorced  32     Own     1    Skilled        High
## 3         Single  38     Own     4 Management        High
## 4         Single  36     Own     2  Unskilled        High
## 5         Single  31    Rent     3    Skilled         Low
## 6        Married  25     Own     1    Skilled         Low

Task 2

mydata = read.csv(file="data/creditrisk.csv")
head(mydata)
##      Loan.Purpose Checking Savings Months.Customer Months.Employed Gender
## 1 Small Appliance        0     739              13              12      M
## 2       Furniture        0    1230              25               0      M
## 3         New Car        0     389              19             119      M
## 4       Furniture      638     347              13              14      M
## 5       Education      963    4754              40              45      M
## 6       Furniture     2827       0              11              13      M
##   Marital.Status Age Housing Years        Job Credit.Risk
## 1         Single  23     Own     3  Unskilled         Low
## 2       Divorced  32     Own     1    Skilled        High
## 3         Single  38     Own     4 Management        High
## 4         Single  36     Own     2  Unskilled        High
## 5         Single  31    Rent     3    Skilled         Low
## 6        Married  25     Own     1    Skilled         Low
checking = mydata$Checking 
checking
##   [1]     0     0     0   638   963  2827     0     0  6509   966     0
##  [12]     0   322     0   396     0   652   708   207   287     0   101
##  [23]     0     0     0   141     0  2484   237     0   335  3565     0
##  [34] 16647     0     0     0   940     0     0   218     0 16935   664
##  [45]   150     0   216     0     0     0   265  4256   870   162     0
##  [56]     0     0   461     0     0     0   580     0     0     0     0
##  [67]   758   399   513     0     0   565     0     0     0   166  9783
##  [78]   674     0 15328     0   713     0     0     0     0     0   303
##  [89]   900     0  1257     0   273   522     0     0     0     0   514
## [100]   457  5133     0   644   305  9621     0     0     0     0     0
## [111]  6851 13496   509     0 19155     0     0   374     0   828     0
## [122]   829     0     0   939     0   889   876   893 12760     0     0
## [133]   959     0     0     0     0   698     0     0     0 12974     0
## [144]   317     0     0     0   192     0     0     0     0     0   942
## [155]     0  3329     0     0     0     0     0     0   339     0     0
## [166]     0   105     0   216   113   109     0     0  8176     0   468
## [177]  7885     0     0     0     0     0     0     0     0     0   734
## [188]     0     0   172   644     0   617     0   586     0     0     0
## [199]     0     0   522   585  5588     0   352     0  2715   560   895
## [210]   305     0     0     0  8948     0     0     0     0     0   483
## [221]     0     0     0   663   624     0     0   152     0     0   498
## [232]     0   156  1336     0     0     0  2641     0     0     0     0
## [243]     0   887     0     0     0     0 18408   497     0   946   986
## [254]  8122     0   778   645     0   682 19812     0     0   859     0
## [265]     0     0     0     0     0   795     0     0     0     0   852
## [276]     0     0   425     0     0     0 11072     0   219  8060     0
## [287]     0     0     0  1613   757     0     0   977   197     0     0
## [298]     0     0     0   256   296     0     0     0   298     0  8636
## [309]     0     0 19766     0     0     0     0  4089     0   271   949
## [320]     0   911     0     0     0     0   271     0     0     0     0
## [331]  4802   177     0     0   996   705     0     0  5960     0   759
## [342]     0   651   257   955     0  8249     0   956   382     0   842
## [353]  3111     0     0  2846   231     0 17366     0   332   242     0
## [364]   929     0     0     0     0     0     0     0   646   538     0
## [375]     0     0     0   135  2472     0 10417   211 16630     0   642
## [386]     0   296   898   478   315   122     0     0     0   670   444
## [397]  3880   819     0     0     0     0     0     0     0     0     0
## [408]   161     0     0   789   765     0     0   983     0     0   798
## [419]     0   193   497     0     0     0     0
savings = mydata$Savings 
savings
##   [1]   739  1230   389   347  4754     0   229   533   493     0   989
##  [12]  3305   578   821   228   129   732   683     0 12348 17545  3871
##  [23]     0   485 10723   245     0     0   236   485  1708     0   407
##  [34]   895   150   490   162   715   323   128     0   109   189   537
##  [45]  6520   138     0   660   724   897   947     0   917   595   789
##  [56]     0   746   140   659   717   667     0   763  1366   552 14643
##  [67]  2665     0   442  8357     0   863   322   800   656   922   885
##  [78]  2886   626     0   904   784   806  3281   759   680   104   899
##  [89]  1732   706     0   576   904   194   710  5564   192   637   405
## [100]   318   698   369     0   492   308   127   565 12632   116   178
## [111]   901   650   241   609   131   544 10853     0   409   391   322
## [122]   583 12242   479   496   466  1583  1533     0  4873     0   717
## [133]  7876  4449     0   104   897  4033   945   836   325 19568   803
## [144] 10980   265   609  1851   199   500   509   270   457   260  3036
## [155]   643     0  6345   922   909   775   979   948  2790   309   762
## [166]   970   320   861   262   692   540   470   192 12230   772 14186
## [177]  6330 18716   886   750  3870  3273   406   461   340  6490   348
## [188]   506 14717     0  1571     0   411   544     0   835   823  5180
## [199]   408   821   385  2223     0   605  7525  3529  1435   887   243
## [210]  4553   418   771   463   110 10099 13428   208   552  3105   415
## [221]  1238   238   127     0   785   718   493   757  9125   364   598
## [232]   374     0     0   508   956   636     0  1519   922   180   701
## [243]   296   519   800   736 11838   364   212   888   999     0   578
## [254]   136   734   861   855  4486  2017     0   500   859  3305  1218
## [265]  9016 11587  8944   807   867 16804   347   836   142   169  3613
## [276]   403   836     0 11481  3285   164   891     0   841   607   486
## [287]   108     0   113     0   208   603   343   463     0   299   490
## [298]  6628   859   750   954   591 13970   857  5857  3326   726   214
## [309]   207   713  2141   483   127   367   813     0   102   759     0
## [320]   503   823   693   973   648   523  7090   596   904   541   154
## [331]     0     0   337   716   837     0  7710   531   129   941   596
## [342]   987     0   460     0   798     0   959  1482   883 12721     0
## [353]     0   302   538     0   702  2688     0   425   214     0   272
## [364]   124 17124   612   862   146 14190   396   519     0   344   204
## [375]   148   435   914     0     0   412 19811   822     0  3369     0
## [386]   707   818   177  4071   466   460   991 17653   497  4014   921
## [397]     0     0   607 15800   369  4973     0   761   471   674   547
## [408]   524   815     0   989 10406   957   770   950   160   276   137
## [419]   579  2684     0     0     0   712   912
meanChecking = mean(checking) 
meanChecking
## [1] 1048.014
meanSavings = mean(savings) 
meanSavings
## [1] 1812.562
spreadChecking = sd(checking) 
spreadChecking
## [1] 3147.183
spreadSavings = sd(savings) 
spreadSavings
## [1] 3597.285
snr_Checking = meanChecking/spreadChecking 
snr_Checking
## [1] 0.3330006
snr_Savings = meanSavings/spreadSavings
snr_Savings
## [1] 0.5038695

Of the checking and savings, which has the higher SNR? Why do you think that is? Savings has the higher SNR of the two. I would suspect this is because, compared to checking at 1048.014, savings stands at 1812.562. But also, savings has greater units of data, while checking has more 0’s than savings.


Task 3